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
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
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
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
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
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:
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.
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!