Jump to content

HELP - LOD OBJECT SCRIPT


Ryosuke

Recommended Posts

 

Hi, I modeled a map and would like to break the field-of-view limit.

 there is a limit of 300 units of the distance object, how can I make to make all objects visible from a greater distance?

txd = engineLoadTXD ( "1.txd" )
engineImportTXD ( txd, 1515 )
dff = engineLoadDFF ( "1.dff" )
engineReplaceModel ( dff, 1515 )
col = engineLoadCOL( "1.col" )
engineReplaceCOL( col, 1515 )
engineSetModelLODDistance(1515, 300)

7VgiZgw.jpg

Edited by Elvis Willian
Link to comment
  • Moderators
48 minutes ago, Ryosuke said:

 

Hi, I modeled a map and would like to break the field-of-view limit.

 there is a limit of 300 units of the distance object, how can I make to make all objects visible from a greater distance?

txd = engineLoadTXD ( "1.txd" )
engineImportTXD ( txd, 1515 )
dff = engineLoadDFF ( "1.dff" )
engineReplaceModel ( dff, 1515 )
col = engineLoadCOL( "1.col" )
engineReplaceCOL( col, 1515 )
engineSetModelLODDistance(1515, 300)

7VgiZgw.jpg

See example on wiki:

https://wiki.multitheftauto.com/wiki/SetLowLODElement

 

Link to comment
  • MTA Anti-Cheat Team
1 hour ago, Senna said:

 

I also tried to use this, but unfortunately it doesn't work. Even, objects don't create (normal and lod) and debugscripting doesn't give any errors. O.o 

I don't really work with LOD's very often so not sure about your problem (could open a new topic in this section to see why something that should work isn't with your code), but I advise you to just use assignLod.

Also take a look at;

engineSetModelLODDistance

Let me know if assignLod works out for you

  • Thanks 1
Link to comment
36 minutes ago, Dutchman101 said:

I don't really work with LOD's very often so not sure about your problem (could open a new topic in this section to see why something that should work isn't with your code), but I advise you to just use assignLod.

Let me know if this works out for you

Thank you. I'll try this method and let you know works it or doesn't 

Link to comment

@Dutchman101 

It works! Thank you. One more problem.. I have more than 6.000 objects. Objects contained in a table. Can I apply function assignLod to the table? 

Oh no unfortunately it is't possible because in the table objects don't create  through createObject 

:(

Edited by Senna
Link to comment
  • MTA Anti-Cheat Team
23 minutes ago, Senna said:

@Dutchman101 

It works! Thank you. One more problem.. I have more than 6.000 objects. Objects contained in a table. Can I apply function assignLod to the table? 

Oh no unfortunately it is't possible because in the table objects don't create  through createObject 

:(

The first 2 pages of results on https://www.google.com/search?q=mta+map+to+lua contain quite a few useful .map to lua createObject converters. I would just append the function embed and eventhandler, and automatise embedding the assignLod call; if you got a huge table of objects it's most convenient to use something like Notepad++, CTRL + F, replace tab, input (find what): "createObject" and replace with: "assignLOD(createObject" and then hit "Replace all". After that, you just add the assignLod function code at the bottom.

And yes, applying assignLod to a table itself shouldn't be a problem.

  • Thanks 1
Link to comment
53 minutes ago, Dutchman101 said:

The first 2 pages of results on https://www.google.com/search?q=mta+map+to+lua contain quite a few useful .map to lua createObject converters. I would just append the function embed and eventhandler, and automatise embedding the assignLod call; if you got a huge table of objects it's most convenient to use something like Notepad++, CTRL + F, replace tab, input (find what): "createObject" and replace with: "assignLOD(createObject" and then hit "Replace all". After that, you just add the assignLod function code at the bottom.

And yes, applying assignLod to a table itself shouldn't be a problem.

wow thanks. I tried trick with "replace all" and it's work. But objects create on server side. Does it bring any lags? 

P.S scripts creates approximately 6.000 objects 

Link to comment
  • MTA Anti-Cheat Team
26 minutes ago, Senna said:

But objects create on server side. Does it bring any lags? 

The object creation is a server-side script, and it's supposed to create the objects only once. So if there is any lag at all, it would only be at the start of MTA server and before any players join, or maybe when you restart the resource due to changing something in the resource. It's not heavier than regular .map files though as far I know, so it shouldn't really have additional impact to begin with.

  • Like 1
Link to comment
  • MTA Anti-Cheat Team
7 hours ago, Senna said:

@Dutchman101 However, CreateObject has 2 big disadvantages. They are lack of scaling and doublesizing  

use SetObjectScale and setElementDoubleSided after creation..

the .map to LUA converter at http://mta.cemgokmen.com/converter/converter.php even features keeping scale and doublesizing information, for easy applying in batch.

If you prefer tho, you can easily go back to using .map and utilize the LOD functionality in mapEditorScriptingExtension_s and mapEditorScriptingExtension_c (a common mistake of mappers is not retaining these files, or not using the neccesary setting "useLODs" on affected maps)

  • Like 1
Link to comment
14 hours ago, Dutchman101 said:

use SetObjectScale and setElementDoubleSided after creation..

the .map to LUA converter at http://mta.cemgokmen.com/converter/converter.php even features keeping scale and doublesizing information, for easy applying in batch.

If you prefer tho, you can easily go back to using .map and utilize the LOD functionality in mapEditorScriptingExtension_s and mapEditorScriptingExtension_c (a common mistake of mappers is not retaining these files, or not using the neccesary setting "useLODs" on affected maps)

I tried to add id to the lod table in mapEditorScriptingExtension_s, but it doesn't have any effect :(

About map converter:

How to add AssignLod function to the code which converter gives? https://pastecode.xyz/view/8905019f

Sorry for disturbing and thank you for your help 

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...