Hard Light Productions Forums
Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: MetalDestroyer on August 18, 2011, 07:15:33 am
-
Well,
I got the SEXP working on AI. However, for unknown reason, the mission crash after several minutes.
I use "Every-time" sexp to engage cloak and decloak. I'm suspecting the "every time" sexp conditional to be the cause of this behavior. If so, how to add some sort of permanent cloak as long as the AI ship doesn't open fire ?
Here, the mission file. Don't forget to open the file with notepad to replace ship by Freespace 2 one.
[attachment deleted by ninja]
-
I haven't looked at the mission yet, but try this.
When-Argument (trigger count 999999999999999999999999999999999999999999999999 and interval 0)
- any-of
- or
- has-primary-fired
- has-primary-fired
- decloak sexp
When-Argument (trigger count 999999999999999999999999999999999999999999999999 and interval 0)
No idea if this will work as I just wrote it real quick here.. but worth a shot?
-
The AI doesn't cloak at all. Perhaps, I mess somewhere since I really don't know how to use the value of "any-of" sexp operator
$Formula: ( when-argument
( any-of "Alpha 2" "Alpha 3" )
( not
( primary-fired-since
"<argument>"
0
6000
)
)
( ship-effect
"Cloak"
2800
"<argument>"
)
( ship-stealthy "<argument>" )
)
+Name: AI Cloak
+Repeat Count: 1
+Trigger Count: 999999
+Interval: 0
$Formula: ( when-argument
( any-of "Alpha 2" "Alpha 3" )
( primary-fired-since
"<argument>"
0
50
)
( ship-effect
"Decloak"
2800
"<argument>"
)
( ship-unstealthy "<argument>" )
)
+Name: AI Decloak
+Repeat Count: 1
+Trigger Count: 999999
+Interval: 0
-
If you don't have an answer by the time I get home tonight (like 12 hours from now).. I'll actually open up FRED and see what I can figure out.
-
Ok, thanks.
-
Ok, I found out why the mission crash with "every-time" sexp conditional. I forgot to add a condition if the ship is alive. When, the AI is destroyed, the game crashed when trying to execute the cloak script.
Now, the script works perfectly.
However, since you made me discover the when-argument/everytime-argument. It will be really cool if I can use this sexp conditional instead of everytime. I tried but no success. The AI won't cloak.
$Formula: ( every-time
( and
( not
( is-destroyed-delay 0 "Alpha 2" )
)
( not
( primary-fired-since
"Alpha 2"
0
6000
)
)
( = @Alpha2CloakStatus[0] 0 )
)
( ship-effect "Cloak" 2800 "Alpha 2" )
( ship-stealthy "Alpha 2" )
( modify-variable
@Alpha2CloakStatus[0]
1
)
)
+Name: AI Cloak v2
+Repeat Count: 1
+Interval: 1
$Formula: ( every-time
( and
( not
( is-destroyed-delay 0 "Alpha 2" )
)
( primary-fired-since "Alpha 2" 0 50 )
( = @Alpha2CloakStatus[0] 1 )
)
( ship-effect
"Decloak"
2800
"Alpha 2"
)
( ship-unstealthy "Alpha 2" )
( modify-variable
@Alpha2CloakStatus[0]
0
)
)
+Name: AI Decloak v2
+Repeat Count: 1
+Interval: 1
-
Basic bug fixing steps, try adding a message to that event to see if it's triggering and the problem actually lies with the cloaking. At least that way you know whether the problem is your event or the SEXP itself. :)