Multi-Object Sequence Works For One, Not Others

0 favourites
  • 9 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • First, thank you to everyone who has reached out to help me in the past.

    And if you're one of those people, you know my requests for help are probably on the complicated side (at least when I try to explain my issues clearly). So, please bear with me... THIS time, I've included pictures!

    SCENARIO:

    FINN: Mobility Run is a stealth game for the mobile platform. During each stage, FINN must activate switches to open doors, etc. The Switch objects, using their own UID, are associated with multiple instances of Conduits (two types - straight and angle put into a Family) and with a Door or other object if the Conduits do not come to a dead-end.

    On the main screen during gameplay, there is a touchscreen button - Interact - which will turn fully opaque when FINN is on or near something he can interact with or activate.

    Pressing Interact while overlapping a Switch instance will set off a chain-reaction of Conduit instances, each with a manually-entered sequence number, thus creating the appearance of segment after segment "charging up" as it proceeds to the end of its line.

    Once the counter for the Switch reaches the maximum number of Conduits in its associated chain (zero-based), it either stops right there or it activates whatever object is connected to it (ie: Door).

    This is where I have problems...

    If I activate a Switch, it will work just fine, with or without an ending piece like a Door. But as soon as I activate a second Switch, it doesn't appear to do anything. It might initiation the first Conduit instance in its chain, but no more. I cannot determine where the problem is coming from.

    In Bug Test preview, all Switches register that they can be activated when the conditions are met but I do not see where the other two are being prevented from being activated.

    Thank you again for your help!

  • The main properties of Construct that hang me up at the inherent asynchronicity of JavaScript and the fact that all root global events (even if they are sub-grouped) are automatically executed "per tick".

    Check and make sure you don't have conflicting conditions executing simultaneously or in quick sequence (like a toggle). With toggle switches, you must have a toggle variable and alter this parameter and change the object state based on the parameter's value, not based on simultaneously executing conditions.

  • gumshoe2029 - Well, I don't have any toggling of variables going on. What I've got pictured above is all that's involved with this particular case. There are no other event lines in action. But, based on what you said, are there any other conditions that you see that might line up with what you are thinking?

  • one thing I see immediately is the impossibility for event 194 to be true..

    It's topevent limits the selection of switches to the ones that are not activated, so it's impossible to pick one that is activated in a subevent..

  • LittleStain - Thank you. I do believe I caught that shortly after my last comment. I did, actually, get it working by adding a For Each to event line 194. Go figure... I hate that I can't always tell when a For Each is needed. It has been my understanding that a condition like 194 automatically checks FOR EACH instance that meets the criteria and then equally does FOR EACH instance of any other related object that relates to those initially-selected instances as it goes down the sub-events. Ah well. I've got it worked out.

  • LittleStain - Thank you. I do believe I caught that shortly after my last comment. I did, actually, get it working by adding a For Each to event line 194. Go figure... I hate that I can't always tell when a For Each is needed. It has been my understanding that a condition like 194 automatically checks FOR EACH instance that meets the criteria and then equally does FOR EACH instance of any other related object that relates to those initially-selected instances as it goes down the sub-events. Ah well. I've got it worked out.

    It's pretty easy and described in the manual "how events work" and "subevents"

    subevents continue with the objects picked in the events above..

    if you want to pick another instance in a subevent you should first pick all instances and start reducing by conditions again..

  • LittleStain - I actually started doing that on line 199. And even for line 200 at one point. That didn't fix the issue. I've read the manual regarding how events work but it doesn't always seem to work 100% for absolutely every case. Meaning, there seems to be exceptions when the event line assumes "all instances that meet these conditions".

  • There seems to be exceptions when the event line assumes "all instances that meet these conditions".

    There shouldn't be..

    If you use events that don't pick, like the system compare expression, things might get messy, but picking objects is picking objects and subevents will reference only the already picked objects..

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • gumshoe2029 - Well, I don't have any toggling of variables going on. What I've got pictured above is all that's involved with this particular case. There are no other event lines in action. But, based on what you said, are there any other conditions that you see that might line up with what you are thinking?

    What is your "Switch" for?

    For example, in your second image you have (what looks to me at least) like two global events:

    1) When Switch is InteractButtonActive

    2) When Switch is not InteractButtonActive

    Both of those (if they are indeed global events) will execute on every tick, so if you do not control the flow of actions very carefully, you will end up toggling the switch back and forth nearly instantly, effectively making it appear that it doesn't work, while in reality it is working instantly.

    Obviously, I cannot know if this is what is happening, but this is my suspicion.

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