Spookmaster
Terrarian
Hi, folks! I'm new to Terraria modding, so I figured I'd start with something fun and small, instead of making a giant project. So, for my first project, I wanted to make a unique accessory that does the following:
I managed to get the stat bonuses and recipe working perfectly, but I'd like some help with the rest of it. In specific, I want to get the money things working before I worry about the snail itself; are there any hooks that detect when a player picks up an item, and, similarly, are there any that detect when a player drops an item? I'd also like to know if there's a way to despawn an item.
Here's a sort of pseudo-code example of what I'm looking for:
I managed to get the stat bonuses and recipe working perfectly, but I'd like some help with the rest of it. In specific, I want to get the money things working before I worry about the snail itself; are there any hooks that detect when a player picks up an item, and, similarly, are there any that detect when a player drops an item? I'd also like to know if there's a way to despawn an item.
Here's a sort of pseudo-code example of what I'm looking for:
Code:
public void PlayerGainedItem(Player player, int ItemIndex, int Amount)
{
if (player.HasSnailRing && ItemIsCoin(ItemIndex))
{
Amount *= 2;
}
}
public void PlayerDroppedItem(Player player, int ItemIndex)
{
if (player.HasSnailRing && ItemIsCoin(ItemIndex))
{
DespawnItem(ItemIndex);
}
}
public bool ItemIsCoin(int ItemIndex)
{
return (ItemIndex == ItemID.CopperCoin || ItemIndex == ItemID.SilverCoin || ItemIndex == ItemID.GoldCoin || ItemIndex == ItemID.PlatinumCoin);
}