Jump to content
Sign in to follow this  
schulz

Endless ammo

Recommended Posts

Hello

does exist a script with that you have endless ammo???

THX

C Ya biggrin_o.gif

Share this post


Link to post
Share on other sites

Just create a script with the following:

ammo.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#ammo

guy1 addmagazine "magazinetype"

~60

goto "ammo"

guy1, magazinetype and 60 can be changed to suit. There is probably a better script out there that detects the type of weapon the unit is carrying, then adds a magazine when it detects the the unit empties a clip. But that should do you good. Thing is, it adds a magazine in every empty item space, so when you throw a grenade, for example, you'll end up with one more magazine than the standard, and another, and so on until all the empty spaces have been used up.

[Gareth Gates must die]

Share this post


Link to post
Share on other sites

well that just gives him a mag every 60 seconds, I was just wondering, if there is a way you could determine how many times the guy has shot, and then give him a new mag.... rock.gif

I know it IS possible just not sure how....it would have to be kind of like...

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> infbullets.sqs

_guy = _this select 0

_magtype = _this select 1

_bulletsinmag = _this select 2

_shell = _this select 3

_shellcount = _shell+1

_guy addeventhandler ["FIRED", {_shellcount}]

#checkloop

? shell==_bulletsinmag : goto "newmag"

~.5

goto "checkloop"

#newmag

_guy addmagazine _magtype

And the script would be called like [name of dude,name of mag(in quotations),how many bullets are in that mag] exec "infbullets.sqs"

I doubt that this script will be right sad_o.gif because I havent scripted in like a year and I have to start at the basics again wink_o.gif

Share this post


Link to post
Share on other sites

So...did my little snippet work or not? I have not tested it and would like to know if i should edit it more or not wink_o.gif

Share this post


Link to post
Share on other sites

I'd do it this way:

fInfiniteAmmo.sqf

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">private ["_this","_ammo"];

_ammo = (_this select 0) ammo (_this select 1);

if (_ammo==1) then

{

(_this select 0) addMagazine (_this select 1);

};

true

init of anything on the map:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">fInfiniteAmmo = loadFile "fInfiniteAmmo.sqf"

init of every unit that should have infinite ammo:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addEventHandler ["fired",{_this call fInfiniteAmmo}]

NOTE: both lines can be present in the same init line (with a semicolon in between), but the first line should be present only once on the map.

This snippet will add a magazine to the player once he's fired his last round of a magazine. That counts for any weapon (also grenades, handguns).

Share this post


Link to post
Share on other sites

Tested,...

It didn't not work always. It worked most of the time for the M16, M60,M21, but not for the nades, G36, M16 grenadelauncher...etc..

It's really hard to trace hte bug when it only works sometimes.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×