Jump to content

Replace TXD AmmoHudComponent


Recommended Posts

function installchnsaw ( startedResource ) 
    if ( startedResource == getThisResource() ) then 
        outputChatBox ( "chnsaw_hud" ) 
        txd = engineLoadTXD ( "data/chnsawicon.txd" ) 
        engineImportTXD ( txd, chnsaw ) 
        txd = engineLoadTXD ( "data/chnsawicon.txd" ) 
        engineReplaceModel ( txd, chnsawicon ) 
    end 
end 
  
addEventHandler ( "onClientResourceStart", getRootElement(), chnsaw ) 

http://development.mtasa.com/index.php? ... ineLoadTXD

To export chnsawicon i use IMGTOOL 2.0 next i use TXD workshop and formated TXD in png then i worked vs photoshop thet i formated egean in TXD

Script run -no erors but nothing hapens =(

Please correct my script i think need set chnsawicon.txd id! but i dont know id of ammo huds

I can not run, where mistake.

Link to comment

My TXD run perfect in single player

chnsaw.png

Please help me solve mistake

function Replace ( startedResource ) 
    if ( startedResource == getThisResource() ) then 
        outputChatBox ( "Replace" ) 
        txd = engineLoadTXD ( "data/chnsaw.txd" ) 
        engineImportTXD ( txd, 341 ) 
    end 
end 
  
addEventHandler ( "onClientResourceStart", getRootElement(), Replace ) 

Link to comment
snipet at first post

Well you are making already now some serious mistakes. You call the function chnsaw, while you actually have a function installchnsaw, Then you use undefined variables chnsaw and chnsawicon later too, which are essentially nil values. And last but not least I don't think you can change the texture of anything else but a vehicle. Might be wrong though.

EDIT: I see that the second post doesn't have those mistakes

EDIT: And at your second post now:

Wiki clearly tells two things:

engineImportTXD

This function imports a RenderWare Texture Dictionary into the model identified by the model id. This is necessary in order for the DFF loader to find any new textures. This does however not replace the original textures of the model.

and at EngineReplaceModel it is said that they support changing vehicles only.

So if you want to change the hud, you have to disable it and draw a new one.

EDIT3: And as I can see you already have started a thread about it a bit back, why start to do it the other way now?

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