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 12 minutes ago, Nicolas3D said: Hello I'm editing the map and I can't use the create object function onResourceStart = serverside < reason why your code does not run. onClientResourceStart = clientside 9 minutes ago, Nicolas3D said: What is better to use for the .map or .lua player? 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. 6 minutes ago, Nicolas3D said: what is the difference between server and client? 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 10 minutes ago, 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. 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 9 minutes ago, 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 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 4 minutes ago, IIYAMA said: Para lowLOD's, você também precisa de um script. https://wiki.multitheftauto.com/wiki/SetLowLODElement 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 3 minutes ago, Nicolas3D said: tks for map is better to use serverside or clientside 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 1 hour ago, IIYAMA said: For lowLOD's you need scripting as well afaik. https://wiki.multitheftauto.com/wiki/SetLowLODElement 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 2 minutes ago, 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) 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 8 minutes ago, 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. 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 30 minutes ago, Nicolas3D said: I didn’t understand, I could show you an example I don’t know much about scripta 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 21 minutes ago, 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). 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 16 minutes ago, 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 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 52 minutes ago, 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. 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 58 minutes ago, Nicolas3D said: ERROR: test.lua:2: attempt to call global 'engineLoadDFF' (a nil value 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 14 minutes ago, IIYAMA said: That function is only available on clientside. See docs: https://wiki.multitheftauto.com/wiki/EngineLoadDFF thank you very much for your explanation helped me to understand and learn a little 18 minutes ago, IIYAMA said: That function is only available on clientside. See docs: https://wiki.multitheftauto.com/wiki/EngineLoadDFF 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 21 minutes ago, Nicolas3D said: There would be no way to change the 3D switching time with the lod 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