Variables IGNORED on Event Sheet ?

1 favourites
From the Asset Store
Very simple code without excess options (15 events for server and 11 events for client)
  • Hey all,

    So, I ran into this weird issue, I'm not sure what I'm doing wrong.

    I've tried to make a simple TIMER for the creature to change states from "SLEEP" to "AWAKE" and I'm not sure why it didn't work, nobody answered on my other reply so I tried something else.

    So I made a manually Timer using an instance variable for the creature and subtract 1 every second, simple and it works.

    THE PROBLEM:

    I usually like to set my initial numbers on my event sheet instead of the properties.

    No matter what I type on the Event Sheet to tweak the new instance variable for the timer I made, it's ignoring it and ONLY follow the one on the properties.

    I checked on the Debugger and it also keep counting down -1, -2, -3 etc.. forever, instead of SET to 0.

    So, what am I missing, what am I doing wrong that ANYTHING for this instance is ignored, but only works from the properties?

    And how can I fix that, please help?

    Thanks ahead! :)

  • Every second you subtract 1 from your variable without any other condition, of course it will continue to count down. Add another condition like 'Variable > 0' or 'Flymo STATE is not AWAKE'. Then you dont need the 'trigger once' condition in the other event.

    Why the variable does not take the value of your event is not visible on the screenshot. The error must be somewhere else.

  • If you'll look carfuly in the image above, in line 171 I did set when it's LESS or EQUAL to 0 >>> Set to 0.

    So it's supposed to set it to 0 once the creature AWAKE.

    BTW - I did try to set it the way you suggested but it still ignores the SET to 0.

    But it is IGNORING this as well on the event sheet.

    I cannot understand why, but it makes everything much harder for me because the Event sheet ignores the variable, but NOT from the properties... so where is the error?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I believe your issue is the trigger once condition. The less than zero check will only happen one time because of the trigger once. It'll set it to zero then never do it again. Both trigger once and <0 have to be true for the action to be carried out. Trigger once should only be used if you really only want it to be fired once.

  • Any ideas, I just got rid of the 'Trigger Once' and it does stop on 0 so that's a progress, but

    it is NOW LOOP to the 'SLEEP' state once it's on zero...

    And the other REAL issue.

    Why the Event Sheet ignores the Start of Layout where I want to SET the initial value?

    I think it's the same error or bug why the TIMER behavior is totally IGNORED as well (you can see it's there disabled) that's why I made it manually with a variable.

    Any ideas or suggestions how to make the event sheet to NOT ignore the variable?

    I also tried this, Same issue:

    It's stuck on a LOOP, Once it's 0 it's getting back to "SLEEP" instead of "AWAKE" like it worked with the 'Trigger Once'.

  • To be honest I would have to see the whole event sheet to see if variables are being reset or not.

    I use the built timer extensively in my game, as matter of fact, I have 3 of them running on one layout without issues in both the c2 and c3 runtimes.

    I certainly can help more if you could create a simple project that reproduces the issue, if you don't want to share this one, and provide a link to it via drop box, one drive, etc....

    I would be more than willing to look into it more

  • There is nothing wrong with my suggestion and I advise you to implement it. Reduce a variable every second, just to put it back in the next step does not make sense. And still the error on your screenshots is not recognizable. We need more info or at best you share your project.

  • First of all thank you so much for trying to help kriand and rhg1968 I appreciate it!

    I bet you right and it is on something else on my "already confusing" event sheet, consider it's the first game I ever make while learning C3 (so far it'super fun!).

    To be honest, I rather just use a timer instead of the manual variable, so here is the state machine I made for the creature "Flymo" it is a bit of a mess, but it works.

    Maybe something in the state-machine makes the Event sheet to ignore the TIMER or the Instance Variable?

    Because it is weird that IT IS WORKING from the properties but not when I set the variable on the event sheet itself... any ideas?

    Here is my current update event sheet:

    The variable stops at ZERO as it should, it works great!

    BUT! it IGNORES what I set on start of layout 'On start of layout' set 'Wakeup_Timer' to 8.

    I even tried to combine the start event above on the state machine, no different.

    I'm still scratching my head why would the Event Sheet IGNORE the values, BUT still works fine as it's priority is to look at the Instance Variables properties?

    and why does the TIMER (disabled from line 166-168) does not work?

    If you have any ideas or a direction I could try, please share your helpful tips, THANKS AHEAD! :)

  • There are a few things going on here that you may need to look at:

    1. You set the animation to play from the beginning every tick.
    2. You are checking in numerous conditions if the state is equal to something and then setting equal to that in the actions
    3. You also check if the state is not equal to a bunch of things and then check if equal to something. All you need is check if it equals what you want.

    Give me a little more time to look it over in more detail

  • True, the state-machine is a mess, the only reason you see same negative on other states is because it's the only way I could make it work after so many tests, and it is working.

    But I still don't understand why the Event sheet ignores the Timer or the Instance Variable... I'm so confused by now.

  • I can try to look at it a little more, but without the context of the rest of event sheet, it's a little tough.

  • I also wanted to point out that if your expecting that timer to happen more than once it won't. The value of 8 is only being set once on the start of the layout.

  • I also wanted to point out that if your expecting that timer to happen more than once it won't. The value of 8 is only being set once on the start of the layout.

    Yes, the idea is that it will work only once as soon as a the STAGE (layout) begins, not more than that.

  • Are you interacting with the wake up timer in any other spots in the event sheet ?

  • Are you interacting with the wake up timer in any other spots in the event sheet ?

    Nope, my intention is that as soon as a stage begin (any stage that this creature may appear) the timer will start running on the start of the layout.

    For now I only used it here, but since it's not working... I disabled it.

    I REALLY rather use a timer instead of the variable anyway.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)