Author Topic: Change texture in game  (Read 3947 times)

0 Members and 1 Guest are viewing this topic.

Change texture in game
Question...I want to have multiple skins for a Viper based on different Battlestars.  So let's say the default skin for a Viper MK7E is the Theseus.  And let's say the default player ship for a mission is a standard Mk7.  The mission is flying off of the Perseus.  I want to be able and switch the MK7E's skin to a Perseus name plate instead of the standard one if the player chooses to fly a 7E.

 Is there a way to accomplish that?  Can this be scripted fairly easily?

Thanks!

 

Offline zookeeper

  • *knock knock* Who's there? Poe. Poe who?
  • 210
Re: Change texture in game
Yes, it should be pretty simple to script. Once you have the rest of the scripting hook logic figured out and you have a ship handle to peruse, the basic texture replacement process is very straightforward:

Code: [Select]
my_new_tex = gr.loadTexture("filename_without_extension")
my_ship_handle.Textures["current_texture_filename_without_extension"] = my_new_tex

 

Offline The E

  • He's Ebeneezer Goode
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Re: Change texture in game
However, doing this through table-based texture replacement and the usual way of creating a "Viper Mk7#Perseus" ships.tbl entry also works and may be easier to use.
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 
Re: Change texture in game
If I understood correctly, I can make a copy of the existing ship in the table or a tbm and just change the name to #shipname?  Would I then still have to use "change-ship-class"?  Or is it controlled by some other means by having for example MKVII#Perseus vs MKVII#Theseus?

 
Re: Change texture in game
Yes, it should be pretty simple to script. Once you have the rest of the scripting hook logic figured out and you have a ship handle to peruse, the basic texture replacement process is very straightforward:

Code: [Select]
my_new_tex = gr.loadTexture("filename_without_extension")
my_ship_handle.Textures["current_texture_filename_without_extension"] = my_new_tex

Presuming the player ship will always be "Red 1" what I'm looking for it to do is check if the ship class is "x" and if it is change the textures to "x".  Where x is not the default texture for the ship.