No, you can't replace the Shield Generators. One will have to stay primary all the time.
Thats why I worked around that: You fill the Real Shield Generators will the Values from the fake active Generator.
I completely understand.
After reading my last reply I see how you could think I am trying to change the Primary() value when I am not. I know that is impossible.
Instead I want to swap the real shield generators values over with the Primary (targetable) and Secondary (targetable) shield generators as they each become disabled/operational.
I want the values of the Primary (targetable) and Secondary (targetable) to remain
seperate.
In pseudocode this would be:
IF primary (targetable) generator is disabled:
IF secondary(targetable) generator is operational:
# primary (targetable) is offline, secondary shield generator takes over
real primary generator shield strength = secondary (targetable) shield generator strength
real primary generator shield reload(charge) = secondary (targetable) shield generator shield reload(charge)
ELSE:
# both generators are disabled, there are no shields
real primary generator shield strength = 0
real primary generator shield reload = 0
# VICE-VERSA, secondary offline & primary becomes active
IF secondary (targetable) generator is disabled:
IF primary(targetable) generator is operational:
# secondary (targetable) is offline, primary is operational and ready to work
real primary generator shield strength = primary (targetable) shield generator strength
real primary generator shield reload(charge) = primary (targetable) shield generator shield reload(charge)
ELSE:
# both generators are disabled, there are no shields
real primary generator shield strength = 0
real primary generator shield reload = 0
You get the idea.
I want to keep the two shield generators
completely seperate from each other. Instead of piling all the shields of both targetable shield generators together I want to assign the values of each targetable generator to the real shield generator.
Say targetable primary generator ("Primary Shield Generator") has the following values:
Front:
Aft:44000
Left: 22000
Right:22000
Dorsal:44000
Ventral:44000
Reload: 48
And targetable secondary generator ("Secondary Shield Generator") has the following values:
Front:
Aft:22000
Left: 11000
Right:11000
Dorsal:22000
Ventral:22000
Reload: 24
At any given time the values assigned to the real hidden indestructible generator are either those of "Primary Shield Generator" OR "Secondary Shield Generator" OR 0 all round (nothing, no shields).
NEVER are any values of the two separate targetable generators added together.And of course I want the ingame shield values to be remembered for when a shield generator becomes operational again.
By this I mean that if for example: You are in battle and someone punches through your top shield (which becomes red), they then disable the targetable "Primary Shield Generator" (which is the active shield generator at the time). The "Secondary Shield Generator" then becomes the active generator.
When the disabled, but not destroyed targetable "Primary Shield Generator" becomes operational again I want the previous shield values of that shield to be restored. This means that whatever damage the shields on the "Primary Shield Generator" incurred when it was active before it was disabled, will be restored.
The generators original HP file (\scripts\ships\hardpoint) values should NOT be restored. The "Primary Shield Generator" should NOT come back online at full strength (all shields green).
Of course, this entire implementation method depends on being able to find out which one of the non-real (non-primary
not IsPrimary() ) are the "Primary Shield Generator" and the "Secondary Shield Generator".
IF
primary (targetable) generator is disabled:
xxxxxxxxxxxxxxxxxxxx
IF
secondary (targetable) generator is disabled:
xxxxxxxxxxxxxxxxxxxx