Blockland Forums > Modification Help
Ammo Replenishing Script
Pages: (1/1)
Midway Sentinel:
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 :)
otto-san:
It'd be fairly simple-to-do, let me write something up really quickly.
something like this
--- Code: ---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);
}
--- End code ---
Midway Sentinel:
thanks man
Midway Sentinel:
--- Quote from: otto-san on November 08, 2011, 06:22:23 PM ---It'd be fairly simple-to-do, let me write something up really quickly.
something like this
--- Code: ---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);
}
--- End code ---
--- End quote ---
a thousand thanks to you :D
otto-san:
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.
Pages: (1/1)