[Solved] Change text of a variable and external events not working?

hello I am creating player finite state machine based off not-a-vania and the example uses text variable of player to change external events like idle and run. but I can’t get the text variables to change the external events? for example using text variable of player set to “run” doesn’t change to the run external events.

external events

player idle

player run

Are you including the external event playefsm in your scene events?

yes here is how I have scene external events

You have numerous events referring to “playefsm” and numerpus events referring to “playerfsm”.

These are different variable names and won’t update correctly.

Edit: it is late and I missed they were on different objects. Outside of that, I’m not seeing any huge issues jumping out. You’ll need to check in the debugger that your variables are actually updating or not.

ok thanks I changed the name of the text object variable of player to playerfsmchange and changed the text variable of hitbox to playersfmhitbox but noting changed. additionally if I use an object variable instead of text to change the external events everything works?

Where are you initially setting the value of the player object variable playefsm?

initially when I changed the variable from text to object but can only use numbers so I set idle to 0 and run to 1 and everything works as should. I also renamed the text variables and checked the spelling was right and no change :confused:

One way I debug to check an event’s conditions are true is to put in a temporary action that changes the background colour, or the colour of an object on the screen. Try that in both the conditions of the external event playerfsm, and make sure they’re getting fired.

If they are, move the temporary background change to events within the other external events, until one of them no longer changes the colour when you think it should. This will identify where things aren’t working.

1 Like

ok thanks I will mess around with it if I can’t get to work I will create a new project.

EDIT got it working! I didn’t add text value in the object variable here

object variables

EDIT also I didn’t know had to set the initial text value of the object variable to idle then just replace the text idle to run without changing the initial text value in object variable panel. now it’s working as expected :sweat_smile:

1 Like