Skip to content

OnItemUse

Usage

  • Return type int to prevent default behavior

Example Autogenerated

csharp
private int? OnItemUse( Item instance, int amountToConsume )
{
    Puts( "OnItemUse works!" );
    return null;
}

Location

  • Item::UseItem(int amountToConsume)
csharp
public void UseItem(int amountToConsume = 1)
{
	if (amountToConsume > 0)
	{
		object obj = Interface.CallHook("OnItemUse", this, amountToConsume);
		if (obj is int)
		{
			amountToConsume = (int)obj;
		}
		amount -= amountToConsume;
//---

Released under the MIT License.