How do I…
Hello! I’m making a game from the template: “Top Down RPG”. I’m trying to make different NPC’s and NPC’s battles, starting with level 1 where the player can easily win from the NPC’s pet in battle. When the player or enemy (NPC’s pet) dies, the scene should switch back to the overworld. So i raised the damage points the player does to the NPC’s pet from 10 (default) to 100 points, but it didn’t work (see below). How do i fix this?
What is the expected result
The NPC’s pet should die in 1 attack with the NPC’s pet having 100 health points, instead of doing only 10 points of damage (too slow). Then it should switch back to the overworld scene
What is the actual result
The NPC’s pet’s healthbar decreases as normal, but the NPC’s pet doesn’t register as dead, so the scene doesn’t switch back to the overworld.
In the screenshots above, the enemy should be dead because he and the player started with 100 health points i attacked him with 100 points of damage. But instead it just attacks me back.
Hi and welcome here
The group ‘their turn’ is placed before the battle end, and its condition is filled, so it executes.
Either add an enemy health condition to ‘their turn’, either move the end group higher, so it executes before ‘their turn’.
Hi buddy, you got to start from the Overworld scene. When you start from the Battle scene the last condition (return to previously paused scene if enemy or player is dead) will never be true because there is no previously paused scene. You will stay in battle forever, long after you have both died.
I don’t know if this is your problem but wait is poorly named. It doesn’t completely stop; it only stops the events in that group. The other events continue on. If you change a variable before the wait happens then that set of actions are paused but the game continues running other events. Wait creates a time delay that can cause weird things to happen.
A better strategy would be to use the tween has finished playing and create a more controlled chain of events. Just use a Boolean variable (like you seem to be doing) to prevent other actions from happening while the tween is playing and don’t reset the Boolean until the last step. Just make sure the tween has finished playing conditions aren’t being stopped by another condition or they are sub-events of something that might stop the line from being triggered. I’ve done that.