Nicolas3D Posted March 10, 2021 Share Posted March 10, 2021 Hello I'm editing the map and I can't use the create object function, is there any special function when the object is modified? What is better to use for the .map or .lua player? what is the difference between server and client? function loadMapObjects() createObject ( 3724, 2838.0313, -2371.9531, 7.29688, 0, 0, 270 ) end addEventHandler("onResourceStart", resourceRoot, loadMapObjects) txd = engineLoadTXD("TXD/3724.txd") engineImportTXD (txd, 3724) dff = engineLoadDFF("DFF/3724.dff") engineReplaceModel (dff, 3724) col = engineLoadCOL("COL/3724.col") engineReplaceCOL (col, 3724) <meta> <info author="Nicolas3D" version="1.3" name="LS" type="mapa" /> <script src="objetos.lua" type="client" /> <script src="posicao.lua" type="server" /> <file src="DFF/3724.dff" /> <file src="COL/3724.col" /> </meta> Link to comment
Moderators IIYAMA Posted March 10, 2021 Moderators Share Posted March 10, 2021 On 10/03/2021 at 09:28, Nicolas3D said: Hello I'm editing the map and I can't use the create object function Expand onResourceStart = serverside < reason why your code does not run. onClientResourceStart = clientside On 10/03/2021 at 09:28, Nicolas3D said: What is better to use for the .map or .lua player? Expand Depending on the quantity, if it is just 2 objects, it doesn't really matter. But if it is 1000 objects, .map will be faster. On 10/03/2021 at 09:28, Nicolas3D said: what is the difference between server and client? Expand Server Server(side) is code running on the server. There is only 1 serverside. Client Players are clients. This code is running inside of the game. Each player is running a copy of this code. Link to comment
Nicolas3D Posted March 10, 2021 Author Share Posted March 10, 2021 On 10/03/2021 at 09:41, IIYAMA said: onResourceStart = serverside < reason why your code does not run. onClientResourceStart = clientside Depending on the quantity, if it is just 2 objects, it doesn't really matter. But if it is 1000 objects, .map will be faster. Server Server(side) is code running on the server. There is only 1 serverside. Client Players are clients. This code is running inside of the game. Each player is running a copy of this code. Expand Tks, I will have to use the .map, so the script will not be necessary, but I was in doubt how to put the lod in the .map in case I created a lod, how do I load it Link to comment
Moderators IIYAMA Posted March 10, 2021 Moderators Share Posted March 10, 2021 On 10/03/2021 at 09:53, Nicolas3D said: Tks, I will have to use the .map, so the script will not be necessary, but I was in doubt how to put the lod in the .map in case I created a lod, how do I load it Expand For lowLOD's you need scripting as well afaik. https://wiki.multitheftauto.com/wiki/SetLowLODElement Link to comment
Nicolas3D Posted March 10, 2021 Author Share Posted March 10, 2021 On 10/03/2021 at 10:03, IIYAMA said: Para lowLOD's, você também precisa de um script. https://wiki.multitheftauto.com/wiki/SetLowLODElement Expand tks for map is better to use serverside or clientside Link to comment
Moderators IIYAMA Posted March 10, 2021 Moderators Share Posted March 10, 2021 On 10/03/2021 at 10:07, Nicolas3D said: tks for map is better to use serverside or clientside Expand serverside, else you are going to need some bunny hops to make it work. There are no clientside support functions for map files. Link to comment
Nicolas3D Posted March 10, 2021 Author Share Posted March 10, 2021 On 10/03/2021 at 10:03, IIYAMA said: For lowLOD's you need scripting as well afaik. https://wiki.multitheftauto.com/wiki/SetLowLODElement Expand I had used this code for the lods but I believe it doesn’t fit or I did it wrong https://wiki.multitheftauto.com/wiki/EngineReplaceModel_notes txdLOD = engineLoadTXD( "garageLOD.txd" ) engineImportTXD( txdLOD, modelIdLOD ) dffLOD = engineLoadDFF( "LODDFF/5164.dff", 0 ) engineReplaceModel( dffLOD, 5164 ) objLOD = createObject( 5164, 2839.0313,-2371,9531,7.29688, 0, 0, 270, true ) setLowLODElement(3724, 5164) engineSetModelLODDistance (5164,5000) Link to comment
Moderators IIYAMA Posted March 10, 2021 Moderators Share Posted March 10, 2021 On 10/03/2021 at 11:10, Nicolas3D said: I had used this code for the lods but I believe it doesn’t fit or I did it wrong https://wiki.multitheftauto.com/wiki/EngineReplaceModel_notes txdLOD = engineLoadTXD( "garageLOD.txd" ) engineImportTXD( txdLOD, modelIdLOD ) dffLOD = engineLoadDFF( "LODDFF/5164.dff", 0 ) engineReplaceModel( dffLOD, 5164 ) objLOD = createObject( 5164, 2839.0313,-2371,9531,7.29688, 0, 0, 270, true ) setLowLODElement(3724, 5164) engineSetModelLODDistance (5164,5000) Expand The syntax for the setLowLODElement function: bool setLowLODElement ( element theElement, element lowLODElement ) https://wiki.multitheftauto.com/wiki/SetLowLODElement You need to fill in the elements, not the model number. Afaik you are seeing warnings/errors appear in your debug console because of this. This function is used for swapping between default objects and lowLOD objects, depending if the object is streamed-in or not. Link to comment
Nicolas3D Posted March 10, 2021 Author Share Posted March 10, 2021 On 10/03/2021 at 11:17, IIYAMA said: The syntax for the setLowLODElement function: bool setLowLODElement ( element theElement, element lowLODElement ) https://wiki.multitheftauto.com/wiki/SetLowLODElement You need to fill in the elements, not the model number. Afaik you are seeing warnings/errors appear in your debug console because of this. This function is used for swapping between default objects and lowLOD objects, depending if the object is streamed-in or not. Expand I didn’t understand, I could show you an example I don’t know much about scripta Link to comment
Moderators IIYAMA Posted March 10, 2021 Moderators Share Posted March 10, 2021 On 10/03/2021 at 11:26, Nicolas3D said: I didn’t understand, I could show you an example I don’t know much about scripta Expand Or you learn to script first, so that your topic doesn't become a scripting request. I only give examples when you can learn enough from them, which is not the case when your question goes beyond the basics (those that you are missing at the moment). Link to comment
Nicolas3D Posted March 10, 2021 Author Share Posted March 10, 2021 On 10/03/2021 at 12:06, IIYAMA said: Or you learn to script first, so that your topic doesn't become a scripting request. I only give examples when you can learn enough from them, which is not the case when your question goes beyond the basics (those that you are missing at the moment). Expand the basics I can understand but it's starting to complicate in some parts my area is 3D but I want to evolve to script Link to comment
Moderators IIYAMA Posted March 10, 2021 Moderators Share Posted March 10, 2021 On 10/03/2021 at 12:28, Nicolas3D said: the basics I can understand but it's starting to complicate in some parts my area is 3D but I want to evolve to script Expand Oh perfect. In that case, create 2 objects at the same place and link them together: -- non lowLOD obj = createObject( 5164, 2839.0313,-2371,9531,7.29688, 0, 0, 270, false ) -- lowLOD objLOD = createObject( 5164, 2839.0313,-2371,9531,7.29688, 0, 0, 270, true ) setLowLODElement(obj, objLOD) When the non lowLOD variant streams out, the lowLOD variant will kick-in. Link to comment
Nicolas3D Posted March 10, 2021 Author Share Posted March 10, 2021 On 10/03/2021 at 12:48, IIYAMA said: Oh perfect. In that case, create 2 objects at the same place and link them together: -- non lowLOD obj = createObject( 5164, 2839.0313,-2371,9531,7.29688, 0, 0, 270, false ) -- lowLOD objLOD = createObject( 5164, 2839.0313,-2371,9531,7.29688, 0, 0, 270, true ) setLowLODElement(obj, objLOD) When the non lowLOD variant streams out, the lowLOD variant will kick-in. Expand ERROR: test.lua:2: attempt to call global 'engineLoadDFF' (a nil value There was even a lod but it is original to the game, and even if it moves me away, it does not disappear Link to comment
Moderators IIYAMA Posted March 10, 2021 Moderators Share Posted March 10, 2021 On 10/03/2021 at 13:41, Nicolas3D said: ERROR: test.lua:2: attempt to call global 'engineLoadDFF' (a nil value Expand That function is only available on clientside. See docs: https://wiki.multitheftauto.com/wiki/EngineLoadDFF 1 Link to comment
Nicolas3D Posted March 10, 2021 Author Share Posted March 10, 2021 On 10/03/2021 at 14:40, IIYAMA said: That function is only available on clientside. See docs: https://wiki.multitheftauto.com/wiki/EngineLoadDFF Expand thank you very much for your explanation helped me to understand and learn a little On 10/03/2021 at 14:40, IIYAMA said: That function is only available on clientside. See docs: https://wiki.multitheftauto.com/wiki/EngineLoadDFF Expand thank you very much for your explanation helped me to understand and learn a little 3 There would be no way to change the 3D switching time with the lod 1 Link to comment
Moderators IIYAMA Posted March 10, 2021 Moderators Share Posted March 10, 2021 On 10/03/2021 at 14:54, Nicolas3D said: There would be no way to change the 3D switching time with the lod Expand You mean the switching time of the model? Or switching/swapping time of the lowLOD? Link to comment
Nicolas3D Posted March 10, 2021 Author Share Posted March 10, 2021 the time that the model appears because I have to arrive very close to load Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now