Home   Help Search Login Register  

Author Topic: Scoring: Units being killed  (Read 837 times)

0 Members and 1 Guest are viewing this topic.

CooK

  • Guest
Scoring: Units being killed
« on: 28 Oct 2002, 09:54:54 »
Hello, making a sniper target range

Im have ai as targets (civilian)
how would i make a script where it tells how many targets is killed out of 10?
-names: all w/o " and " of course
Killer: "g1"

-targets:
1st : "st1"
2nd: "st2"
3rd:  "st3"
4th: "st4"
5th: "st5"
6th: "st1_1"
7th: "st2_1"
8th: "st3_1"
9th: "st4_1"
10th: "st5_1"
 
there will be two courses with diff ai so i need the score to reset after 1 course is done ( course is scripted so it can end within the script )
thx. a bunch.

-=+CooK+=-

« Last Edit: 28 Oct 2002, 10:40:37 by [CPS]_CooK »

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:Scoring: Units being killed
« Reply #1 on: 29 Oct 2002, 22:02:07 »
There are two easy ways I can think of to solve your problem.

1. If the targets are all in the same group, name the group, then count how many units are dead in the group.

To name the group, put the following code in the init field of one of the group members:

targets = group this

Where targets is whatever name you choose to give your group.

To count the number of dead targets, use the following code:

DeadTargets = "not (alive _x)" count units targets

Where DeadTargets is an integer variable that will store the number of dead targets, and targets is once again the name you gave to your group of targets.

2. If your targets are not all in the same group, make an array that stores the names of all of the targets.

targets = [st1,st2,st3,...,st5_1]

Obviously, I didn't type out all of the names, but you get the idea.  Next, you use code very similar to what I used above to count the number of dead targets.

DeadTargets = "not (alive _x)" count targets

Notice that this time, I didn't use the units command.  That's because the units command takes a group's name and returns an array of all of the units in the group.  As you can see for this second method, we already have an array of the units, so the the units command is not necessary.
Ranger