Modding, Mission Design, and Coding > The Scripting Workshop

Change texture in game

(1/1)

Nightstorm:
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!

zookeeper:
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: ---my_new_tex = gr.loadTexture("filename_without_extension")
my_ship_handle.Textures["current_texture_filename_without_extension"] = my_new_tex
--- End code ---

The E:
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.

Nightstorm:
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?

Nightstorm:

--- Quote from: zookeeper on June 27, 2017, 11:45:45 am ---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: ---my_new_tex = gr.loadTexture("filename_without_extension")
my_ship_handle.Textures["current_texture_filename_without_extension"] = my_new_tex
--- End code ---

--- End quote ---

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.

Navigation

[0] Message Index

Go to full version