This is a pretty straight forward problem yet one that leaves me with a bad case of :wtf
Look at this.
import App
import MissionLib
import Lib.LibEngineering
gCurColor = 0
def PrintColorVals(color):
print "R:",color.GetR()
print "G:",color.GetG()
print "B:",color.GetB()
print "A:",color.GetA()
def ToggleColor(pObject, pEvent):
global gCurColor
pShip = MissionLib.GetPlayer()
pShields = pShip.GetShields()
print "Previous color:"
PrintColorVals(pShields.GetProperty().GetShieldGlowColor())
newGlowColor = App.TGColorA()
if gCurColor == 0:
# romulan green shield color
newGlowColor.SetRGBA(0.000000, 0.901961, 0.000000, 0.466667)
gCurColor = 1
else:
# klingon vorcha red shield color
newGlowColor.SetRGBA(0.866667, 0.176471, 0.000000, 0.466667)
gCurColor = 0
pShields.GetProperty().SetShieldGlowColor(newGlowColor)
print "New color:"
PrintColorVals(pShields.GetProperty().GetShieldGlowColor())
pObject.CallNextHandler(pEvent)
def init():
if App.g_kUtopiaModule.IsMultiplayer() and not App.g_kUtopiaModule.IsHost():
return
pMission = MissionLib.GetMission()
Lib.LibEngineering.CreateMenuButton("Swap color", "Tactical", __name__ + ".ToggleColor")
If you were to place the above code in a .py file and that .py into QBautostart directory you would see a button on the Tactical menu that does nothing ... despite it overriding the shield glow color values of your shield generator each time it is clicked; check your ConsoleTracker dump for proof.
Bridge Commander will not update the color of the shields despite the color values of the generator being overridden!
This is a minority case. Many of the properties can be altered at runtime and the game will reflect those changes ... however the shield color does not appear to be one of them.
I have absolutely no doubt this issue has been discovered by someone before me.
Is there a workaround or are shield glow colors absolutely unalterable after the game has loaded them from the HP file?
I have considered removing the shield glow color property from the generator altogether and replacing it with my own but initial tests show that the game crashes if a glow color property is not present.
(The game refuses to create the ship if a shield glow color property is not present)
Thank you.