My game got a bug, but idk why

my game is a pokemon game. when in battle, when my ennemy attack, i got a error that says : the block “if” need a list. what ? and apparently, it’s a variable that need to be a list, because it’s undefined, but the block above defind it ! here is my code

2 Likes

I fixed it! The problem was the “Pause until enemy health < 1” block, but I have no idea why it was broken.

Ton jeu est très cool, @ytrza4512! J’ai déjà essayé de faire un jeu de pokémon aussi (Cherche-le si tu veux, tu peux utiliser les pokémon qui existent déjà mais il faudrait demander à @Chicken_joe si tu veux utiliser ceux qui n’existent pas réellement. Si tu veux, je pourrais t’aider avec ton jeu! =D (Chicken Joe, so you don’t have to translate everything, I’m giving him permission to use the templates in my old Pokémon, but to use yours, he still needs permission from you!)

The problem was the timers “after (500) do” block. Because this block makes your code able to run at the “same time” as other code, as soon as the “Change [HP Ennemi] by (-20)” code runs, the “Wait Until” block runs, but because now the game is in the “show long text” scene context, the tilemap and sprites get stored for later. This means that when the game tries to run the code after the Wait Until block, those sprites and tilemap stuff don’t exist and this causes an error. Simply removing the “after (500) do” block and replacing it with the normal green “pause()” block will fix the issue!


This code works!

1 Like