Why variables dont work when text does

why does this structure work when I use the text object but stops working when I use an ibject variable?


You’ll need to explain a bit more. What are you expecting, what actually happens? That template for starting a thread has those sections for a reason.

on the first puicture, what happens is that there is a text object, that text object is set to “off” when the monster is not colliding with the box. and to “on” when the monster collides with the box while the text is set to “off”.

if text is set to “on”
the player can press W to jump or S to jumpthroug

when the monster is jumping the text is set to “off”

if the text is set to off and the monster is jumping it will add every frame to the Z axis and the oposite will happen if the monster is not jumping when the text is set to off

jumping has a timer to end the jumping loop and when the loop ends jumping is set to false

the structure simulates stepOff Jump Fall landON actions/states

but if I use a variable to manage the actions/states some of the actions don’t run, the timer doesn’t always turn the variable to Off and "stepping off the platforms"doesn’t make te monster “fall”

This is the bit you need to explain a bit more detail - when do these things not happen? Is there a pattern? We can get the gist of what the events are doing by looking through them, but we cannot see what it is or isn’t doing.

Have you tried putting in some output to console actions at various stages or events to see what the variable values are? That way you see how the variable changes as the jump progresses.

I just fixed the jump by making this change:


I have one platform above another and the colision with the uper one was messing with the jump.

now the only thing that doesn’t work the same as in the text version is this one:


the variable doesn’t change when there is no collision, and as result the model doesn’t “fall”

I’m using this text object to visualize the state of the variable:

textV(commented out):


the text changes when there is no collision, and as result the model “falls”

same structure different data containers

If the monster is not in collision with the New3DBox, then the “monster in collision with New3DBox” part will not select the monster (as it isn’t in collision). Because there was no collision, the result is false. Inverting that result makes it true, and so the action is performed.

However, because no monster was selected, the variable update is applied to nothing. If it was the text object, then it works because you aren’t filtering the text object in the condition.

I hope that makes sense and will give you food for thought to working around that issue.

I don’t know what to do. tried putting it on a behavior so it was pre-stated which monster the action was applied to but nothing changed.

What if you have an unconditional event that sets the variable to “off”, and then an event straight after that had the condition “Newmonster colliding with New3DBox” and action that sets the variable to “on”?

1 Like