• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker [SOLVED] - YYC not detecting "instance_activate_all();"

In my code I have a system where at the start of a level all instances are deactivated apart from 2 control ones which later reactivate everything on an alarm whilst a screen saying the level number is displayed. This works fine in VM however the second I switch to YYC the "instance_activate_all();" command is simply skipped over and ignored. I even tried manually activating a couple objects in the same script using "instance_activate_object(obj_player);" (as an example) and this works. Currently the command is in a control object's draw event which I thought may be an issue so I moved it to an alarm and the same issue persisted. I even tried using a variable to only activate objects once but yet again this didn't work. For all I know this may be a bug with the IDE but I was wondering if anyone was having a similar issue.

Extra Info:
IDE Version: 2.2.4.474
Runtime Version: 2.2.4.374
Visual Studio: VS2017
 
Last edited:

TheouAegis

Member
Are you using any of the keywords self or other by themselves rather than with .id appended to them? YYC has had issues with the "negative constants" in the past. So that's the first thing I'm throwing out there. lol
 
(I may get this wrong as I'm semi new to GMS2) I don't believe I have used the keyword self at all and other I have only used for destroying instances. Am I meant to have something in the brackets in the instance_activate_all() command? Or am I missing something? For deactivating the instances my code looks like this (if it helps):

Code:
instance_deactivate_all(true);
instance_activate_object(obj_stats);
obj_stats
is one of my control variables.
 
Last edited:

TheouAegis

Member
It's good you don't use self. lol

Is the instance_activate_all() inside a conditional? If so, make sure it's not the conditional itself that is broken.
 
That was my thought but unfortunately not the case. This is a very simplified version of the code where the issue lies.
Code:
else
{
   instance_activate_all();
   if global.enemy_count < 1
   {
      draw_text(room_width / 2, room_height / 2, "MISSION PASSED");
   }
}
Right before the game crashes I can see the "MISSION PASSED" text on the screen as all the enemies are deactivated so unfortunately the conditional is not the issue. Plus the issue only exists on YYC. If it were that I would expect it to be an issue on VM too.

(And about the self thing. The reason I never used it is because I never knew it existed until now so thanks for teaching me something new!)
 
Last edited:
Ok, so I've done a bit of experimenting, turns out both the instance_activate_all() and instance_activate_region() appear to not work on YYC however instance_activate_object() does and so the only solution I can see is to manually activate each object however I am resilient to do this as currently my game has 53 objects and counting. Seems long and painful but I'll do it if I have to...
 
From my testing it does affect it which is why the MISSION PASSED comes up. enemy_count just counts all the enemy instances and since their not activated the count is 0 causing the passed screen. I might file a bug report I just wanted to see if anyone else was having this issue/knows a fix before I did. Before I file one is there anything else I can try that may help determine the issue if there is one with my code?
 

TheouAegis

Member
When does enemy_count increment? If the enemies are all deactivated, then enemy_count will be 0 until the next step. How your code even worked with instance_activate_object() is beyond me, but you need to give the program time to update enemy_count after activating the enemies.
 
global.enemy_count is set by an object which is activated by that script. And the code above has a lot of stuff cut out (because it din't really matter to the activation issue) like a timer I added which means the game cannot display those messages until 5 frames after objects are activated. Since that object isn't activated the variable remains 0 (what I set it to at game start to give it a value). Regardless in those 5 frames all I can see in YYC are things drawn by obj_control_level (where the issue is) and obj_stats (The only objects still activated).
 
I have great news! I was mid way through writing the ticket and booted up the game to get a screenshot and it's fixed itself. I don't know how exactly but apparently it now works. Thank you so much for all your help! If anyone is having a similar issue in future and wants advice, the best I can give is try moving the instance_activate_all(); command from a Draw Event to an Alarm and then restart your computer. That's what I did and it worked. Now if someone could tell me how to mark a thread as solved that would be great! Yet again thank you for your help!
 
Top