tAPI [Discontinued] tAPI - A Mod To Make Mods

Status
Not open for further replies.
Hey guys so i was looking into armour set bonuses.. it has to be in the YourBreastplate.cs thing correct?? "
public override void ArmorSetBonus(Player player)
{
player.setBonus = "Your Nightmares are Watching You! +30% Damage";

}
Set bonus method, will need to go in YourBreastplate.cs." so is there a way to check whether im wearing a hood, mask(minions), coif, or helmet?? so i get the correct set bonus for each setup... like

public override void ArmorSetBonus(Player player)
{
If player.armor.head.name = "Nightmare Hood" then {
player.magicDamage = player.magicDamage * (float) 1.3;
player.setBonus = "Your Nightmares are Watching You! +30% Magic Damage";
}else If player.armor.head.name = "Nightmare Helmet" then {
player.meleeDamage = player.meleeDamage * (float) 1.3;
player.setBonus = "Your Nightmares are Watching You! +30% Melee Damage";

}else if.. you get it..





}

is this possible??
 
I was referring to the fix in preItemCheck that Miraimai mentioned:
Just took a quick look, looks like someone indeed touched the code regarding and I can call it fixed (although not ideally fixed, it will work as you intend for it now)
Hey guys so i was looking into armour set bonuses.. it has to be in the YourBreastplate.cs thing correct?? "
public override void ArmorSetBonus(Player player)
{
player.setBonus = "Your Nightmares are Watching You! +30% Damage";

}
Set bonus method, will need to go in YourBreastplate.cs." so is there a way to check whether im wearing a hood, mask(minions), coif, or helmet?? so i get the correct set bonus for each setup... like

public override void ArmorSetBonus(Player player)
{
If player.armor.head.name = "Nightmare Hood" then {
player.magicDamage = player.magicDamage * (float) 1.3;
player.setBonus = "Your Nightmares are Watching You! +30% Magic Damage";
}else If player.armor.head.name = "Nightmare Helmet" then {
player.meleeDamage = player.meleeDamage * (float) 1.3;
player.setBonus = "Your Nightmares are Watching You! +30% Melee Damage";

}else if.. you get it..





}

is this possible??
Yes it is possible, you can check which helmet the player is currently wearing by checking the values of the headwear item (player.armor[0].whatever)
(0 is head slot, 1 is chest slot, 2 is legs slot , 3-7 are accessories and so on)
Do note, it is better to compare the item's type rather than name.
 
  • Like
Reactions: Azu
thank you :D
[DOUBLEPOST=1429624641,1429624519][/DOUBLEPOST]player.armor[0].headSlot??? what do i do after player.armor[0]???? cant figure it out
 
thank you :D
[DOUBLEPOST=1429624641,1429624519][/DOUBLEPOST]player.armor[0].headSlot??? what do i do after player.armor[0]???? cant figure it out
one example would be
Code:
if(player.armor[0].headSlot == ItemDef.byName["MyModInternalName:That Items name"].headSlot)
{
 //stuff
}
 
if (player.armor[0].headSlot == ItemDef.byName["TerraCraft:Nightmare Hood"].headSlot)
{
player.setBonus = "Your Nightmares Haunt You! +30% Magic Damage";
player.magicDamage = player.magicDamage * (float)1.3;
}
if (player.armor[0].headSlot == ItemDef.byName["TerraCraft:Nightmare Helmet"].headSlot)
{
player.setBonus = "Your Nightmares Haunt You! +30% Melee Damage";
player.meleeDamage = player.meleeDamage * (float)1.3;
}
if (player.armor[0].headSlot == ItemDef.byName["TerraCraft:Nightmare Mask"].headSlot)
{
player.setBonus = "Your Nightmares Haunt You! +30% Minion Damage";
player.minionDamage = player.minionDamage * (float)1.3;
}
if (player.armor[0].headSlot == ItemDef.byName["TerraCraft:Nightmare Coif"].headSlot)
{
player.setBonus = "Your Nightmares Haunt You! +30% Ranged Damage";
player.rangedDamage = player.rangedDamage * (float)1.3;
}
}

this correct?? i should probably use a switch statement or whatver it is in c#
[DOUBLEPOST=1429625140,1429625056][/DOUBLEPOST]got an error
[DOUBLEPOST=1429625156][/DOUBLEPOST]about some key
[DOUBLEPOST=1429625378][/DOUBLEPOST]nevermind... i used the name of the class not the display name on the item...
[DOUBLEPOST=1429625482][/DOUBLEPOST]although... all the sprites except for the hood are glitching... by all the sprites i mean the other three helmets
 
I can confirm that it deletes your old tAPI executable AND the vanilla one if it's renamed to Terraria.exe. This was both on a normal install and on a clean install. I have backed up my saves just in case. Perhaps there is an issue with the installer?
 
  • Like
Reactions: FoX
The new update is del
I can confirm that it deletes your old tAPI executable AND the vanilla one if it's renamed to Terraria.exe. This was both on a normal install and on a clean install. I have backed up my saves just in case. Perhaps there is an issue with the installer?

Same here
 
lets say i want to make bunnies drop "raw bunny meat" how would i do this???
[DOUBLEPOST=1429626629,1429626611][/DOUBLEPOST]the bunnies from vanilla terraria that is..
 
So, I installed r15 over r14a and now my modded game doesn't work. Tried installing it again and it's saying my game directory is invalid...
Same directory issue here, except this was happening when I started trying to use tAPI, which was r14.
 
Same directory issue here, except this was happening when I started trying to use tAPI, which was r14.
I have that same problem, did some diggingon my own and tAPI r15 literally deletes either Terraria.exe or tAPI.exe and not load a new tAPI.exe (I tested this with two seperate downloads). So, I'd recommend just sticking with r14a while they fix the installation problem.
 
Apologies for the broken installer. Apparently we kinda derped when adding the .PDB file to the installer, AFTER fiddling with the installer code and never really tested it without Game Launcher afterwards... All should be fine now.
 
Status
Not open for further replies.
Back
Top Bottom