Disable all groups in an event sheet?

This forum is currently in read-only mode.
  • Is it possible to disable all groups in an event sheet without referencing them by name?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can put them all under one master group and just disable that one.

  • I don't think that will work for my purposes. I'll have something like 10 groups and based on a given condition (e.g. a Get Value) I want to basically disable 9 of the 10 except teh one that corresponds to the value returned. So I was thinking, if I could disable them all I can then just enable the right one. I could do it the roundabout way of having a bunch of disable statements for each possible result of the Get Value condition, but given that I'm not sure exactly how many groups I'll end up having this seems a bit tedious.

  • You can use an expression in the name field for your disable group action. Say you name your groups Group1, Group2, Group3, etc. You pick the number by whatever means and store it in a variable. Then you can do ->System: Disable group "Group"&global('variableName')

  • Right. I was using that to enable the correct group so I could change what happens when different weapon-types are equipped. I was trying to have just a single enable/disable command for simplicity so that when I change the equippedWeapon variable I can just do a: Disable all groups, Enable Group(EquippedWeapon), but it appears that I can't since if I can't do somethign like "Disable all groups" then I either need to employ a holder variable (to hold weapon that was replaced) or call a disable command in all the various parts of the event sheets that cause a weapon to be unequipped.

  • I woke up in the middle of the night last night in a cold sweat, realizing that I'd gotten it backwards. I was worried that at the very least I'd confused you, and at most you'd post back saying "uh that don't work!" Either way I knew the cold hand of fate would lead me once again to this thread, and with a foreboding sense of dread I settled back into uneasy dreams.

    Um... anyway. Using a loop you can disable all of the numbered groups, like so:

    +Always
        ->Set global('groupNum') to whatever group you need
        ->Set global('loopNum') to 1
    
    +For 1 to 9
        ->System: Disable group "Group"&global('loopNum')
        ->Add 1 to global('loopNum')
    
    +Always
        ->System: Enable group "Group"&global('groupNum')
    [/code:3p0nqpo0]
    
    The loop cycles through all the groups and shuts them down one at a time, then the following event activates the one group you need.  And instead of a loopNum variable you might be able to use the loopIndex expression, but I don't recall off the top of my head if that works with For loops.
  • Hahaha sorry to be keeping you up at night! This approach sounds like it'll work, thanks!

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