3
« on: August 01, 2013, 05:16:43 AM »
I tried to make the Glowstick (Made by Extrude) only usable once, so i added the following line of code:
package glowstickPackage
{
function Armor::onCollision(%this, %obj, %col, %a, %b, %c, %d, %e, %f)
{
if(%col.dataBlock $= "SmokeGrenadeItem" && %col.canPickup)
{
for(%i=0;%i<%this.maxTools;%i++)
{
%item = %obj.tool[%i];
if(%item $= 0 || %item $= "")
{
%freeSlot = 1;
break;
}
}
if(%freeSlot)
{
%obj.pickup(%col);
return;
}
}
Parent::onCollision(%this, %obj, %col, %a, %b, %c, %d, %e, %f);
}
};
activatePackage(glowstickPackage);
function glowstickImage::onCharge(%this, %obj, %slot)
{
%obj.playthread(2, spearReady);
%obj.lastHESlot = %obj.currTool;
}
function glowstickImage::onAbortCharge(%this, %obj, %slot)
{
%obj.playthread(2, root);
}
function glowstickProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
serverPlay3D(glowstickBounceSound,%obj.getTransform());
}
function glowstickImage::onFire(%this, %obj, %slot)
{
%obj.playthread(2, spearThrow);
Parent::OnFire(%this, %obj, %slot);
%currSlot = %obj.lastHESlot;
%obj.tool[%currSlot] = 0;
%obj.weaponCount--;
messageClient(%obj.client,'MsgItemPickup','',%currSlot,0);
serverCmdUnUseTool(%obj.client);
}
function glowstickImage::onDone(%this,%obj,%slot)
{
%obj.unMountImage(%slot);
But it failed, it made it worse.
The glowstick didnīt appear in the item list.
What should i do to fix it?