Home   Help Search Login Register  

Author Topic: counting targets  (Read 696 times)

0 Members and 1 Guest are viewing this topic.

Offline 22jacket

  • Members
  • *
  • I'm a llama!
counting targets
« on: 01 Sep 2005, 01:10:31 »
Hi ho...

is there any way that I can count how many targets have been knocked down after shooting at them ie...30 targets in range 20 knocked down..score shows on screen like 30/20 etc..
cheers
22jacket

Offline Tyger

  • Former Staff
  • ****
  • I was at OFPEC when it still had dirt floors...
    • OFPEC
Re:counting targets
« Reply #1 on: 01 Sep 2005, 02:02:13 »
add an event handler to each target's init

for instance:
Code: [Select]
target1 addEventHandler ["killed",{playerScore = playerScore + 1}]

then, if the variable "playerScore" were over 20 you could end the mission or something. Or even display it.

EDIT: also, you could just use
Code: [Select]
this addEventHandler ["killed",{playerScore = playerScore + 1}] and copy and paste into the inits of all targets
« Last Edit: 01 Sep 2005, 02:04:30 by Tyger »
"People sleep soundly at night only because rough men stand ready to do violence on their behalf." - George Orwell

MSG Mike Everret - We Will Never Forget - '75-'08

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:counting targets
« Reply #2 on: 01 Sep 2005, 09:08:14 »
Just remember to create playerScore first.  Put
playerScore = 0
in the init.sqs file or in a trigger that fires before you start shooting the targets.