Author Topic: Make item that can't be picked up  (Read 924 times)

I need to make an item so that it cannot be picked up by players. The item datablock name is PizzaItem, so use that if you make a short example code!

Any ideas?

Code: [Select]
function pizzaItem::onPickUp(%this,%item,%pl,%a)
{
//Put your other code here
return;
}
make sure it's packaged

No. Just set canPickup to false in the item's datablock.

No. Just set canPickup to false in the item's datablock.
canpickup = 0; in the item datablock doesn't seem to work, but Swollow's method did

Code: [Select]
function pizzaItem::onPickUp(%this,%item,%pl,%a)
{
//Put your other code here
return;
}
make sure it's packaged
You don't need to package if you're writing your own onPickUp code. In-fact, you don't even need the return either.

You don't need to package if you're writing your own onPickUp code. In-fact, you don't even need the return either.
Yeah, you only need to package weapon based functions if they are already declared from another script.

Such as you need to package HammerImage::onHitObject

PizzaItem.canPickup = false;

PizzaItem.canPickup = false;
so it can't be declared on creation?

okay so thanks for the information on the packaging and declaring I just didn't have a copy of blockland to test on so I thought I would just give the most safe run down on how to do something in a way I knew would function as planned

however I think its better to use the onPickup function since you can dynamically change if it can be picked up under certain cases as opposed to making it statically unable to be picked up


Revised code
Code: [Select]
function pizzaItem::onPickUp(%this,%item,%pl,%a)
{
//Put your other code here and conditions here
}
no need to be packaged

so it can't be declared on creation?

new item()
{
     ...
     canPickup = false;
     ...
};