Blockland Forums > Modification Help
Support_AmmoReserve - Ammo System
AGlass0fMilk:
--- Quote from: Corbiere on September 02, 2010, 10:00:58 AM ---From my perspective, do whatever you want, since I have little/no idea what you are going on about with all the script.
Just make it give machine guns ammo...Rotondo's fails in that area.
--- End quote ---
His fails on many guns.
I think it's because some guns (For example: Ephi's Shotgun) have a spread script and when firing, they do not use the default "click and just one projectile comes straight out of the barrel."
Space Guy:
If he's planning to use it with my ammo clip mod then that doesn't actually affect anything by default - since you had to code special parts into the weapon image it'll just ignore any weapons except the ones you set max ammo etc. on so you are able to also adjust the firing function to decrement the ammo remaining.
The Titanium:
and if i do that its probably a little less prone to problems, no?
The Titanium:
dear god what am i doing
--- Code: ---package ReserveAmmo
{
//function ItemData::onCollision(%this, %obj, %col, %a, %b, %c, %d, %e, %f)
//{
// if(%obj.weaponReserveLoaded == 1 && (%col.getType() & $TypeMasks::PlayerObjectType))
// {
// echo("ONCOLLISION");
// %col.pickup(%obj);
// }
// else
// Parent::onCollision(%this, %obj, %col, %a, %b, %c, %d, %e, %f);
//}
function Player::pickup(%this,%item)
{
echo("hi");
%p = %item.dropReserve / 100;
%addslot1 = %this.maxReserve[%this.tool[0]] * %p;
%addslot2 = %this.maxReserve[%this.tool[1]] * %p;
%addslot3 = %this.maxReserve[%this.tool[2]] * %p;
%addslot4 = %this.maxReserve[%this.tool[3]] * %p;
%addslot5 = %this.maxReserve[%this.tool[4]] * %p;
%data = %item.dataBlock;
%ammo = %item.weaponReserveLoaded;
%val = Parent::pickup(%this,%item);
//if(%data.dropReserve > 0 && isObject(%this.client) && %item.weaponReserveLoaded == 1)// && %val == 1)
if(%item.weaponReserveLoaded == 1)
{
if(%this.tool[0].getID() !$= "" && %this.toolReserve[%this.tool[0]] !$= "")
%this.toolReserve[0] += %addslot1;
if(%this.tool[1].getID() !$= "" && %this.toolReserve[%this.tool[1]] !$= "")
%this.toolReserve[1] += %addslot2;
if(%this.tool[2].getID() !$= "" && %this.toolReserve[%this.tool[2]] !$= "")
%this.toolReserve[2] += %addslot3;
if(%this.tool[3].getID() !$= "" && %this.toolReserve[%this.tool[3]] !$= "")
%this.toolReserve[3] += %addslot4;
if(%this.tool[4].getID() !$= "" && %this.toolReserve[%this.tool[4]] !$= "")
%this.toolReserve[4] += %addslot5;
echo("err");
}
return %val;
}
function ItemData::onAdd(%this,%obj)
{
if($weaponReserveLoaded !$= "")
{
%obj.weaponReserveLoaded = $weaponReserveLoaded;
$weaponReserveLoaded = "";
echo("lol");
}
Parent::onAdd(%this,%obj);
}
function WeaponImage::onMount(%this, %obj, %slot)
{
if(%obj.currTool == -1 || %obj.toolReserve[%obj.currTool] $= "")
{
%obj.maxReserve[%obj.currTool] = %this.item.maxReserve;
%obj.dropReserve[%obj.currTool] = %this.item.dropReserve;
%obj.toolReserve[%obj.currTool] = %this.item.spawnReserve;
echo("onmount");
}
Parent::onMount(%this, %obj, %slot);
}
function servercmdDropTool(%client,%slot)
{
if(!isObject(%client.player))
return Parent::servercmdDropTool(%client,%slot);
//if(!isObject(%client.player.tool[%slot]) || %client.player.tool[%slot].maxReserve <= 0)
// return Parent::servercmdDropTool(%client,%slot);
//$weaponAmmoLoaded = %client.player.dropReserve[%client.player.currTool];
//if(%client.player.tool[%slot].dropReserve >= 0)
//if(%client.player.maxReserve[%client.player.currTool] == 800)
$WeaponReserveLoaded = 1;
%client.player.maxReserve[%client.player.currTool] = "";
%client.player.dropReserve[%client.player.currTool] = "";
%client.player.toolReserve[%client.player.currTool] = "";
return Parent::servercmdDropTool(%client,%slot);
}
};activatePackage(ReserveAmmo);
--- End code ---
sdfdsadfd player::pickup cant recognize that the item has WeaponReserveLoaded at 1 :c
HEAVY: HELP NAO :C
Space Guy:
Once you pick up a dropped item it's deleted. That is why the "%ammo = %item.weaponReserveLoaded;" part is there.