Home   Help Search Login Register  

Author Topic: counting  (Read 1350 times)

0 Members and 2 Guests are viewing this topic.

Offline 22jacket

  • Members
  • *
  • I'm a llama!
counting
« 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

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: counting
« Reply #1 on: 16 Jun 2006, 09:42:35 »
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 -

Code: [Select]
_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.

Offline 22jacket

  • Members
  • *
  • I'm a llama!
Re: counting
« Reply #2 on: 16 Jun 2006, 13:17:18 »
hello again..

do I create a trigger over the targets and then type in on activation...
this exec "count_targs.sqs"

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: counting
« Reply #3 on: 16 Jun 2006, 13:44:07 »
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

Code: [Select]
[] exec "count_targs.sqs"
if you have named the targets sequentially as i described, it should work.

Offline 22jacket

  • Members
  • *
  • I'm a llama!
Re: counting
« Reply #4 on: 16 Jun 2006, 16:25:30 »
works a treat...many thanks for your help....