Standalone [1.3] tModLoader - A Modding API

Amazing, can't express how excited was when I saw there is actually a backup for someone like me...

And I've managed to solve the hotkey problem myself by some luck at random. Hoping you're not looking my codes already, if you are, thanks then!
However I still got questions (My questions are infinite, I know).
For now, It is the question that I've been asking for several times but not even once I asked it in a right way due to my lack of knowledge - About the Combat text of DOT.
Finally I got to know it is called "Combat Text"... Guess I was using the "indication" and puzzled you, so you cannot give out the answer. But, yeah, the "CombatText()" in NPC class.
In short, what I've always been doing is creating some debuff like Onfire or FrostBurn. But my buff, it sure can cause damage through "lifeRegen -=60", only the Combat Text remains 1, and it is indicated 1 tick by 1 tick. Then basically it got a lot of numerical "1" atop the mob when it got my debuff... it works fine but looks chaotic. Gotta fix this situation by increasing the combat text and recede the frequency of it.
Now the problem has been specified since I've realized the function using combat text and reduced timer. However, the default combat text just wouldn't disappear. My work-like-a-charm combat text is mixed with those chunk of "1". So is there anything I can do to get rid of the default combat text?
If not (I think it might be some vanilla hard coded stuff so I assume), I've thought about another way to do this by my dumb head: using "npc.life -= 60". But the mob would die, more like it disappeared. I.e. it won't drop anything or execute the death anime. Is "die" also a method of NPC class? I dunno.

BTW,the essential part of my code of my debuff is here, no idea whether it is useful to solve the problem.(counter is a timer, I stated atop of the method)
Code:
            if (npc.lifeRegen > 0)
            {
                npc.lifeRegen = 0;
            }

            if (counter == 0)
            {
                npc.lifeRegen -= 60;
                CombatText.NewText(new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height), CombatText.LifeRegenNegative, "60", false, true);
            }
            counter++;
            if (counter == 60)
            {
                counter = 0;
            }
Well, and, is item prefix modifiable now?
 
Amazing, can't express how excited was when I saw there is actually a backup for someone like me...

And I've managed to solve the hotkey problem myself by some luck at random. Hoping you're not looking my codes already, if you are, thanks then!
However I still got questions (My questions are infinite, I know).
For now, It is the question that I've been asking for several times but not even once I asked it in a right way due to my lack of knowledge - About the Combat text of DOT.
Finally I got to know it is called "Combat Text"... Guess I was using the "indication" and puzzled you, so you cannot give out the answer. But, yeah, the "CombatText()" in NPC class.
In short, what I've always been doing is creating some debuff like Onfire or FrostBurn. But my buff, it sure can cause damage through "lifeRegen -=60", only the Combat Text remains 1, and it is indicated 1 tick by 1 tick. Then basically it got a lot of numerical "1" atop the mob when it got my debuff... it works fine but looks chaotic. Gotta fix this situation by increasing the combat text and recede the frequency of it.
Now the problem has been specified since I've realized the function using combat text and reduced timer. However, the default combat text just wouldn't disappear. My work-like-a-charm combat text is mixed with those chunk of "1". So is there anything I can do to get rid of the default combat text?
If not (I think it might be some vanilla hard coded stuff so I assume), I've thought about another way to do this by my dumb head: using "npc.life -= 60". But the mob would die, more like it disappeared. I.e. it won't drop anything or execute the death anime. Is "die" also a method of NPC class? I dunno.

BTW,the essential part of my code of my debuff is here, no idea whether it is useful to solve the problem.(counter is a timer, I stated atop of the method)
Code:
            if (npc.lifeRegen > 0)
            {
                npc.lifeRegen = 0;
            }

            if (counter == 0)
            {
                npc.lifeRegen -= 60;
                CombatText.NewText(new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height), CombatText.LifeRegenNegative, "60", false, true);
            }
            counter++;
            if (counter == 60)
            {
                counter = 0;
            }
