Jump to content

replace models


veronapl

Recommended Posts

Hi. Sorry, not speak English. I can't replace building model in MTA. In single player (add to gta3.img and ipl file) is all good. In mta is not working :/

This is code:

addCommandHandler( "ob",
      function( )
outputChatBox ( "test!" )
txd = engineLoadTXD( "frankiesbase.txd" )
dff = engineLoadDFF( "franksclb02.dff", 0 )
col = engineLoadCOL( "indust.col" )
engineImportTXD( txd, 17520 )
engineReplaceModel( dff, 17520 )
engineReplaceCOL( col, 17520 )
 
	          outputChatBox ( "test!" )
end
)

<meta>
<info author="ver" version="1.2" type="script" name="ver" />
 
<script src="server.lua" type="client" />
<file src="franksclb02.dff" />
<file src="frankiesbase.txd" />
<file src="indust.col" />
 
</meta>

All 3 files in script archive. 0 errors and warning in console.

This is video:

http://www.youtube.com/watch?v=xp_wY4tSIa4

Old model, old texture, not collision... Why?

Help

Link to comment

addCommandHandler( "ob",
      function( )
outputChatBox ( "test" )
txd = engineLoadTXD( "frankiesbase.txd" )
dff = engineLoadDFF( "franksclb02.dff", 0 )
col = engineLoadCOL( "indust.col" )
createObject ( dff, 2462.79, -1784.22, 46.545, 0, 0, 0 )
outputChatBox ( "test" )
end
)

This is don't working :( Not created object.

Link to comment

addCommandHandler( "ob",
 
            function( )
 
     outputChatBox ( "test" )
 
     txd = engineLoadTXD( "frankiesbase.txd" )
 
     dff = engineLoadDFF( "franksclb02.dff", 17520 )
 
     col = engineLoadCOL( "indust.col" )
 
 
engineImportTXD( txd, 17520 )
 
engineReplaceModel( dff, 17520 )
 
engineReplaceCOL( col, 17520 )	  
 
createObject ( 17520, 2462.79, -1784.22, 46.545, 0, 0, 0 )

This code create news obejct, and replace old object :) Why not texture (objects is white) and not collision?

Link to comment

You did the right thing with engineLoadDFF before. Specify 0 as the 2nd argument if you're loading any model but vehicles. So, if you're loading new vehicle model you need to specify ID of vehicle you're replacing but if you're loading new object model use 0.

Engine functions are not perfect and will never be. You will sometimes see white object without texture and sometimes you'll see texture loaded properly. Restarting resource sometimes help but not always. Sometimes you'll have to restart resource even 10 times to get textured models. That happens and is normal.

Link to comment

Ahh model is white again :( Restart resource not help. Model is white, old collision:

addCommandHandler( "ob",
 
            function( )
 
     outputChatBox ( "test" )
 
     dff = engineLoadDFF( "zam.dff", 0 )	  
 
     txd = engineLoadTXD( "zam.txd", 17520 )
 
     col = engineLoadCOL( "zam.col", 17520 )
 
 
 
engineReplaceModel( dff, 17520 )
 
engineImportTXD( txd, 17520 )
 
engineReplaceCOL( col, 17520 )	  
 
createObject ( 17520, 2462.79, -1784.22, 46.545, 0, 0, 0 )
 
     outputChatBox ( "test" )
 
     end
 
     )

Link to comment
Always replace the Model LAST. (engineReplaceModel)

Replace the TXD and the COL, then replace the Model.

you can load them in any order however, as long as you always replace the model last.

addCommandHandler( "ob",
 
            function( )
 
     outputChatBox ( "test" )
 
     dff = engineLoadDFF( "zam.dff", 0 )	  
 
     txd = engineLoadTXD( "zam.txd", 0 )
 
     col = engineLoadCOL( "zam.col", 0 )
 
 
 
 
engineImportTXD( txd, 17520 )
 
engineReplaceCOL( col, 17520 )	  
 
engineReplaceModel( dff, 17520 )	  
createObject ( 17520, 2462.79, -1784.22, 46.545, 0, 0, 0 )
 
     outputChatBox ( "test" )
 
     end
 
     )

DFF: Visible (ON)

Col: ON :)

Texture: Not Visible (OFF, model is white)

20x restart command, restart resource, not help :(

Link to comment

engineLoadCOL and engineLoadTXD only take 1 argument, the file to load.

Also, even though I said it doesn't matter (because as far as I remember, it didn't when i tested it :P), play around with the order of the load lines. Again the model itself is always best last.

I'd go as far as trying replacing the txd and col THEN loading, then replacing the model, just to see if that works out.

Link to comment

True. My object work!!! Texture, model and col work! Very very thanks 50p and Subenji99!

You did the right thing with engineLoadDFF before. Specify 0 as the 2nd argument if you're loading any model but vehicles. So, if you're loading new vehicle model you need to specify ID of vehicle you're replacing but if you're loading new object model use 0.

Engine functions are not perfect and will never be. You will sometimes see white object without texture and sometimes you'll see texture loaded properly. Restarting resource sometimes help but not always. Sometimes you'll have to restart resource even 10 times to get textured models. That happens and is normal.

True :( Press /ob - model white, press /ob - model white, press /ob - texture in model, /ob - model white, /ob - texture.... -//- .... :(

How to fix it? This is possible? :(

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