Wikia

Surfpup's tConfig Mod Wiki

How to Make a Custom Buff

Comments171
118pages on
this wiki

Redirected from How to make a custom buff

Under Contruction

Under Construction
This page has been marked as under construction, which means information may change rapidly as it updated, or that the page is awaiting updates.


Difficulty: Difficulty-2
Clock: 10 to 20 minutes


Contents

Making a custom buff.Edit

Setting up a ModPackEdit

First, if not done already, create a modpack folder in your terraria folder. (C:\Users\You\Documents\My Games\Terraria\Create it here)

Create a folder called "Buff" inside your ModPack folder.

Making your buffEdit

  1. Go to your "Buff" folder
  2. Create a new .ini file, and name it whatever you want your buff to be called (eg. "Frozen")
  3. Open it, and write your code in:
[Stats]
id=-1 ;States that your buff is a custom one
tip='I can't move!' ;The message that will appear on mouseover
debuff=True ;Can you dispell it by right-clicking on it. (true = you can't)
Frozen
Frozen Buff Made by:Virtulox
Blankbuff
A blank buff image for editiing.
Blankdebuff
A blank debuff image for editing.

1. Add a .png file called Frozen.png there, with the image of what you want it to look like. (32x32 is ideal)

2. Make a new file called Frozen.cs, and add the following code into it:


public static void Effects(Player player) {
        player.controlUp    = false;
        player.controlDown  = false;
        player.controlLeft  = false;
        player.controlRight = false;
        player.controlJump  = false;

}


3. Save all the files.Edit

More ExamplesEdit

The Player Class page shows many of the attributes that can be changed with buffs. For example, the following code allows you to reflect damage, walk on hellstone and meteor, walk on water and lava, place tiles really far away, and allows rocket flying!

public static void Effects(Player player) {
        player.thorns=true;
        player.fireWalk=true;
        player.waterWalk=true;
        player.blockRange = 20;
        player.canRocket=true;

}

Ice Spell Edit

The NPC Class page shows all of the things you can change with a buff.

A good example of this is a freeze spell.

public static void NPCEffects(NPC npc)
{
    npc.velocity.X = npc.velocity.X /2f;
    npc.velocity.Y = npc.velocity.Y /2f;
    Color color = new Color(0, 144, 255, 100);
    npc.color = color;
}
public static void NPCEffectsEnd(NPC npc, int buffType)
{
    npc.color = default(Color);
}

Here is a list of what this code does:Edit

  • npc.velocity.x/y sets the npc's velocity.
  • color sets the NPC's color
  • NPCEffectsEnd executes when the buff ends. The color is reset to default here.

Activating BuffsEdit

To activate your (de)buff, in any .cs, add

 myPlayer.AddBuff("your buff name", 300, false); //set the 300 to buff time


Note: to add buffs from the original game, use the type number of the buff you want to use instead of the name.

  myPlayer.AddBuff(28, 10800, false); //Werewolf
Advertisement | Your ad here

Photos

Add a Photo
544photos on this wiki
See all photos >

Recent Wiki Activity

See more >

Around Wikia's network

Random Wiki