tAPI [Discontinued] tAPI - A Mod To Make Mods

Status
Not open for further replies.
Code:
return Main.rand.next(10) < 6;
Seriously, screw IF blocks.
wait... wait...
I know where to put it, but let's say I want the "chance to not consume ammo" as 60%, what would that code look like?
60% chance to NOT consume ammo...
Code:
return Main.rand.next(10) >= 6;
This would consume ammo only 40% of the time

EDIT: FYI - Combined with other in game buffs - you could get down to a 10.24% chance to consume ammo. That's ridiculously low.
EDIT EDIT: Fixed...
 
Last edited:
hello i can't play tAPI because when i open it it says tAPI has stop working and here is the problem details there's two because it's long please tell me how to stop it so i can play
plus i need to take some picture for Blitz-Modder to put in his mod .
bandicam 2014-12-24 07-39-44-768.jpg

bandicam 2014-12-24 07-40-13-501.jpg
 
Every time I try to start tAPI, it makes the "boop" noise that plays when you hit a button at the menu. Also, TerrariaOriginal.exe isn't a file on my computer, it's nowhere to be found! I would just really like to play Terraria again before the Christmas Event ends... :(
 
Every time I try to start tAPI, it makes the "boop" noise that plays when you hit a button at the menu. Also, TerrariaOriginal.exe isn't a file on my computer, it's nowhere to be found! I would just really like to play Terraria again before the Christmas Event ends... :(

... Just uninstall terraria (but backup anything that's not the content folder, I can't stress this enough) and install it again. Tada, terraria!
 
... Just uninstall terraria (but backup anything that's not the content folder, I can't stress this enough) and install it again. Tada, terraria!

Actually, scratch that, I have no idea how to do this.

I might be the biggest noob I know.

This being backing up files.
 
Actually, scratch that, I have no idea how to do this.

I might be the biggest noob I know.

This being backing up files.
1. Make a folder on your desktop, call it whatever you please
2. Go to "C:\Program Files (x86)\Steam\SteamApps\common\Terraria" and copy anything that's not in the "Content" folder to the folder you made earlier
3. Go to your documents (should be somewhere under your libraries) and copy the "My Games" folder into the folder you made earlier

now remove and install terraria from steam. then install tAPI (obv optional, not required but you can later).

If you find you're missing something, then you should have it backed up in the folder you made.

Lvl1gdQ.png

Like this?
Remove the ";" at the end of line 13
 
I can't find SteamApps
But I DID find the Terraria folder, with all of the Player data and World data and such.
Also tAPI is there.

Steam > Your Library > Right Click on Terraria > Properties > Local Files > Browse Local Files

That's another method of getting to the whole steamapps/common/terraria folder.
 
I got a
Code:
'System.Random' does not contain a definition for 'next' and no extension method 'next' accepting a first argument of type 'System.Random' could be found (are you missing a using directive or an assembly reference?)
   return Main.rand.next(10) < 6;
 
Hi,
I am trying to make an accessory that will have a 50% chance to keep you alive on death. I think i know how to make it keep you alive but how do i make it onyl do it on the players death and only when the player has the accessory equipped?

Thanks,
Drok
 
Hi,
I am trying to make an accessory that will have a 50% chance to keep you alive on death. I think i know how to make it keep you alive but how do i make it onyl do it on the players death and only when the player has the accessory equipped?

Thanks,
Drok

ModPlayer has a PreKill and PostKill hook (i'd assume PreKill would be what you're looking for). As for if they accessory is equipped, check the relevant inventory slots (I forget the exact indexes, but I would assume the accessories are part of your inventory, or a field of their own) for your accessory's id.
 
Hi,
I am trying to make an accessory that will have a 50% chance to keep you alive on death. I think i know how to make it keep you alive but how do i make it onyl do it on the players death and only when the player has the accessory equipped?

Thanks,
Drok
Sounds like you would want this accessory to give you Shadow Dodge at low health. Unless you mean 50% chance to respawn right where you died.
 
ModPlayer has a PreKill and PostKill hook (i'd assume PreKill would be what you're looking for). As for if they accessory is equipped, check the relevant inventory slots (I forget the exact indexes, but I would assume the accessories are part of your inventory, or a field of their own) for your accessory's id.
Thank you.

Sounds like you would want this accessory to give you Shadow Dodge at low health. Unless you mean 50% chance to respawn right where you died.
Sort of. I want the effect of guppy's collar from Binding Of Isaac.
 
ModPlayer has a PreKill and PostKill hook (i'd assume PreKill would be what you're looking for). As for if they accessory is equipped, check the relevant inventory slots (I forget the exact indexes, but I would assume the accessories are part of your inventory, or a field of their own) for your accessory's id.
Easier way, have a bool you just toggle to true if the accessory is equipped...
Code:
public override void OnEquip(Player player, int slot) { }
public override void OnUnEquip(Player player, int slot) { }
Alternatively, you could just do the check in the item's own hooks, then the code would only run if the item is equipped... Could be as simple as checking if the damage > remaining life
Code:
//Called when an NPC damages this item's player.
public override void DamagePlayer(NPC npc, Player owner, int hitDir, ref int damage, ref bool crit, ref float critMult) { }
 
Last edited:
Status
Not open for further replies.
Back
Top Bottom