Boss attack on a timer

Hello! I am working on a game, and have (another) issue. I want the boss to havethree attacks, one close range, one mid, and one floor. as soon as you walk into the room, the music changes, and he boss spawns. The idea was to have a timer, and whenever the timer gets over 5 seconds, it will pick an attack at random, then reset. for now I just have placeholder art, but will fix it later.

Problem is, I can not seem to get it to actually work! I have worked on this for about 2 hours, trying this and that, but I still cant figure it out.

Oh, I forgot to mention WHAT isnt working: the timer. the boss spawns, the music changes, and I can even kill the boss. but the boss does not ever spawn the “bossAttack1”. I made a text object that would show me if the timer is counting down, but it freezes at one. So, that makes it seems that the timer never goes past 2 seconds, or never resets

Does one of your non-timer events have the start timer action?

Where do you initially reset/start the Boss1 timer?

I start it in the ‘at the start of the scene’ event at the top of my event page. I believe it is ‘start (or reset) a timer : boss1’, but i am not infront of my pc at the moment. I also tried it in the boss spawn section, but that did not work either

Is it boss1 or Boss1? You’ve mixed the two case sensitive timer names. To GDevelop boss1 and Boss1 are different timers. It’s case sensitive.

Hmm. I did not know that timers were case sensitive. That would explain why the timer never resets (i can see on the image above that both of the reset events are lowercase. I will try that as soon as i get home

Variables and object names are case sensitive too. It’s a trap for young players :slight_smile:

So, I have changed ALL of the boss cases (variable, timer, and object) names to be the same. The timer is now working

The issue with the attack not spawning is still there though. so that leads me to think that the Boss1Attack is never being changed. I took out the random number, and tried to get it to just change to 1. And it still wont spawn. I tried to put the attack spawn in the same area as the boss spawn, and then it DOES work, so that means that the variable is what is messing it up. No idea how though. the logic works in my head, just not in the game

And here is a video to show what I mean

However, if I remove the variable and just have the timer spawn/remove the sprite, it works just fine. That means it is 100% the Variable that is causing it. But I don’t know WHY. I will work on it some more

Boss1attack is not Boss1Attack

Everything within the engine is case sensitive. By using different cases on your conditions vs your actions, you’re going to run into issues.

You should also be pre-building your variables for your scene so you can just select them from a list, that way you don’t have to worry about messing up the cases.

Ok, I fixed the case on that letter of each instance, but it did not fix it. Also, How do you ‘pre-build variables’? I have looked through the wiki and a few tutorials, and there is no reference to that. I have issues with capitals (the left shift only works half the time when I am typing fast), but most of the time the autofill does not show, so I have to type it over and over. A drop down would be a lifesaver, and would speed things along nicely

Also, thanks everyone for the help. I know ya’ll are giving me help for free, and I don’t want to seem ungrateful. It really is helping, and I found OTHER areas that the help was useful in too (the pause menu had a problem, and it was a case thing). I am just in over my head! the engines I used before are easier, but VERY limited, so I am struggling to adapt (GBStudio just has variable numbers. I don’t think you can even NAME the variables, you just have variable 1, variable 2, etc. got complicated fast)

For more detail on making scene variables, the main scene variables
wiki page has a step by step process: Scene variables [GDevelop wiki]

Separately, a few things:

  1. Anything that deals with music should always have trigger once, so your “Variable HP of Boss 1 <= 0” event should also have a Trigger Once condition. You also need a trigger once in the top event in your screenshot, otherwise you risk music being restarted and other oddities.
  2. Order of events, conditions, and actions matter dramatically, everything occurs from the top down. You need the “Timer of Boss1 <= 1 seconds” to be above your trigger once condition in the 3rd event from the bottom. I would probably also put “The Timer “Boss1” >= 3 Seconds” above the Scene variable condition in the 2nd event from the bottom.

That’s it! Thank you so much! I thought it checked all of the conditions at the same time within an event(timer and variable state), so I never thought to change the order. Still don’t know why timer needs to be over the variable, but if it works, who am I to complain!

As for the link, I was looking at the variables page, and didn’t see the links to the scene variable. thank you for that. I will try to add those as I add new ones to make life a little easier with the next 3 bosses (they are exactly the same mechanically, with different attacks).

I can finally get back to designing new bugs gameplay!

1 Like