I am programming a boss fight using tModLoader for Terraria, and I am having issues. 1. The section commented as "// Run one of 4 normal attacks" is not running at all. (Okay, well, it might be, but at least the Main.NewText() sections aren't working.) 2. The random.Next() is returning 0.
I don't know if this question has been asked before (it wasn't in the list of suggestions you get when you begin to ask a question), so anything you can do is good. (My main issue is #1)
For #1 I have tried switching around the positions of the forloops and the if statements. This is all I can think of to do, unfortunately. For #2 I cannot see what is wrong, and I haven't tried anything.
Code here: https://pastebin.com/yxe7XP8G (This bit here is what I think is the most likely explanation for this)
public override bool PreAI()
{
if (npc.ai[0] == 0)
{
Main.NewText("The power of sock fetishes overwhelms you...", 224, 147, 4, true);
npc.ai[0] = 1;
}
int hazumekAttackConj = 0;
int hazumekAttackIDCurrent = 0;
npc.TargetClosest(true);
Player player = Main.player[npc.target];
Random random = new Random();
// Run one of 4 normal attacks
Main.NewText(hazumekAttackIDCurrent);
I don't know what exactly is breaking here, so I will share my entire PreAI() hook.
No error messages are displaying.
I expect the chat output to be: "Hazumek NRM Attack 1-4", then "Hazumek CNJ Attack S1" Then, "Hazumek NRM Attack 1-4", then "Hazumek CNJ Attack S2". This should repeat forever.
The chat output is actually "Hazumek CNJ Attack S1" and then "Hazumek CNJ Attack S2" over and over again.