Krox Posted November 2, 2019 Share Posted November 2, 2019 (edited) Hey Community, I will try to explain it as short as possible. I want to replace the SFPD HQ model but for some weird reason it doesnt load correctly. but once I grab it Its magically there So why is it only loading when I grab this Object? Edited November 2, 2019 by Krox Link to comment
Administrators Tut Posted November 3, 2019 Administrators Share Posted November 3, 2019 That's how world objects are replaced. See this post for more information: https://wiki.multitheftauto.com/wiki/EngineReplaceModel_notes Link to comment
Krox Posted November 3, 2019 Author Share Posted November 3, 2019 (edited) 53 minutes ago, Tut said: That's how world objects are replaced. See this post for more information: https://wiki.multitheftauto.com/wiki/EngineReplaceModel_notes Thanks! I managed to replace the world object and now the correct model is appearing. Tho I kinda have a problem doing the LODs. I cant get the LOD working properly. Its now inside the building everytime and when I hide it, its completely gone Here is the code I tried: Quote addEventHandler("onClientResourceStart", resourceRoot, function() local modelId = 10028 local x,y,z = -1636.3047, 682.7656, 27.4531 obj = createObject( modelId, x,y,z ) removeWorldModel( modelId, 10028, x,y,z ) -- Hide original col = engineLoadCOL( "sfpd.col" ) txd = engineLoadTXD( "sfpd.txd" ) dff = engineLoadDFF( "sfpd.dff", 0 ) engineReplaceCOL( col, modelId ) engineImportTXD( txd, modelId ) engineReplaceModel( dff, modelId ) local modelIdLOD = 9967 removeWorldModel ( modelIdLOD, 9967, x,y,z ) -- Hide LOD objLOD = createObject( modelIdLOD, 9967, x,y,z, -1636.3047, 682.7656, 27.4531, true ) setLowLODElement(obj, objLOD) end ) Edited November 3, 2019 by Krox Link to comment
komal Posted November 3, 2019 Share Posted November 3, 2019 Lod always bug in mta nobody carry about LODElements Link to comment
Krox Posted November 4, 2019 Author Share Posted November 4, 2019 Found the mistake. For people with the same problem here is the correct code: function() local modelId = 10028 local modelIdLOD = 9967 local x,y,z = -1636.3047, 682.7656, 27.4531 removeWorldModel( modelId, 1000, x,y,z ) -- Hide original removeWorldModel ( modelIdLOD, 1000, x,y,z ) -- Hide LOD col = engineLoadCOL( "sfpd.col" ) txd = engineLoadTXD( "sfpd.txd" ) dff = engineLoadDFF( "sfpd.dff", 0 ) engineReplaceCOL( col, modelId ) engineImportTXD( txd, modelId ) engineReplaceModel( dff, modelId ) obj = createObject( modelId, x,y,z, 0, 0, 0 ) objLOD = createObject( modelIdLOD, x,y,z, 0, 0, 0, true ) setLowLODElement(obj, objLOD) end ) 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