Home   Help Search Login Register  

Author Topic: when only 2 mags left  (Read 735 times)

0 Members and 1 Guest are viewing this topic.

Offline 456820

  • Contributing Member
  • **
when only 2 mags left
« on: 30 Dec 2005, 22:36:08 »
for some reason i cant remember this ive searched the forum quickly but found nothing and it just has seem to of gone from my mind

But anyway how can i check when my sniper has only 2 Magazines of his M21 left it doesnt matter about his sidearm just his primary weapon ?

Thanks

Offline Pilot

  • Contributing Member
  • **
Re:when only 2 mags left
« Reply #1 on: 30 Dec 2005, 22:51:04 »
Try this script:
Code: [Select]
_i = count magazines player
_j = 0
_n = 0


#Loop
?_j==_i : goto "check"
?(magazines player select _j) == "M21": _n=_n+1
_j=_j+1
~.01
goto "Loop"

#Check
?_n <= 2: goto "hint"
_j=0
_n=0
_i = count magazines player
~.01
goto "Loop"

#Hint
hint format ["You have %1 magazines left", _n]
exit

-Pilot

Offline 456820

  • Contributing Member
  • **
Re:when only 2 mags left
« Reply #2 on: 30 Dec 2005, 23:03:24 »
ahh that could be why i couldnt remember it i didnt know it needed a script oh well

Thanks anyway ill have to try that out tomorow ill report back ASAP

And another thing this doesnt check for ammo as in the number of rouns just the mag
Say i had 2 mags but one mag had 10 rounds in would it still trigger as 2 mags
Just checking

Cheers

Offline Pilot

  • Contributing Member
  • **
Re:when only 2 mags left
« Reply #3 on: 30 Dec 2005, 23:08:08 »
Quote
And another thing this doesnt check for ammo as in the number of rouns just the mag
Say i had 2 mags but one mag had 10 rounds in would it still trigger as 2 mags
Just checking
No, the script doesn't check to see how many shots are left in each mag.  It is possible for the player to have two mags with only one bullet in each.  I have no idea how to check for individual bullets...and something tells me it can't be effectively done.

-Pilot

Offline 456820

  • Contributing Member
  • **
Re:when only 2 mags left
« Reply #4 on: 31 Dec 2005, 10:21:31 »
works perfectly thanks Pilot

Topic solved