• 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!

Legacy GM Strange issue

Z

zendraw

Guest
so i have this kind of issue, i have a parent object o_e and a child one o_soldier which shoots fireballs and i adress the solider in a user event in the parent object
the codeblock is specified to the child object o_soldier
Code:
if (act==1)
{
    scr_at_2(sprite_index-mask_index);
}

act=-act;
and this is the situation, when there iso nly 1 instance of o_solider, he shoots as expected, by skipping 1 time.
but when there are 2 or more instances of o_soldier, he shoots every time.
by time i mean i have an alarm event and when that alarm event is triggered athe user event is triggerd, of the parent object.

the variable act is switched only at the parent event shown above.
 
H

Homunculus

Guest
The problem may be in the alarm code, could you post it?
 

Yal

šŸ§ *penguin noises*
GMC Elder
Is act a global variable? In that case, EVERYONE switches it, so with an even number it'll be switched back to the default.
 
Z

zendraw

Guest
there is no code in the alarm event, just event_user(0);
the variable is local.
culd it be that the block of code is performed in a weird way? i also tryed with 'with (obj)' but the resault is the same.
i will recheck again all code involving the child obj but this code is pretty much independent.
 
Z

zendraw

Guest
child has nothing but a create ivent where it inherites and afterwards sets some variables to suit its setup, i also tryed setting the specific var after 1 sec in an alarm event to see if it affects all the instances but it doesnt even afterwards, but the strange thing is that the vars stop shifting from 1 to -1, after another instance of the child spawns the value of act stays as its last value, i mean the other instances dont become as the new spawned one, if the last value was 1 it stays 1 if it was -1 it stays -1.
 
H

Homunculus

Guest
It's difficult for me to pinpoint the problem, what you describe seems ok. You should try to add some show_debug_message around and see what exactly gets executed and where
 
Top