Home   Help Search Login Register  

Author Topic: Unitcounter  (Read 1578 times)

0 Members and 1 Guest are viewing this topic.

Gravitybeetle

  • Guest
Unitcounter
« 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.
« Last Edit: 27 Apr 2003, 10:41:16 by Nicd »

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Unitcounter
« Reply #1 on: 27 Apr 2003, 15:02:44 »
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
« Last Edit: 27 Apr 2003, 15:06:29 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Gravitybeetle

  • Guest
Re:Unitcounter
« Reply #2 on: 27 Apr 2003, 19:28:44 »
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)

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Unitcounter
« Reply #3 on: 27 Apr 2003, 19:40:50 »
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
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Gravitybeetle

  • Guest
Re:Unitcounter
« Reply #4 on: 27 Apr 2003, 19:45:35 »
Can I make a trigger start from a script?

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Unitcounter
« Reply #5 on: 28 Apr 2003, 02:02:13 »
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)
« Last Edit: 28 Apr 2003, 02:02:53 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Gravitybeetle

  • Guest
Re:Unitcounter
« Reply #6 on: 28 Apr 2003, 12:53:41 »
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?