OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: 22jacket on 16 Jun 2006, 02:27:50
-
Hi
I have a 30 target range...and need to know how i can count how many targets have been hit and how to display the score..ie 28/30 etc..once the person has finished shooting..
cheers
-
when a target has been hit to the ground, it's not 'alive'.
name the targets sequentially, i.e. targ1, targ2, targ3 to targ30.
create this script, count_targs.sqs -
_targ = 1
_targtot = 0
#loop
_whichtarg = call format ["targ%1",_targ]
?not (alive _whichtarg):_targtot = _targtot + 1
_targ = _targ + 1
?not (_targ>30):goto "loop"
hint format ["Your score is\n%1 out of 30",_targtot]
exit
run the script when you want a total. untested, but it should work.
-
hello again..
do I create a trigger over the targets and then type in on activation...
this exec "count_targs.sqs"
-
the only trigger required is the trigger which tells you the player is finished. how you tell when the player is finished is up to you. when s/he is out of ammo? when a period of time has run out?
either way, call the script using
[] exec "count_targs.sqs"
if you have named the targets sequentially as i described, it should work.
-
works a treat...many thanks for your help....