Well, and, is item prefix modifiable now?
Try this and modify the damage parameter:
https://github.com/bluemagic123/tMo...al-void-updateliferegennpc-npc-ref-int-damage

And what do you mean by modifiable? You can change an item's prefix, but you can't make a custom one yet.
 
Failed to load C:\Users\Devin\Documents\My Games\Terraria\ModLoader\Mod Sources\Enderuim\build.txt
System.FormatException: Input string was not in a correct format.
at System.Version.VersionResult.SetFailure(ParseFailureKind failure, String argument)
at System.Version.TryParseComponent(String component, String componentName, VersionResult& result, Int32& parsedComponent)
at System.Version.TryParseVersion(String version, VersionResult& result)
at System.Version.Parse(String input)
at System.Version..ctor(String version)
at Terraria.ModLoader.BuildProperties.ReadBuildFile(String modDir)
at Terraria.ModLoader.ModCompile.ReadProperties(String modFolder, IBuildStatus status)
 
Will someone help me with adding custom items to a recipe?
There are dozens of examples of custom item recipes in example mod. If you've looked at them, what problem are you having?
[doublepost=1460868971,1460868741][/doublepost]
how html
make them?
Well, if you are making png files, you'd make them in an art program, like photo shop. If you are doing cs files, any text editor is fine. If you can't program, you can mimic code you see in ExampleMod, but programming can be hard if you've never done any of it.

Here is a tool to generate a bare bones mod: http://javid.ddns.net/tModLoader/generator/ModSkeletonGenerator.html
 
There are dozens of examples of custom item recipes in example mod. If you've looked at them, what problem are you having?

Thanks for responding so quickly, would you mind linking the post explaining the recipes?

BTW I'm getting an error cs0117. Basically it says that Terraria.Item.ID doesn't contain my custom item. Sorry I'm a noob at this

I did uses the skeleton generator
 
Failed to load C:\Users\Devin\Documents\My Games\Terraria\ModLoader\Mod Sources\Enderuim\build.txt
System.FormatException: Input string was not in a correct format.
at System.Version.VersionResult.SetFailure(ParseFailureKind failure, String argument)
at System.Version.TryParseComponent(String component, String componentName, VersionResult& result, Int32& parsedComponent)
at System.Version.TryParseVersion(String version, VersionResult& result)
at System.Version.Parse(String input)
at System.Version..ctor(String version)
at Terraria.ModLoader.BuildProperties.ReadBuildFile(String modDir)
at Terraria.ModLoader.ModCompile.ReadProperties(String modFolder, IBuildStatus status)
That's saying the version is in an incorrect format. Versions are 2 to 4 numbers separated by periods.
[doublepost=1460869262,1460869089][/doublepost]
Thanks for responding so quickly, cs
Would you mind linking the post explaining the recipes?

BTW I'm getting an error cs0117. Basically it says that Terraria.Item.ID doesn't contain my custom item. Sorry I'm a noob at this

I did uses the skeleton generator
Item.ID is vanilla. Here is an example, notice how you get the mod items by calling mod.ItemType with the item class name as a parameter. https://github.com/bluemagic123/tModLoader/blob/master/ExampleMod/Items/CarKey.cs
 
There are dozens of examples of custom item recipes in example mod. If you've looked at them, what problem are you having?
[doublepost=1460868971,1460868741][/doublepost]
Well, if you are making png files, you'd make them in an art program, like photo shop. If you are doing cs files, any text editor is fine. If you can't program, you can mimic code you see in ExampleMod, but programming can be hard if you've never done any of it.

Here is a tool to generate a bare bones mod: http://javid.ddns.net/tModLoader/generator/ModSkeletonGenerator.html
any videos you can point me to?
 
