OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Gravitybeetle on 27 Apr 2003, 10:40:13
-
I have a mission on the island on the top middle of Nogova.
Lots of boats attack the island, and the resistance can't hold them.
How can I make the resistance guys run away to their own boats
and retreat when there's only about 20 of them left? ???
I need some type of counter, that counts how many units are left
on the specified side.
-
give each resistance unit a name, eg R1, R2, R3
In the init.sqs Create an array for that group, lets call it "resistance_array"
eg resistance_array = [R1, R2, R3, R4, R5]
making sure its a global variable (Eg transferrable from 1 script to another)
then create either a trigger or a looping script
have the array counted using ?alive count resistance_array (on the server machine)
eg
and then if count <20 or whatever number you want to impose
Have them do whatever co-op'y thing you want them to do
I aint into co-ops but this should give you a general idea
You could also create a new array using the ai that is alive and then have that array flee
-
So, did I get this right?
Init.sqs:
resistance_array[R1,R2,R3...etc.]
Game:
Each unit has a name, like R1.
Trigger: Looper and counter
Activation: None
Countdown: Min:1 Mid:1 Max:1
Condition: countres
On Activation: ?alive count resistance_array; countres = false
Trigger 2: Looper
Act.: None
Cond.: not(countres)
On A.: countres = true
Trig. 3: Loop starter
Act.: Res. present
On A.: countres = true
But where do I put the "if count <20"?
Can I make a 4th trig., with that on the cond.? (sorry I'm dumb)
-
i personally prefer scripts so it would be something like
and i would use the init sqs or a trigger to exec the script
#start
~1
(?alive count resistance_array ) < 20:goto runaway
goto "start"
#runaway
add here whatever you want them to do
exit
You will have to excuse me if the syntax is incorrect, it often is, wrong brackets, speech marks etc
-
Can I make a trigger start from a script?
-
if you declared the trigger false or null say in the init.sqs then i see no reason why you cant reactivate it in a script by declaring it true again
You could simply write the commands that would have been in the trigger into a script (With a slight difference in syntax and do away with the trigger)
-
I ment more like this:
whatever.sqs
script....
script....
script....
something like retreatres = true
The in the trig. I set cond. into retreatres. Does that work?