EDIT: I found the secondary-fired-since SEXP... Is there a way to use this with the "every-time" conditional to repeatedly substract "1" if the player fired a missile? I think this might get problematic when you switch to double mode...
Careful, every-time doesn't do what you think it does... (there is topic about it and I am too lazy to search)
So, I experimented with replacing Red-Alert (because you know sliding in perspective changes/cutscenes/what-have-you into a campaign doesn't gel well with how Red-Alert is supposed to work) and did something similar.
Firstly, the check of ships load-out is actually pretty simple if you use string variables with the weapons clear name or a reference tables for a number variable.
The clear name method would look like this:
$Formula: ( when
( is-event-true-delay
"campaign-logic-switch"
0
)
( modify-variable
@Zeta2-s1-ammo[100]
( get-secondary-ammo "Zeta 2" 0 )
)
( modify-variable
@Zeta2-s2-ammo[100]
( get-secondary-ammo "Zeta 2" 1 )
)
( modify-variable
@Zeta2-s3-ammo[100]
( get-secondary-ammo "Zeta 2" 2 )
[...]
)
( when
( has-secondary-weapon
"Zeta 2"
"0"
"Rockeye"
)
( modify-variable
"@Zeta2-s1-name[Tempest]"
"Rockeye"
)
)
( when
( has-secondary-weapon
"Zeta 2"
"1"
"Rockeye"
)
( modify-variable
"@Zeta2-s2-name[Tempest]"
"Rockeye"
)
)
( when
( has-secondary-weapon
"Zeta 2"
"2"
"Rockeye"
)
( modify-variable
"@Zeta2-s3-name[Tempest]"
"Rockeye"
)
)
( when
( has-secondary-weapon
"Zeta 2"
"0"
"Tempest"
)
( modify-variable
"@Zeta2-s1-name[Tempest]"
"Tempest"
)
)
( when
( has-secondary-weapon
"Zeta 2"
"1"
"Tempest"
)
( modify-variable
"@Zeta2-s2-name[Tempest]"
"Tempest"
)
)
( when
( has-secondary-weapon
"Zeta 2"
"2"
"Tempest"
)
( modify-variable
"@Zeta2-s3-name[Tempest]"
"Tempest"
)
)
( when
( has-secondary-weapon
"Zeta 2"
"0"
"Hornet"
)
( modify-variable
"@Zeta2-s1-name[Tempest]"
"Hornet"
)
)
( when
( has-secondary-weapon
"Zeta 2"
"1"
"Hornet"
)
( modify-variable
"@Zeta2-s2-name[Tempest]"
"Hornet"
)
)
( when
( has-secondary-weapon
"Zeta 2"
"2"
"Hornet"
)
( modify-variable
"@Zeta2-s3-name[Tempest]"
"Hornet"
)
)
( when
( has-secondary-weapon
"Zeta 2"
"0"
"Harpoon"
)
( modify-variable
"@Zeta2-s1-name[Tempest]"
"Harpoon"
)
)
( when
( has-secondary-weapon
"Zeta 2"
"1"
"Harpoon"
)
( modify-variable
"@Zeta2-s2-name[Tempest]"
"Harpoon"
)
)
( when
( has-secondary-weapon
"Zeta 2"
"2"
"Harpoon"
)
( modify-variable
"@Zeta2-s1-name[Tempest]"
"Harpoon"
)
)
[...]
Notes:
- Yes that's a that a
when with its operators replaced by additional
whens;
- the "campaign logic switch"-variable is just there to ensure this doesn't trigger outside a campaign-setting, basically treat it like has-time-elapsed "1" for the purpose of this;
- "[...]" means I cut something out of the original Notepad output;
- if a ship that is eligible to be picked as more than 3 secondary banks you may have to expand that to accomidate, this example was made for a mission in which the Loki, Ulysses and Zeus are eligible picks.
In a reference-table version of the same you wouldn't have string variables but a set of numbers which correspond to the weapons, makes it less prone to typos but also requires you to have the reference table on hand at all times.
Secondly, the check at the end of mission is a bit of tricky part because you have to select a point in time when FRED should save the data; It can't safe the stuff after the player has departed (as in moved on to the debriefing) because at that point no longer runs events. That's a sweet spot you have to find.
For the example above the save-point is when the mission critical ship departs, which also triggers a force-warp 10 seconds later; this might cause the missiles fired in the final 10 seconds to not count.
To view:
$Formula: ( when
( has-departed-delay 0 "Vindicator" )
( modify-variable
@Zeta2-s1-ammo[100]
( get-secondary-ammo "Zeta 2" 0 )
)
( modify-variable
@Zeta2-s2-ammo[100]
( get-secondary-ammo "Zeta 2" 1 )
)
( modify-variable
@Zeta2-s3-ammo[100]
( get-secondary-ammo "Zeta 2" 2 )
)
[...]
Note:
- This has a corresponding "recall event" in the next mission;
- "[...]" means I cut something out of the original Notepad output;
- if a ship that is eligible to be picked as more than 3 secondary banks you may have to expand that to accomidate, this example was made for a mission in which the Loki, Ulysses and Zeus are eligible picks.
Does that help?