Author Topic: Altering shield glow color at runtime?  (Read 733 times)

Offline Bat66wat6

  • Posts: 144
  • Cookies: 34
  • Running custom BC 1.1
Altering shield glow color at runtime?
« on: August 01, 2013, 12:32:57 PM »
This is a pretty straight forward problem yet one that leaves me with a bad case of  :wtf

Look at this.
Code: [Select]
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.
Great men are not peacemakers! Great men are conquerors!

Offline hobbs

  • Posts: 1373
  • Cookies: 77
Re: Altering shield glow color at runtime?
« Reply #1 on: August 01, 2013, 02:39:54 PM »
but what if you were to use the MVAM hp swaping ability.

i think if you use mvam it changes the hp file and so you CAN impliment a change dureing a game.
"We are dreamers, shapers, singers and makers..." Michael Ansara, "Elric" Babylon 5 "The Geometry of Shadows,"


Offline Bat66wat6

  • Posts: 144
  • Cookies: 34
  • Running custom BC 1.1
Re: Altering shield glow color at runtime?
« Reply #2 on: August 01, 2013, 03:13:50 PM »
I will download and examine but it is a large mod. There is ALOT of code in that   :(

If you or anyone else has significant experience with how MVAM change HP values it would be greatly appreciated.
 :help:
Great men are not peacemakers! Great men are conquerors!

Offline King Class Scout

  • Posts: 1775
  • Cookies: 893
  • the other half of SFRD
Re: Altering shield glow color at runtime?
« Reply #3 on: August 01, 2013, 03:48:14 PM »
first off, WHY would you wanna swap the sheild colors around?  as an indicator of a strength or type swap for better defense?

second, I bet it would have to be tied to the regular main scripts for the game.  if it's tied to the EXE, however, your screwed.

OS novel fan

Coming Soon: King's Mod Tuning Shop

best line I've ever read
Me: mine [my bridges] would probably be simple to get the characters to use.  the only person that sits is the captian.
Baz: space is vast there[sic] legs will be tired by the time they get to the next planet

Offline Bat66wat6

  • Posts: 144
  • Cookies: 34
  • Running custom BC 1.1
Re: Altering shield glow color at runtime?
« Reply #4 on: August 01, 2013, 04:08:30 PM »
To be blunt. Why is not important. If you must know look up my post history.

If it is tied to the EXE I am indeed screwed.

Still looking through this mod to find any mention of shields colors. In all honesty I think searching MVAM is futile. As far as things look it handles entire subsystems.

The most I have found regarding shield systems in MVAM\scripts\custom\sneaker\mvam
Code: [Select]
#now to check for shields and transfer over the charge
elif (pMvamSub.IsTypeOf(App.CT_SHIELD_SUBSYSTEM)):
#get all the shield classes
pPlayerShields = App.ShieldClass_Cast(pPlayerSub)
pMvamShields = App.ShieldClass_Cast(pMvamSub)

if (pPlayerShields and pMvamShields):
#get all shield facings
kShieldFacings = [App.ShieldProperty.FRONT_SHIELDS, App.ShieldProperty.REAR_SHIELDS, App.ShieldProperty.TOP_SHIELDS, App.ShieldProperty.BOTTOM_SHIELDS, App.ShieldProperty.LEFT_SHIELDS, App.ShieldProperty.RIGHT_SHIELDS]

#now, lets cycle through all the shields and set their charge
for kFacing in kShieldFacings:
fPct = pPlayerShields.GetSingleShieldPercentage(kFacing)
pMvamShields.SetCurShields(kFacing, (pMvamShields.GetMaxShields(kFacing) * fPct))

 :(
Great men are not peacemakers! Great men are conquerors!

Offline Mario

  • Senior Software Developer
  • Administrator
  • Posts: 2186
  • Cookies: 1706
  • Life is life
Re: Altering shield glow color at runtime?
« Reply #5 on: August 01, 2013, 04:22:01 PM »
Quote
Is there a workaround or are shield glow colors absolutely unalterable after the game has loaded them from the HP file?

In short: No.

We've researched on the subject and there is no known workaround. IIRC Game will allow you to change the shield color initially but after a shield takes a hit the changes will never be visually applied.
Acta, non verba.
aka USS Sovereign

Offline Bat66wat6

  • Posts: 144
  • Cookies: 34
  • Running custom BC 1.1
Re: Altering shield glow color at runtime?
« Reply #6 on: August 01, 2013, 04:40:57 PM »
In short: No.

We've researched on the subject and there is no known workaround. IIRC Game will allow you to change the shield color initially but after a shield takes a hit the changes will never be visually applied.
Thank you.

 :(
Great men are not peacemakers! Great men are conquerors!