Place sub-event before main event actions

0 favourites
  • 8 posts
From the Asset Store
Forgotten Place - Melodic ambiance, background music, Synth
  • Hi, I couldn't find the answer by searching.

    I'd like to make my sub-event trigger immediately after the event fires, then do then perform the main event actions.

    For example:

    Preferred:

    Event: Buttmode == True

    etc conditions...

    Sub-Event: ExtraButt == True

        Sub-Event Actions: ButtPoints += 1000

    Main Event Actions: ButtPoints += 10

                          ButtMode = False

                          ExtraButt = False

    How it is now:

    Event: Buttmode == True

    etc conditions...

    Main Event Actions: ButtPoints += 10

                          ButtMode = False

                          ExtraButt = False

    Sub-Event: ExtraButt == True

        Sub-Event Actions: ButtPoints += 1000

    If main event actions fire first, then the sub-event won't fire because ButtMode is assigned to false. How do I move the sub-event up before the main event actions?

    Thanks!

  • Did you try this to confirm that the sub event won't fire?

    I'm not positive, but I thought that once the main condition is met then all events and sub events proceed even if something happens to counter the original condition.

    Event: Buttmode == True

    etc conditions...

        Main Event Actions: ButtPoints += 10

                          ButtMode = False

    Sub-Event: ExtraButt == True

        Sub-Event Actions: ButtPoints += 1000

    The condition that would be messed up by what you describe would be something like a while condition.

  • Sorry, let me revise my original example. I got carried away with the butts. Add an action to main events where ExtraButt is also assigned to false

  • Event: Buttmode == True

    Sub-Event: ExtraButt == True

        Sub-Event Actions: ButtPoints += 1000

    Sub-Event: (empty)

        Sub-Event Actions: ButtPoints += 10

                          ButtMode = False

                          ExtraButt = False

    I'm not sure I understood your events, but I guess this would work.

    There are two sub-events to the main event, and one fires right after the other.

    If ExtraButt == True, then it adds 1000 points, and right after it runs the second sub-event, which adds 10 points and sets everything to false.

    If ExtraButt == False, then only the second one fires

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hmm... I guess an empty sub-event would do the trick... I'm just getting into this, and somehow I'm kind of scared of the "tricks" I'm going to have to do.

    Thanks for the suggestion!

  • Whats wrong with a function, and/or a wait?

  • Whats wrong with a function, and/or a wait?

    So, you're suggesting with a function I would do:

    Event: Buttmode == True

    etc conditions...

    Main Event Actions:   CheckForExtraButt()

                          ButtPoints += 10

                          ButtMode = False

                          ExtraButt = False

    Function ExtraButt()

        Event: ExtraButt == True

          Actions: ButtPoints += 1000

    Is that correct?

    With that workflow I would have a separate function for each simple if condition I needed to check before the other actions.

    Not sure what you mean by a "wait". Are you saying to add to the main event's conditions a wait .5 seconds or something? So that the sub-event gets asynchronously checked?

    Thanks for all the tips

  • You should post your CAPX. This will go faster without the pseudo code.

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