Jump to content

Problem with Resource not loading correctly.


Krox

Recommended Posts

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.

DfbDQMp.png

 

but once I grab it

5aDpl7e.png

 

Its magically there

Qgmk4aQ.png

 

So why is it only loading when I grab this Object?

Edited by Krox
Link to comment
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 by Krox
Link to comment

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

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...