Home   Help Search Login Register  

Author Topic: Ammo Script to increase load  (Read 465 times)

0 Members and 1 Guest are viewing this topic.

Mattyboy2003

  • Guest
Ammo Script to increase load
« on: 08 Jun 2003, 15:27:16 »
Hey, I wonder if anyone could help me, I'm currently running OFP 1.46.  And am having trouble sorting my script out.

Basically, i'm trying to increase a soldiers fighting load from say just three mags to eight.  I'm using the script below at the moment:

_Gunner = _this select 0
_XMags=5


#Start
?_Gunner ammo "HK" ==2 : goto "reduce"
?!alive _Gunner : exit
goto "Start"

#reduce
_XMags=_XMags-1
~0.5
?_XMags==1: goto "moreammo"; Hint "Mag from Bag"

#moreammo
_Gunner addmagazine "HK"
goto "Start"

As you can hopefully see, the plan was for the _XMags amount to reduce each time until the script exits, at the moment all it does is either constantly re-arm the player (not realistic) or not work at all.

Any help or guidance would be appreicated.

Thanks

Matt  ???

P.S attached .SQS file that i've been working on.


deaddog

  • Guest
Re:Ammo Script to increase load
« Reply #1 on: 08 Jun 2003, 16:19:42 »
Quote
?_XMags==1: goto "moreammo"; Hint "Mag from Bag"

#moreammo

Look at this section of code.  What happens when _XMags is not equal to 1?  It goes to #moreammo anyway.  You need to add a goto statement between these two lines.

Quote
?_Gunner ammo "HK" ==2 : goto "reduce"
You might want to consider changing that to <=2.  If you are on full auto mode, the amount of ammo might decrement too fast.  In other words, it might not be equal to 2 long enough for your code to catch it.

Hope that helps.  :)
« Last Edit: 08 Jun 2003, 16:22:52 by deaddog »