How can you stop a player from hurting the enemy?

i want to do a turn based fight but the turn system doesn’t really work, can someone help me?

On the second Event you’re reseting the timer way?
If your intent is to repeat the timer is ok, otherwise don’t do the Reset the timer “WaitAfterFight”, if you do the second event is checked again after 1 sec, if z isn’t pressed the timer still running over and over again

1 Like

well i deleted the 2nd reset, but nothing seemed to change, tho… ( although it did make sense )

What you need is not GDevelop-specific.

  1. you need to know which player’s tun it is. Put that information somewhere, maybe a scene variable. Decide how you want to switch the turns (time triggered, event triggered) and modify that variable accordingly
  2. one player will hurt the other player if some event happens (keyboard, mouse, joystck, …).
    Add another condition that it must be this player’s turn
  3. Probably you also want to add this condition to the player move functions, so the inactive player can neither attack nor flee
1 Like

i already did 1, and 2, but i don’t exactly understand 3

Maybe I am wrong with 3. Let me explain what I was thinking of:
I did assume you use GDevelop, which can continuously update and render multiple players and their world while limiting it to a turn-based game.
With that I further assume a player can do different things (like walk, attack, or defend). If you only allowed attacks to happen when it is a player’s turn, would that imply that other players can still walk and defend although it is not their turn? Or would you like to limit those to be available only to the active player?

In my mind I see a turn based game in which characters can only attack when it is their turn but can run away anytime. How would then an attack ever have effect? As you may have thought about it and also may have solved that issue, in point 3 I said ‘probably you also want…’.

Hope that explains.

1 Like

well it’s an undertale fangame, and in undertale the fights are turn based, where in your turn you can FIGHT, ACT, use an ITEM or FLEE (unless your in specific conditions where you can also spare), and in the enemy’s turn you need to dodge bullets. i did that but removed the ITEM, ACT and MERCY (which is flee and spare), and when i tried to apply the FIGHT option (which is a button on the screen that you need to press to attack), the button was supposed to disappear when it’s the enemy’s turn, but it only disappeared on the first enemy turn, and stayed on the rest. that’s why i posted the question on the forum. hope that gave you a bigger picture of what am i working on.

Thank you for that context. I never played undertale games at all. In fact I was never keen on turn based games. My domain was more RTS, where both players can act simultaneously.

But your button visibility problem should be easy to fix. If you know when it is the player’s turn you make them visible, and when it is some non player character’s turn you hide them. Or is that too easy?

1 Like

its that easy, so i’m really confused

I get the feeling your confusion is not related to GDevelop, although the way you have to enter your events and actions may be distracting. Therefore I suggest to take a pen and paper and write down what you want to implement, then try again on GDevelop.

The clearer your idea of the problem and it’s solution is the less you confuse what you enter in GDevelop.

i did, and i think i got a basic idea of what that could be. i think that somewhere in the lines of my events i made an event that makes the GDevelop think that i want it to change the player turn variable only once, something like the “trigger once” condition. so perhaps you can tell what could cause it to think that?

Fo further help we need to take a look at all your events. Show your events in pictures or share your project with us.

The chrystal sphere I ordered came without a manual so I cannot use it.
Therefore I second Erdo and ask you to share more information.

1 Like

how do you share a project?

There are many ways. You can zip your files, upload it to your Google Drive and share a public link to that specific file.

ok, i hope i did it right. but if you could try to only help with the player turn problem, i know it is a bit annoying to ask something like that, i just want to be able to still understand at least the majority of my events :sweat_smile::crazy_face:

https://drive.google.com/file/d/19KvJO30bDWSnBpGrYBts10XUbx0LjBN9/view?usp=sharing

hi i noticed that you didn’t reply to the link that i sent you, did you not see it or your’e working on it or something?

umm… is everything ok? it seems like your’e online but don’t check on my topic… can you at least say something so i know you are actually seeing my replies??

Here is a functional turn-based battle system:

the link just opens itch.io not any profile or game…