Providing Help for Accessories

Is there any way I can do it for a prefix? As in json? I don't know how to do prefix cs. EDIT: Sorry if it's slightly irrelevant to this thread.
I have example code in the OP post that could be used for the prefix cs code
Code:
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using TAPI;
using Terraria;
namespace ZaneMod.Items //replace ZaneMod with the internal name of your mod
{
   public class TestPrefix : ModPrefix //replace TestPrefix with the name of your prefix
   {
  public override void Effects(Player p) //Where it says "p" is the variable used to represent "player". In this case, every p stands for player. This is called when the accessory is on.
     {
       p.maxMinions += 1;  //Extra minion slot
     }
   }
}
Just use this for Prefix.cs
 
I tried making a accessory to give the ghost effect, and it built successfully and i made it in game and tried it on, but i didnt go ghost?
This is the Accessories coding (where my mods internal name stands for Azumarill's super stuff. Obviously.

The .json
Code:
{
    "displayName": "Ghost Charm",
    "size": [30,26],
    "maxStack": 1,
    "value": [0,30,0,0],
    "rare": 1,
    "defense": 0,
    "accessory": true,
    "tooltip": "It floats...",

    "recipes":
    [{
        "items": { "Ectoplasm": 20, "Compass": 1, "Soul of Fright": 10 },
        "tiles": [ "Anvil" ],
        "creates": 1
    }]
}





and the .cs
Code:
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using TAPI;
using Terraria;
namespace :red:.Items
{
   public class Ghostcharm : ModItem
   {
  public override void Effects(Player p)
     {
       p.ghost = true;
     }
   }
}
All of this is correct ingame, including the sprite, except the fact that i dont get ghost. Any idea what the problem is?
EDIT ah darn it got rid of my abbreviation, well where the : red : is is where i put my correct internal name.
 
I tried making a accessory to give the ghost effect, and it built successfully and i made it in game and tried it on, but i didnt go ghost?
This is the Accessories coding (where my mods internal name stands for Azumarill's super stuff. Obviously.

The .json
Code:
{
    "displayName": "Ghost Charm",
    "size": [30,26],
    "maxStack": 1,
    "value": [0,30,0,0],
    "rare": 1,
    "defense": 0,
    "accessory": true,
    "tooltip": "It floats...",

    "recipes":
    [{
        "items": { "Ectoplasm": 20, "Compass": 1, "Soul of Fright": 10 },
        "tiles": [ "Anvil" ],
        "creates": 1
    }]
}





and the .cs
Code:
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using TAPI;
using Terraria;
namespace :red:.Items
{
   public class Ghostcharm : ModItem
   {
  public override void Effects(Player p)
     {
       p.ghost = true;
     }
   }
}
All of this is correct ingame, including the sprite, except the fact that i dont get ghost. Any idea what the problem is?
EDIT ah darn it got rid of my abbreviation, well where the : red : is is where i put my correct internal name.
Making an accessory that turns you into a ghost is a really bad idea. Just saying.
You can't open your inventory as a ghost, which means you'll never be able to unequip the item. Ghost forever.
You should make a buff for ghost (which i mentioned above) that is cancellable and turn the accessory into a usable item (in that case functions exactly like the Tome of Souls in the example)
 
Oh...well i was about to make a bad decision! I'll leave the ghosting there, as i do not want to copy your item. Thanks for the help!
 
Is there a way to modify the damage of a specific item, or test which item is in hand in order to dynamically change what the item's damage is if that's not possible? Just wondering if either is possible and if so how one would go about it.
 
Is there a way to modify the damage of a specific item, or test which item is in hand in order to dynamically change what the item's damage is if that's not possible? Just wondering if either is possible and if so how one would go about it.
Like a specific item or just boosting an attack type in general (Like meteor armor set bonus or like the Avenger Emblem?)
 
Some questions...

1) Does anyone know what manaRegen values the Mana Regeneration Potion and Mana Regeneration Band have? Is it just mana per second?
2) Is lifeRegen life regenerated per second?
3) Anyone have buff IDs?
4) Are there not any implemented effects for Paladin's Shield or Frozen Turtle Shell? Also, what about making enemies more likely to target you?

Do you know a way to make accessory's visible on the player.

In your accessory's json file...
Code:
{
    "displayName": "Example Accessory",
    "size": [20,20],
    "maxStack": 1,
    "value": [0,0,10,0],
    "rare": 7,
    "tooltip": ["Greatly increases health and mana","'An example accessory.'"],
    "accessory": true,
    "textureBack": "Items/equipables/ExampleAccessory_Back",
    "textureFront": "Items/equipables/ExampleAccessory_Front",

    //or, if it's a shield, "textureShield": "Items/equipables/ExampleAccessory_Shield",

    "recipes":
    [{
        "items": { "Dirt Block": 1 },
        "tiles": [ "Work Bench" ],
        "creates": 1
    }]
}
 
Last edited:
Thank you. It is present there.

Though I get an error returned when experimenting with the code while building the item.

Validating Jsons...
Compiling code...
orbofbrilliane.cs (6,20)
'Terraria.Player' does not contain a definition for 'magicRegen' and no extension method 'magicRegen' accepting a first argument of type 'Terraria.Player' could be found (are you missing a using directive or an assembly reference?)
p.magicRegen += 10;
^
Failed to build xemgoasmod.

Anyones thoughts?
 
