BipolarProductions
Terrarian
How would I go about transforming the character into another sprite for a duration, example: turning the player into a squirrel
Im getting an error and i dont know if i did something wrong or if theres an error in your code but i got an error "error CS0120 An object reference is required for the non-static field, method, or property 'PalladiumCrown.RegenCrown'"Oh no I did a mistake! Sorry.
I must've been really sleepy and ignored the facts.
There might be an easier way but for right now it's gonna be more complicated.
Here is the second piece of code.C#:using Terraria; using Terraria.ID; using Terraria.ModLoader; using static Terraria.ModLoader.ModContent; namespace Mod.Items.Armor { [AutoloadEquip(EquipType.Head)] public class ModArmor : ModItem // Change ModArmor to the name you want. { public bool ArmorOn; // You can change the name if you want. public override void SetDefaults() { item.width = Width; // replace with width item.height = Height; // replace with height item.value = Value; // replace with value item.rare = Rarity; // replace with rarity item.defense = Defense; // replace with defense } public override void UpdateArmorSet(Player player) { ArmorOn = true; } } }
C#:using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; using Terraria.ModLoader.IO; using Terraria.Utilities; using Mod.Items.Armor; namespace Mod.Items { public class Item : GlobalItem { public virtual void OnHitNPC(Item item, Player player, NPC target, int damage, float knockBack, bool crit) { if (ModArmor.ArmorOn == true) { player.AddBuff(58, 2); } } } }
I hope what I'm doing is correct. If it's not, then sorry.
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using Terraria.ModLoader.IO;
using Terraria.Utilities;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using ThrowingRevived.Items.Equipable.OreHelmets;
namespace ThrowingRevived.Items.Equipable.OreHelmets
{
public class RegenCrown : GlobalItem
{
public virtual void OnHitNPC(Item item, Player player, NPC target, int damage, float knockBack, bool crit)
{
if (PalladiumCrown.RegenCrown == true) { // this is where it says the error is.
player.AddBuff(58, 2);
}
}
}
}
using Terraria;
using Terraria.ModLoader;
using static Terraria.ModLoader.ModContent;
using Terraria.ID;
namespace ThrowingRevived.Items.Equipable.OreHelmets
{
[AutoloadEquip(EquipType.Head)]
public class PalladiumCrown : ModItem
{
public bool RegenCrown;
public override void SetDefaults() {
item.width = 18;
item.height = 18;
item.value = 10000;
item.rare = ItemRarityID.LightRed;
item.defense = 7;
}
public override void UpdateEquip(Player player) {
player.thrownDamage += 0.14f;
}
public override bool IsArmorSet(Item head, Item body, Item legs) {
return body.type == ItemID.PalladiumBreastplate && legs.type == ItemID.PalladiumLeggings;
}
public override void UpdateArmorSet(Player player) {
player.setBonus = "Greatly increases life regeneration after striking an enemy";
RegenCrown = true;
}
}
}
You just need this:-snip-
public override void UpdateArmorSet(Player player) {
// your other codes here
player.palladiumRegen = true;
}
You have to write NPC. in from of the downedBoss2. And you don't need "== true".C#:if (downedBoss2 == true) { }
if(NPC.downedBoss2){
// do your thing
}
using static Terraria.ModLoader.ModContent;
public class IDs{
public class Item{
// some static fields that hold itemtype values
public static int TestItem;
}
public class Buff{
// same here
public static int TestBuff;
}
internal static Initialize(){
// I would use ModContent.ItemType<T>() etc to set the values of the fields
Item.TestItem = ItemType<TestItem>();
Buff.TestBuff = BuffType<TestBuff>();
}
}
using Terraria;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terraria.ModLoader;
using Terraria.ID;
using static Terraria.ModLoader.ModContent;
namespace LatormRage.Items
{
public class WoodWand : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Wood Wand");
Tooltip.SetDefault("Spawn's a projectile that follows you for 10 secs\nthat can damage enemies if it makes contact.\nIf its equiped on a acccessory slot\ngive's 0.15%+ movement speed");
}
public override void SetDefaults()
{
item.CloneDefaults(ItemID.TopazStaff);
item.damage = 1;
item.width = 27;
item.height = 27;
item.knockBack = 1;
item.value = 1000;
item.rare = -1;
item.autoReuse = true;
item.useTurn = true;
item.mana = 5;
}
public override bool AltFunctionUse(Player player)
{
return true;
}
public override bool CanUseItem(Player player)
{
if (player.altFunctionUse == 2) //2 is right click
{
item.useTime = 20;
item.useAnimation = 20;
item.damage = 52;
item.UseSound = SoundID.Item41;
if (player.statMana >= 35) //when the player has 35+ mana he can use this item
{
player.statMana -= 35; //when you use the item use 35 mana
player.statLife += 35; //when tou use the item gives you 35 life
}
else
{
return false; //this make that when you have 0 mana you cant use the item
}
}
else
{
item.useTime = 30;
item.useAnimation = 30;
item.damage = 32;
item.UseSound = SoundID.Item41;
}
return base.CanUseItem(player);
}
}
}
Im trying to make a dual use weapon but it aint work / it only haves 1 attack not 2, how i can fix this?
(from al0n37)
Code:using Terraria; using Microsoft.Xna.Framework; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Terraria.ModLoader; using Terraria.ID; using static Terraria.ModLoader.ModContent; namespace LatormRage.Items { public class WoodWand : ModItem { public override void SetStaticDefaults() { DisplayName.SetDefault("Wood Wand"); Tooltip.SetDefault("Spawn's a projectile that follows you for 10 secs\nthat can damage enemies if it makes contact.\nIf its equiped on a acccessory slot\ngive's 0.15%+ movement speed"); } public override void SetDefaults() { item.CloneDefaults(ItemID.TopazStaff); item.damage = 1; item.width = 27; item.height = 27; item.knockBack = 1; item.value = 1000; item.rare = -1; item.autoReuse = true; item.useTurn = true; item.mana = 5; } public override bool AltFunctionUse(Player player) { return true; } public override bool CanUseItem(Player player) { if (player.altFunctionUse == 2) //2 is right click { item.useTime = 20; item.useAnimation = 20; item.damage = 52; item.UseSound = SoundID.Item41; if (player.statMana >= 35) //when the player has 35+ mana he can use this item { player.statMana -= 35; //when you use the item use 35 mana player.statLife += 35; //when tou use the item gives you 35 life } else { return false; //this make that when you have 0 mana you cant use the item } } else { item.useTime = 30; item.useAnimation = 30; item.damage = 32; item.UseSound = SoundID.Item41; } return base.CanUseItem(player); } } }
Example lol?public override bool AltFunctionUse(Player player)
{
return true;
}
public override bool CanUseItem(Player player)
{
if (player.altFunctionUse == 2) //2 is right click
{
item.useTime = 20;
item.useAnimation = 20;
item.damage = 52;
item.UseSound = SoundID.Item41;
if (player.statMana >= 35) //when the player has 35+ mana he can use this item
{
player.statMana -= 35; //when you use the item use 35 mana
player.statLife += 35; //when tou use the item gives you 35 life
}
else
{
return false; //this make that when you have 0 mana you cant use the item
}
}
else
{
item.useTime = 30;
item.useAnimation = 30;
item.damage = 32;
item.UseSound = SoundID.Item41;
item.CloneDefaults(ItemID.TopazStaff); //Add your orginal use here.
item.damage = 1;
item.width = 27;
item.height = 27;
item.knockBack = 1;
item.value = 1000;
item.rare = -1;
item.autoReuse = true;
item.useTurn = true;
item.mana = 5;
}
return base.CanUseItem(player);
}
}
}
i cant get the wand to fuction can you make me a example / put this in my code?public override bool AltFunctionUse(Player player)
{
return true;
}
public override bool CanUseItem(Player player)
{
if (player.altFunctionUse == 2) //2 is right click
{
item.useTime = 20;
item.useAnimation = 20;
item.damage = 52;
item.UseSound = SoundID.Item41;
if (player.statMana >= 35) //when the player has 35+ mana he can use this item
{
player.statMana -= 35; //when you use the item use 35 mana
player.statLife += 35; //when tou use the item gives you 35 life
}
else
{
return false; //this make that when you have 0 mana you cant use the item
}
}
else
{
item.useTime = 30;
item.useAnimation = 30;
item.damage = 32;
item.UseSound = SoundID.Item41;
item.CloneDefaults(ItemID.TopazStaff); //Add your orginal use here.
item.damage = 1;
item.width = 27;
item.height = 27;
item.knockBack = 1;
item.value = 1000;
item.rare = -1;
item.autoReuse = true;
item.useTurn = true;
item.mana = 5;
}
return base.CanUseItem(player);
}
}
}
well, that doesnt work either, instead of getting the regen after striking an enemy, you have it when you dont have max health, not quite how palladium armor works.You just need this:
Then vanilla Terraria will do the rest.C#:public override void UpdateArmorSet(Player player) { // your other codes here player.palladiumRegen = true; }
efewell, that doesnt work either, instead of getting the regen after striking an enemy, you have it when you dont have max health, not quite how palladium armor works.
Clearly the player.palladiumRegen is the code for the buff, as it also shows the hearts when regenerating.
You don't need anything special to do this.Clearly the player.palladiumRegen is the code for the buff, as it also shows the hearts when regenerating.
player.setBonus = Language.GetTextValue("ArmorSetBonus.Palladium");
player.onHitRegen = true;
finally lolYou don't need anything special to do this.
In your UpdateArmorSet:
Code:player.setBonus = Language.GetTextValue("ArmorSetBonus.Palladium"); player.onHitRegen = true;
do you know what namespace i need to use since it says that "downedBoss" does not exist in the current context. The namespaces im currently using are Terraria, Terraria.ID and Terraria.Modloader.For NPC selling, do this:
Replace ItemID with and Item by it's ID.C#:public override void SetupShop(Chest shop, ref int nextSlot) { if (downedBoss2 == true) { shop.item[nextSlot].SetDefaults(ItemID); nextSlot++; } }
For normal and unprepared if statements, do this:
C#:if (downedBoss2 == true) { }
not workingYou don't need anything special to do this.
In your UpdateArmorSet:
Code:player.setBonus = Language.GetTextValue("ArmorSetBonus.Palladium"); player.onHitRegen = true;
It's NPC.downedBoss2.thanks for the help.
do you know if there is a list
do you know what namespace i need to use since it says that "downedBoss" does not exist in the current context. The namespaces im currently using are Terraria, Terraria.ID and Terraria.Modloader.
How?not working
i want to activate te regeneration after i get hit that aint do thatIt's NPC.downedBoss2.
How?
putI'm tryna make a daedalus stormbow-like-bow in V.C.S. but idk how to make it shoot projectiles from the sky nor how to make it shoot a lot of those projectiles(and if you want tell me how to shoot 2 projectiles(an arrow and a star) ).
CODE: