Today I tested the following SEXP.
$Formula: ( if-then-else
( and
( or
( and
( has-primary-weapon
"Alpha 1"
"0"
"Repair System"
)
( is-primary-selected "Alpha 1" 0 )
)
( and
( has-primary-weapon
"Alpha 1"
"1"
"Repair System"
)
( is-primary-selected "Alpha 1" 1 )
)
( and
( has-primary-weapon
"Alpha 1"
"2"
"Repair System"
)
( is-primary-selected "Alpha 1" 2 )
)
)
( < ( hits-left "Alpha 1" )100 )
)
( when-argument
( any-of
"Alpha 1"
"Alpha 2"
"Alpha 3"
"Beta 1"
"Beta 2"
"Beta 3"
)
( and
( or
( and
( has-primary-weapon
"<argument>"
"0"
"Repair System"
)
( is-primary-selected "<argument>" 0 )
)
( and
( has-primary-weapon
"<argument>"
"1"
"Repair System"
)
( is-primary-selected "<argument>" 1 )
)
( and
( has-primary-weapon
"<argument>"
"2"
"Repair System"
)
( is-primary-selected "<argument>" 2 )
)
)
( < ( hits-left "<argument>" )100 )
)
( repair-subsystem
"<argument>"
"Hull"
1
)
( set-weapon-energy
( -
( weapon-energy-pct "<argument>" )
3
)
"<argument>"
)
( send-message
"#Command"
"High"
"repair on"
)
)
( send-message
"#Command"
"High"
"repair off"
)
)
+Name: EQUIP: Repair System - TESTING
+Repeat Count: -1
+Trigger Count: 1410065407
+Interval: 1
As you can see, this is simply the previous SEXP #1 slotted into an if-then-else. If the SEXP evaluates true, it will send a message saying 'repair on.' If the 'else' branch triggers, it will say 'repair off'.
For most of the mission - sometimes the entire mission - it behaves this way quite happily.
Often, however, something baffling occurs. When the Repair System bank is not selected, it continues to print 'repair off.'
When the Repair System is selected, however, nothing happens.
This is impossible, of course - the event must either be 'if' or 'else'. Yet somehow the event is recognizing that its conditions are fulfilled but not doing anything about it.
I don't know what to make of this, except to think it's likely a problem with when-argument, not trigger count.