Thank you. It is present there.

Though I get an error returned when experimenting with the code while building the item.

Validating Jsons...
Compiling code...
orbofbrilliane.cs (6,20)
'Terraria.Player' does not contain a definition for 'magicRegen' and no extension method 'magicRegen' accepting a first argument of type 'Terraria.Player' could be found (are you missing a using directive or an assembly reference?)
p.magicRegen += 10;
^
Failed to build xemgoasmod.

Anyones thoughts?
It's manaRegen, not magicRegen
 
How do I make an accessory give immunity to buffs?

I'm confused about the 'buffImmune' array because it is supposed to be used on the json rather than the cs and I couldn't find any example of player effects on json files. Could someone give me an example showing where in the json file I'm supposed to put it and how it is supposed to be ordered and wrote?
 
How do i do AddBuff? the thing about it wasnt clear enough for me and it didnt work.
my code is

using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using TAPI;
using Terraria;
namespace BMod.Items
{
public class MoltenClaw : ModItem
{
public override void Effects(Player p)
{
p.lavaImmune = true;
p.meleeDamage = 1.2f;
}
public override void DamageNPC(Player p, NPC n, int hitDir, ref int damage, ref float knockback, ref bool crit, ref float critMult) //This is called when the player is damaged by an NPC
{
n.AddBuff 24,60 = true;
}
}
}

and the error in builder showed

========================================
Building mod BMod

Validating Jsons...
Compiling code...
MoltenClaw.cs (18,18)
; expected
n.AddBuff 24,60 = true; //This would give the player the panic buff when hit by the NPC
^
MoltenClaw.cs (20,18)
; expected
n.AddBuff 24,60 = true; //This would give the player the panic buff when hit by the NPC
^
MoltenClaw.cs (20,18)
Invalid expression term ','
n.AddBuff 24,60 = true; //This would give the player the panic buff when hit by the NPC
^
MoltenClaw.cs (21,18)
; expected
n.AddBuff 24,60 = true; //This would give the player the panic buff when hit by the NPC
^
Failed to build BMod.

========================================

Edit: Nvm i figured it out
 
Last edited:
I have another problem idk how to do 10% damage when i tried it just did 1 extra to a thing that should get more damage
here is my code:

using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using TAPI;
using Terraria;
namespace BMod.Items
{
public class MoltenClaw : ModItem
{
public override void Effects(Player p)
{
p.lavaImmune = true;
p.meleeDamage = 1.1f;
p.magicDamage = 1.1f;
p.rangedDamage = 1.1f;
}
public override void DamageNPC(Player p, NPC n, int hitDir, ref int damage, ref float knockback, ref bool crit, ref float critMult) //This is called when the player is damaged by an NPC
{
n.AddBuff (24, 60, true);
}
}
}
 
I have another problem idk how to do 10% damage when i tried it just did 1 extra to a thing that should get more damage
here is my code:

using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using TAPI;
using Terraria;
namespace BMod.Items
{
public class MoltenClaw : ModItem
{
public override void Effects(Player p)
{
p.lavaImmune = true;
p.meleeDamage = 1.1f;
p.magicDamage = 1.1f;
p.rangedDamage = 1.1f;
}
public override void DamageNPC(Player p, NPC n, int hitDir, ref int damage, ref float knockback, ref bool crit, ref float critMult) //This is called when the player is damaged by an NPC
{
n.AddBuff (24, 60, true);
}
}
}
Instead of magic/melee/rangedDamage = 1.1f, do += 0.1f (it'll stack with other boosts)

And remove the "True" from n.AddBuff, it doesn't need that
 
umm how do you do for example texture things like climbing claw?

{
"displayName": "Frost Claw",
"size": [20,20],
"maxStack": 1,
"value": [0,7,0,0],
"rare": 3,
"tooltip": ["Does 10% more crit rate, inflicts Frostburn, and gets Warmth Effect. Can Frost Jump"],
"accessory": true,
"textureHandsOn": "FrostClaw_HandsOn",
"textureHandsOff": "FrostClaw_HandsOff",

"recipes":
[{
"items": { "Blizzard in a Bottle": 1 , "Ice Block": 250 , "Snow Block": 250 , "Warmth Potion": 5 },
"tiles": [ "Anvil" ],
"creates": 1
}]
}

is my code but it wont let me play with the
"textureHandsOn": "FrostClaw_HandsOn",
"textureHandsOff": "FrostClaw_HandsOff",
part but idk how to do it
 
Can some moderators put this thread and the "Getting Started With Modding" at that little area where the rules are at the bottom?
 
I made a helmet which is supposed to have certain effects, but it didn't work :(

Here's the code:

using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

using TAPI;
using Terraria;

namespace WillTest.Items
{
public class Corruptonitemask : ModItem
{
public override void Effects(Player p)
{
p.scope = true;
p.dash += 1;
p.dashDelay += 1;
p.dashTime += 1;
}
}
}
 
I made a helmet which is supposed to have certain effects, but it didn't work :(

Here's the code:

using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

using TAPI;
using Terraria;

namespace WillTest.Items
{
public class Corruptonitemask : ModItem
{
public override void Effects(Player p)
{
p.scope = true;
p.dash += 1;
p.dashDelay += 1;
p.dashTime += 1;
}
}
}
Is the JSON named "Corruptonitemask" exactly, case sensitive? Same for the PNG and CS name
 
Back
Top Bottom