I'm working on a cloaking system in FS engine and archived success with making a fighter invisible ,but I have a problem.
Every time I cloak and decloak ,my secondary (and primary ,though they are not a problem now ,because I changed all weapons on a cloaking fighter to energy dependant) banks reset.
This wouldn't be a problem with cloaking on autopiloting or other specific moments in mission ,because I would simply load secondary bank ammo into variable and restore them after decloak ,linking it to specific event ,but with "combat cloaking" I'm working on ,this doesn't seem to work.
This is a pair of events which control cloaking and decloaking ,I would like to know what I'm doing wrong.
$Formula: ( every-time
( and
( key-pressed "1" )
( is-ship-class
"Assasin"
"Alpha 1"
)
)
( change-ship-class
"Assasin#Cloaked"
"Alpha 1"
)
( ship-stealthy "Alpha 1" )
( lock-primary-weapon "Alpha 1" )
( lock-secondary-weapon "Alpha 1" )
( lock-afterburner "Alpha 1" )
( key-reset "2" )
( turret-lock-all "Alpha 1" )
( protect-ship "Alpha 1" )
( modify-variable
@SAmmo1[0]
( get-secondary-ammo "Alpha 1" 0 )
)
( modify-variable
@SAmmo2[0]
( get-secondary-ammo "Alpha 1" 1 )
)
( modify-variable
@SAmmo3[0]
( get-secondary-ammo "Alpha 1" 2 )
)
( modify-variable
@SAmmo4[0]
( get-secondary-ammo "Alpha 1" 3 )
)
)
+Name: Cloak
+Repeat Count: 1
+Interval: 1
+Team: 0
$Formula: ( every-time
( and
( key-pressed "2" )
( is-ship-class
"Assasin#Cloaked"
"Alpha 1"
)
)
( change-ship-class
"Assasin"
"Alpha 1"
)
( ship-unstealthy "Alpha 1" )
( unlock-primary-weapon "Alpha 1" )
( unlock-secondary-weapon "Alpha 1" )
( unlock-afterburner "Alpha 1" )
( key-reset "1" )
( turret-free-all "Alpha 1" )
( unprotect-ship "Alpha 1" )
( set-secondary-ammo
"Alpha 1"
0
@SAmmo1[0]
)
( set-secondary-ammo
"Alpha 1"
1
@SAmmo2[0]
)
( set-secondary-ammo
"Alpha 1"
2
@SAmmo3[0]
)
( set-secondary-ammo
"Alpha 1"
3
@SAmmo4[0]
)
)
+Name: Decloak
+Repeat Count: 1
+Interval: 1
+Team: 0
Player is able to cloak anytime in the mission ,is ignored by all enemy ships and his weapons ,afterburners and turret are locked.
The only issue are those ammunition resets (and maybe lack of cloaking animation ,but it's not a serious problem).