Author Topic: Ammo Replenishing Script  (Read 592 times)

I need a script that will, over time, increment the amount of ammo in the weapon it is installed in. about 1 unit per... lets say 0.5 seconds or so at a constant rate, and stop at 20 units (still increasing if it decreases thereafter). im sorry for asking for an all-out script section, but i have zero time to work on it as im grounded from my computer (im on a school one)

all help is appreciated :)

It'd be fairly simple-to-do, let me write something up really quickly.

something like this
Code: [Select]
function Player::ammoIncLoop(%this, %slot, %amt)
{
cancel(%this.ammoIncLoop);
if(%this.ammoCt[%slot] < 20)
%this.ammoCt[%slot]++;
%this.ammoIncLoop = %this.schedule(500, ammoIncLoop, %slot, %amt);
}
« Last Edit: November 08, 2011, 06:25:11 PM by otto-san »


It'd be fairly simple-to-do, let me write something up really quickly.

something like this
Code: [Select]
function Player::ammoIncLoop(%this, %slot, %amt)
{
cancel(%this.ammoIncLoop);
if(%this.ammoCt[%slot] < 20)
%this.ammoCt[%slot]++;
%this.ammoIncLoop = %this.schedule(500, ammoIncLoop, %slot, %amt);
}

a thousand thanks to you :D

Just keep in mind it has to be called with all the arguments to work.


Also cancel the loop if the player drops the weapon.