Possessed Inkie Shark
Terrarian
How would I find the players current health and mana? I want to make an accessory that heals the player while their heath and mana are at certain values
Sin Costan
Eye of Cthulhu
I would probably just do the value check in the effects of the accessories, sort of something like this.How would I find the players current health and mana? I want to make an accessory that heals the player while their heath and mana are at certain values
Code:
public override void Effects(Player player)
{
if(player.statLife < 200 && player.statMana < 200)
{
//Does something.
}
}
Solo-Ion
Dungeon Spirit
Hello all.
I''m trying to modify the dialogue that's said by town NPCs, but I can't get it to work. It seems like the PostSetChat hook isn't working, even after I reduced the coode to it's bare minimum.
I have this in my MNPC class, which I know works because I'm successfully using the PostSetupShop hook in the same class.
Could anyone tell me what I might be doing wrong? Thanks.
I''m trying to modify the dialogue that's said by town NPCs, but I can't get it to work. It seems like the PostSetChat hook isn't working, even after I reduced the coode to it's bare minimum.
Code:
public override string PostSetChat(string chat) //called after chat has been set.
{
Main.NewText("Type: " + npc.type);
return "Hello World";
}
Could anyone tell me what I might be doing wrong? Thanks.
This probably doesn't belong here, but i can't get tAPI to even run anymore
It crashes with no message before it even opens up
I found some sort of crash log that says:
Microsoft.Xna.Framework.Content.ContentLoadException: Error loading "Images\CraftButton". File not found.
at Microsoft.Xna.Framework.Content.ContentManager.OpenStream(System.String assetName)
at Microsoft.Xna.Framework.Content.ContentManager.ReadAsset(System.String assetName, System.Action`1[[System.IDisposable, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] recordDisposableObject)
at Microsoft.Xna.Framework.Content.ContentManager.Load(System.String assetName)
at Terraria.Main.LoadContent()
at Microsoft.Xna.Framework.Game.Initialize()
at Terraria.Main.Initialize()
at Microsoft.Xna.Framework.Game.RunGame(System.Boolean useBlockingRun)
at Terraria.Program.Main(System.String[] args)
System.IO.FileNotFoundException: Error loading "Content\Images\CraftButton.xnb". File not found.
at Microsoft.Xna.Framework.TitleContainer.OpenStream(System.String name)
at Microsoft.Xna.Framework.Content.ContentManager.OpenStream(System.String assetName)
It crashes with no message before it even opens up
I found some sort of crash log that says:
Microsoft.Xna.Framework.Content.ContentLoadException: Error loading "Images\CraftButton". File not found.
at Microsoft.Xna.Framework.Content.ContentManager.OpenStream(System.String assetName)
at Microsoft.Xna.Framework.Content.ContentManager.ReadAsset(System.String assetName, System.Action`1[[System.IDisposable, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] recordDisposableObject)
at Microsoft.Xna.Framework.Content.ContentManager.Load(System.String assetName)
at Terraria.Main.LoadContent()
at Microsoft.Xna.Framework.Game.Initialize()
at Terraria.Main.Initialize()
at Microsoft.Xna.Framework.Game.RunGame(System.Boolean useBlockingRun)
at Terraria.Program.Main(System.String[] args)
System.IO.FileNotFoundException: Error loading "Content\Images\CraftButton.xnb". File not found.
at Microsoft.Xna.Framework.TitleContainer.OpenStream(System.String name)
at Microsoft.Xna.Framework.Content.ContentManager.OpenStream(System.String assetName)
Solo-Ion
Dungeon Spirit
Sounds like you might need to verify your games cache.This probably doesn't belong here, but i can't get tAPI to even run anymore
It crashes with no message before it even opens up
I found some sort of crash log that says:
Microsoft.Xna.Framework.Content.ContentLoadException: Error loading "Images\CraftButton". File not found.
at Microsoft.Xna.Framework.Content.ContentManager.OpenStream(System.String assetName)
at Microsoft.Xna.Framework.Content.ContentManager.ReadAsset(System.String assetName, System.Action`1[[System.IDisposable, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] recordDisposableObject)
at Microsoft.Xna.Framework.Content.ContentManager.Load(System.String assetName)
at Terraria.Main.LoadContent()
at Microsoft.Xna.Framework.Game.Initialize()
at Terraria.Main.Initialize()
at Microsoft.Xna.Framework.Game.RunGame(System.Boolean useBlockingRun)
at Terraria.Program.Main(System.String[] args)
System.IO.FileNotFoundException: Error loading "Content\Images\CraftButton.xnb". File not found.
at Microsoft.Xna.Framework.TitleContainer.OpenStream(System.String name)
at Microsoft.Xna.Framework.Content.ContentManager.OpenStream(System.String assetName)
I did that like five times.Sounds like you might need to verify your games cache.
Still doesn't work.
Neojin
Terrarian
Terraria 1.2.4.1 and earlier had a file named 'CraftButton.xnb' in the folder 'SteamApps\common\Terraria\Content\Images'.Am i seriously the only person in existence that can't launch tAPI?
Terraria 1.3 and newer have files named 'Craft_Toggle_0.xnb' through 'Craft_Toggle_3.xnb' in the folder 'SteamApps\common\Terraria\Content\Images\UI'.
tAPI is made for Terraria 1.2.4.1, and thus uses the images Terraria 1.2.4.1 uses.
It seems as though you updated Terraria to 1.3, which deletes the old CraftButton file, and creates the 4 new Craft_Toggle buttons. And now you're trying to run tAPI and it can't find the CraftButton file. If you were to get this file, and any other files the 1.3 update may have deleted, you should be able to run tAPI again. Just ask around in the forums for someone that hasn't updated yet to share that file with you. And make sure to put it in the folder I mentioned above.
Edit:
I used a file recovery program to undelete the file. I'll post it here. If it violates some rule to post it, I'll remove the link.
Attachments
Last edited:
Solo-Ion
Dungeon Spirit
This probably doesn't belong here, but i can't get tAPI to even run anymore
It crashes with no message before it even opens up
I found some sort of crash log that says:
Microsoft.Xna.Framework.Content.ContentLoadException: Error loading "Images\CraftButton". File not found.
at Microsoft.Xna.Framework.Content.ContentManager.OpenStream(System.String assetName)
at Microsoft.Xna.Framework.Content.ContentManager.ReadAsset(System.String assetName, System.Action`1[[System.IDisposable, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] recordDisposableObject)
at Microsoft.Xna.Framework.Content.ContentManager.Load(System.String assetName)
at Terraria.Main.LoadContent()
at Microsoft.Xna.Framework.Game.Initialize()
at Terraria.Main.Initialize()
at Microsoft.Xna.Framework.Game.RunGame(System.Boolean useBlockingRun)
at Terraria.Program.Main(System.String[] args)
System.IO.FileNotFoundException: Error loading "Content\Images\CraftButton.xnb". File not found.
at Microsoft.Xna.Framework.TitleContainer.OpenStream(System.String name)
at Microsoft.Xna.Framework.Content.ContentManager.OpenStream(System.String assetName)
Terraria 1.2.4.1 and earlier had a file named 'CraftButton.xnb' in the folder 'SteamApps\common\Terraria\Content\Images'.
Terraria 1.3 and newer have files named 'Craft_Toggle_0.xnb' through 'Craft_Toggle_3.xnb' in the folder 'SteamApps\common\Terraria\Content\Images\UI'.
tAPI is made for Terraria 1.2.4.1, and thus uses the images Terraria 1.2.4.1 uses.
It seems as though you updated Terraria to 1.3, which deletes the old CraftButton file, and creates the 4 new Craft_Toggle buttons. And now you're trying to run tAPI and it can't find the CraftButton file. If you were to get this file, and any other files the 1.3 update may have deleted, you should be able to run tAPI again. Just ask around in the forums for someone that hasn't updated yet to share that file with you. And make sure to put it in the folder I mentioned above.
Edit:
I used a file recovery program to undelete the file. I'll post it here. If it violates some rule to post it, I'll remove the link.
It's more that just the craft button that was replaced. A whole bunch more like the rain, cursor and player .xnb files were renamed. With some, you could make an educated guess what the old filename was and create a duplicate file with the old name, but the player files have completely different names, like "Skin_Arm" became "Player_0_7".
Fortunately, I have a computer with the previous version of Terraria. Tomorrow, I'll find out which files were renamed and - if I'm allowed - upload them here.
Tried to make an invasion event, made an NPC to test it with, got this error right here
How would i solve this?
>>> Singleplayer: 00:25:56 <<<
TAPI.Mods+LoadException: ThatMod.tapi: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'ThatMod.OmicronianMoon' threw an exception. ---> System.Collections.Generic.KeyNotFoundException: No key "ThatMod:OmicronianProbe" found
at TAPI.WrapperDictionary`2.get_Item(TKey key) in x:\tAPI Core\tAPI\DataStructures\WrapperDictionary.cs:line 45
at ThatMod.OmicronianMoon..cctor() in c:\Users\Ursus Persus Mersus\Documents\My Games\Terraria\tAPI\Mods\Sources\ThatMod\OmicronianMoon.cs:line 21
--- End of inner exception stack trace ---
at ThatMod.OmicronianMoon..ctor()
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at TAPI.ReflectionHelper.Instantiate(Type type, Type[] argTypes, Object[] args) in x:\tAPI Core\tAPI\Util\ReflectionHelper.cs:line 41
at TAPI.ReflectionHelper.Instantiate(Type type, Object[] args) in x:\tAPI Core\tAPI\Util\ReflectionHelper.cs:line 31
at TAPI.Mod.<Load>b__0(BinBuffer bb) in x:\tAPI Core\tAPI\Mod\Mod.cs:line 157
at TAPI.Mods.HandleTapiModFile(FPath path, Action`1 action) in x:\tAPI Core\tAPI\Mod\Mods.cs:line 449
at TAPI.Mods.HandleModFile(FPath path, Action`1 action) in x:\tAPI Core\tAPI\Mod\Mods.cs:line 427
at TAPI.Mod.Load() in x:\tAPI Core\tAPI\Mod\Mod.cs:line 107
at TAPI.Mods.Load() in x:\tAPI Core\tAPI\Mod\Mods.cs:line 539
at Mods.Load()
Mods used:
TAPI.Mods+LoadException: ThatMod.tapi: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'ThatMod.OmicronianMoon' threw an exception. ---> System.Collections.Generic.KeyNotFoundException: No key "ThatMod:OmicronianProbe" found
at TAPI.WrapperDictionary`2.get_Item(TKey key) in x:\tAPI Core\tAPI\DataStructures\WrapperDictionary.cs:line 45
at ThatMod.OmicronianMoon..cctor() in c:\Users\Ursus Persus Mersus\Documents\My Games\Terraria\tAPI\Mods\Sources\ThatMod\OmicronianMoon.cs:line 21
--- End of inner exception stack trace ---
at ThatMod.OmicronianMoon..ctor()
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at TAPI.ReflectionHelper.Instantiate(Type type, Type[] argTypes, Object[] args) in x:\tAPI Core\tAPI\Util\ReflectionHelper.cs:line 41
at TAPI.ReflectionHelper.Instantiate(Type type, Object[] args) in x:\tAPI Core\tAPI\Util\ReflectionHelper.cs:line 31
at TAPI.Mod.<Load>b__0(BinBuffer bb) in x:\tAPI Core\tAPI\Mod\Mod.cs:line 157
at TAPI.Mods.HandleTapiModFile(FPath path, Action`1 action) in x:\tAPI Core\tAPI\Mod\Mods.cs:line 449
at TAPI.Mods.HandleModFile(FPath path, Action`1 action) in x:\tAPI Core\tAPI\Mod\Mods.cs:line 427
at TAPI.Mod.Load() in x:\tAPI Core\tAPI\Mod\Mod.cs:line 107
at TAPI.Mods.Load() in x:\tAPI Core\tAPI\Mod\Mods.cs:line 539
at Mods.Load()
Mods used:
Neojin
Terrarian
The error message indicates where the problem occurs:Tried to make an invasion event, made an NPC to test it with, got this error right here
How would i solve this?
>>> Singleplayer: 00:25:56 <<<
TAPI.Mods+LoadException: ThatMod.tapi: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'ThatMod.OmicronianMoon' threw an exception. ---> System.Collections.Generic.KeyNotFoundException: No key "ThatMod:OmicronianProbe" found
at TAPI.WrapperDictionary`2.get_Item(TKey key) in x:\tAPI Core\tAPI\DataStructures\WrapperDictionary.cs:line 45
at ThatMod.OmicronianMoon..cctor() in c:\Users\Ursus Persus Mersus\Documents\My Games\Terraria\tAPI\Mods\Sources\ThatMod\OmicronianMoon.cs:line 21
--- End of inner exception stack trace ---
at ThatMod.OmicronianMoon..ctor()
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at TAPI.ReflectionHelper.Instantiate(Type type, Type[] argTypes, Object[] args) in x:\tAPI Core\tAPI\Util\ReflectionHelper.cs:line 41
at TAPI.ReflectionHelper.Instantiate(Type type, Object[] args) in x:\tAPI Core\tAPI\Util\ReflectionHelper.cs:line 31
at TAPI.Mod.<Load>b__0(BinBuffer bb) in x:\tAPI Core\tAPI\Mod\Mod.cs:line 157
at TAPI.Mods.HandleTapiModFile(FPath path, Action`1 action) in x:\tAPI Core\tAPI\Mod\Mods.cs:line 449
at TAPI.Mods.HandleModFile(FPath path, Action`1 action) in x:\tAPI Core\tAPI\Mod\Mods.cs:line 427
at TAPI.Mod.Load() in x:\tAPI Core\tAPI\Mod\Mod.cs:line 107
at TAPI.Mods.Load() in x:\tAPI Core\tAPI\Mod\Mods.cs:line 539
at Mods.Load()
Start by looking at the highlighted line.
Similar threads
- Replies
- 14
- Views
- 643
- Replies
- 8
- Views
- 845
- Replies
- 6
- Views
- 2K
- Replies
- 8
- Views
- 1K
- Replies
- 11
- Views
- 735
-
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.