Failed to load C:\Users\Devin\Documents\My Games\Terraria\ModLoader\Mod Sources\Enderuim\build.txt
System.FormatException: Input string was not in a correct format.
at System.Version.VersionResult.SetFailure(ParseFailureKind failure, String argument)
at System.Version.TryParseComponent(String component, String componentName, VersionResult& result, Int32& parsedComponent)
at System.Version.TryParseVersion(String version, VersionResult& result)
at System.Version.Parse(String input)
at System.Version..ctor(String version)
at Terraria.ModLoader.BuildProperties.ReadBuildFile(String modDir)
at Terraria.ModLoader.ModCompile.ReadProperties(String modFolder, IBuildStatus status)
If Enderium is your mod, then get rid of alphabetical symbols in version graph.
 
See, this seems to be something alike in the source code, but isn't it a NPC's method? How am I supposed to do within buff definition? Does it mean that I need to create a buff judgement for all NPCs?
So I think it out like this:
Code:
    public class DOTprecondition : GlobalNPC
    {
        public override void UpdateLifeRegen(NPC npc, ref int damage)
        {
            if(npc.HasBuff(mod.BuffType("Wither")) >= 0)
            {
                damage = 2;
            }
        }
    }
Ain't working, what's wrong?

EDIT: OK, through some luck once again get it done myself. No bother to answer this.
 
Last edited:
See, this seems to be something alike in the source code, but isn't it a NPC's method? How am I supposed to do within buff definition? Does it mean that I need to create a buff judgement for all NPCs?
You might want to look into how the ExampleMod handles the ethereal flames debuff. You'll want to look at the buff class, ExampleNPCInfo, and ExampleGlobalNPC.
 
You might want to look into how the ExampleMod handles the ethereal flames debuff. You'll want to look at the buff class, ExampleNPCInfo, and ExampleGlobalNPC.
Yep, I've found it and solved it pretty charmingly.
Yet I got another question here. Well, I'd say what I had in mind was a little bit eccentric.
I'm trying to add musics into the game. And yes, I simulated what Example mod does. It worked yet not what I'm planning to do. So I'm trying to "add" music into the game. More specifically, adding more musics for every ecosystem (dunno what to call formally, maybe zone? Just corruption, jungle...).
Let me say, just like the vanilla plain zone, it has 2 different musics and played one of them randomly. What I'm tryna do is the same.
However I don't know how to make it a random event. I type rand.next with it and it ain't working (Actually it turns out 2 musics were playing simultaneously). What should I do so that every time I entered a new zone it will choose from the vanilla music and added music for a certain probability?
 
Yep, I've found it and solved it pretty charmingly.
Yet I got another question here. Well, I'd say what I had in mind was a little bit eccentric.
I'm trying to add musics into the game. And yes, I simulated what Example mod does. It worked yet not what I'm planning to do. So I'm trying to "add" music into the game. More specifically, adding more musics for every ecosystem (dunno what to call formally, maybe zone? Just corruption, jungle...).
Let me say, just like the vanilla plain zone, it has 2 different musics and played one of them randomly. What I'm tryna do is the same.
However I don't know how to make it a random event. I type rand.next with it and it ain't working (Actually it turns out 2 musics were playing simultaneously). What should I do so that every time I entered a new zone it will choose from the vanilla music and added music for a certain probability?
Here: http://forums.terraria.org/index.php?threads/custom-daytime-nighttime-music-help.41661/#post-939704
 
It's…… unbelievable, and... I think it's totally a kind of magic, but how? Why would it works so well and at the same time seems to be uncompilable... maybe due to my poor programming skill, but... I gotta ask about this.
I noticed the int value "previousMusic" is only stated but not assigned, or at least it is assigned at the second time. Then how can first time be done without error?
I recall the last time how blue's hotkey works. There is also a unassigned int, what is the lack of my knowledge here?
 
It's…… unbelievable, and... I think it's totally a kind of magic, but how? Why would it works so well and at the same time seems to be uncompilable... maybe due to my poor programming skill, but... I gotta ask about this.
I noticed the int value "previousMusic" is only stated but not assigned, or at least it is assigned at the second time. Then how can first time be done without error?
I recall the last time how blue's hotkey works. There is also a unassigned int, what is the lack of my knowledge here?
When you declare an int, it defaults to 0. It's not null, as an unassigned non-value type would be.
 
Back
Top Bottom