Blockland Forums > Modification Help

ReplaceItem ?

Pages: << < (2/3) > >>

Deathwishez:

KICK ASS!!!

It worked! Thanks.

My script shall be finished shortly thanks to you.

Deathwishez:

New problem.

I need to replace the item, but this time, onPickUp.

Snippet:


--- Code: ---function Player::pickup(%this, %item)
{
     %client = %this.client;
     %player = %client.player;

     for(%i=0;%i<%player.getDatablock().maxtools;%i++)
     {
          %tool = %player.tool[%i].getID();
          if(%tool == GunItem.getID())
          {
               %newGun = nameToID("AkimboGunItem");
               %player.tool[%i] = %newGun;
               messageClient(%client,'MsgItemPickup','',%i, %newGun);
               break;
          }
     }
     Parent::pickup(%this, %item);
}

--- End code ---

I'm picking up the weapon normally, and not the Akimbos instead.

Deathwishez:

Bump. Need help.

rkynick:

Try putting Parent::pickup(%this,%Item); before the for() loop.

Deathwishez:

A thousand thanks again.

It worked.

Pages: << < (2/3) > >>

Go to full version