Hard Light Productions Forums
Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: killface on August 19, 2008, 07:31:49 pm
-
Here's a scenario I'm trying to design: friendly pilots are on guard duty over a wide area...but enemy ships could jump in from ANY random direction. I want to be able to have ANY of the friendly pilots alert everyone else if they "spot" an enemy craft (distance=2000, within 45 degrees of forward cone). I could make events for each pilot, should they be the one to first spy the incoming enemy...but there has to be an easier way. Is there a SEXP that can be applied to whichever friendly meets the criteria for spotting an enemy, and could I get an example of how?
-
http://www.hard-light.net/forums/index.php/topic,55838.0.html
-
I have my head ~75% wrapped around this. But I have to confess I'm confused on how to use "invalidate-argument".
-
Looks like you use it when you're sure that you're done with an argument, to make sure that it doesn't get used someplace else. I'm not sure if that means it will carry over to the next level of when-argument SEXPs if you don't use invalidate-argument, though.
-
I've got some ideas on how to solve this one but it's actually a lot more difficult to do than it first appears. I'll take a look at it tonight. :)
-
Okay, still not tested it but this is my suggestion.
1) First limit your wing to single waves as it greatly simplifies everything if you do that.
2) Use something like this
When-argument <-------------- Lots of repeats and a repeat delay of 1
-any-of
--Cancer
--Libra
--etc...
- <
--distance <------------------We need this check so that we can invalidate each wing as soon as a wingman detects them
---<any friendly>
---<argument>
--2000
--Modify-Variable <------------------We need to pass the wing who triggered this down to the lower level. Only a variable can do this
---WaveName[Alpha]
---<argument>
--when-argument
---number-of
----1
----Beta 1
----Beta 2
----etc
-- <
---distance
----WaveName[Alpha]
----<argument>
-----2000
---send-message
----<argument>
----High
----Enemy Detected
-invalidate-argument
--<argument> <-----------------This will invalidate the wing name so it's on the top level not part of the inner when-argument