Blockland Forums > Modification Help
ReplaceItem ?
(1/3) > >>
Deathwishez:
I need to replace an item on a function.

I can get the item to go away, but not make the new one.

Snippet that handles this part:


--- Code: ---for(%i=0;%i<%player.getDatablock().maxTools;%i++)
{
     %tool = %player.tool[%i].getID();
     if(%tool == GunItem.getID())
     {
          %player.tool[%i] = AkimboGunImage;
          messageClient(%killer,'MsgItemPickup','',%i, AkimboGunImage);
          if(%player.currTool == %i)
          {
               %player.updateArm(0);
               %player.unMountImage(0);
          }
               break;
     }
}

--- End code ---

Try to do Gun to Akimbo Gun.
rkynick:
I think it has to be nametoid("AkimboGunImage") but let me check.
Yep.
Deathwishez:
In all instances?
Deathwishez:
I tried this:


--- Code: ---for(%i=0;%i<%player.getDatablock().maxTools;%i++)
{
     %tool = %player.tool[%i].getID();
     if(%tool == GunItem.getID())
     {
          %newGun = nameToID("AkimboGunImage");
          %player.tool[%i] = %newGun;
          messageClient(%killer,'MsgItemPickup','',%i, %newGun);
          if(%player.currTool == %i)
          {
               %player.updateArm(0);
               %player.unMountImage(0);
          }
               break;
     }
}

--- End code ---

It didn't work. However, I think I'm one step closer, as instead of not getting any items back, I got a black "?" item, with a printer model instead of the gun.
rkynick:
Should be item instead of image.
Navigation
Message Index
Next page

Go to full version