tModLoader How to make a boss spawn minions after a certain amount of time

Some Troll Guy

Terrarian
Hello i need help so my boss can summon minions ever 10 seconds
 
Here's some advice!


Im not a coder. Dont ask me for help.
 
um that for 1.4 i am in 1.3 i thinks its easier to code in 1.3 that why i am using it
@Eye of Cthulhu🌳 dont post stuff thats not going to help
 
Last edited:
I was trying to get the 100 messages title
Im not posting much after that
Sorry @Some Troll Guy
 
i kinda just want to make a timer because i know how make a NPC spawn
 
um that for 1.4 i am in 1.3 i thinks its easier to code in 1.3 that why i am using it
@Eye of Cthulhu🌳 dont post stuff thats not going to help

Coding for 1.4 isn't harder than 1.3, in fact you have less features available in 1.3, as well as a much smaller playerbase.

For a timer you can use the NPC.ai slots or a custom variable.
 
Coding for 1.4 isn't harder than 1.3, in fact you have less features available in 1.3, as well as a much smaller playerbase.

For a timer you can use the NPC.ai slots or a custom variable.
how can i do that im a noob :confused:
 
They are just variables, you can increment them in AI and then do something if (timer == whatever)
 
how can i increment the timer
 
So I mean, it's just a variable you can add to. So timer++ for instance.

You should learn the basics of C# if you haven't already. LearnCS has a tutorial that'll take you only like 20-30 mins to do.
 
wait why wont this code work?

private int timer = 10 * 60;
private int frameCount = 0;

public new void OnUpdate(Player player)
{
frameCount++;
if (frameCount >= 60)
{
frameCount = 0;
timer--;

if (timer <= 0)
{
NPC.SpawnOnPlayer(player.whoAmI, mod.NPCType("Minisandworm"));
Main.PlaySound(SoundID.Roar, player.position, 0);
}
}
}
 
Where are you calling this new method you created?
 
its in my boss npc's code should that call the code
 
You can't just add in a method somewhere and assume it'll run. If it's not an override provided by TML, you have to call it manually yourself.
 
public override ... actually overrides a superclass' method.
Also I think you made the minion spawn every 10 minutes:

the timer goes down every 60 ticks, so every second. After 600 seconds the minion spawns.
 
i dont know how to write this in code but what if i make a static bool and set it to false but i can detect if my boss npc exits and if it does il set the bool to true
and if the bool is true il run the timer code i know how to make the bool but not how to detect if my boss npc exits
 
Can you enter the whole class's code from the first using to the last close curly bracket here?
 
public override ... actually overrides a superclass' method.
Also I think you made the minion spawn every 10 minutes:

the timer goes down every 60 ticks, so every second. After 600 seconds the minion spawns.
wait how can i change it to 10 seconds instead of 600
 
Back
Top Bottom