OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: 22jacket on 01 Sep 2005, 01:10:31

Title: counting targets
Post by: 22jacket 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
Title: Re:counting targets
Post by: Tyger 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
Title: Re:counting targets
Post by: THobson 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.