Skip to content

How To: Clicker Items

direwolf420 edited this page Dec 7, 2020 · 1 revision

This page walks you through the process of creating any non-weapon clicker item.

DISCLAIMER #1: This page takes for granted that you know how to mod items into the game, for the basics, read this tml guide.

DISCLAIMER #2: This page takes for granted that you followed the first steps to add mod compatibility to your mod, read this.

Step By Step

(You can find full code of a basic accessory here)

Step 1:

Create a file and a ModItem class in it.

Step 2:

Override SetStaticDefaults in it and use the RegisterClickerItem method:

public override void SetStaticDefaults()
{
	//You NEED to call this in SetStaticDefaults to make it count as a clicker related item
	ClickerCompat.RegisterClickerItem(this);

	DisplayName.SetDefault("Example Clicker Accessory");
}

What this does is make the game know it belongs to the clicker class archetype and simply makes it say "-Clicker Class-" in the tooltip.

Step 3:

To make the clicker item unique, you can use many methods available via API, a full list can be found in the ClickerCompat class in the Player Calls region. Example: ClickerCompat.SetDamageAdd(player, 0.2f) in the UpdateAccessory hook will give the player 20% increased clicker damage. More advanced methods allow you to interface with things beyond stats, like equipped Clicker Class accessories or enabled Click Effects. More general methods like ClickerCompat.IsClickerWeapon are helpful if you work with something like a ModPlayer and want to only do things if the item in question is a clicker.


Clone this wiki locally