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

(SOLVED) Taking variable from repeated instance to global

Hey guys ^^
I need help with my game.

I'll put a simple example here:
I am making an item system in which when the player selects an item he verifies some information about it.

global.item_select = (ob_item_sword_01);
atk = global.item_select.atk;
lv = global.item_select.lv;

The problem happens when I have two objects repeated, I'm not able to use the instance_id for this case :(
 

TailBit

Member
Um, just to clear up one thing, usually one would use the instance id, but instance_id is an array containing every id, so those two are not the same.

Also, what is the problem?
 
Thank you worked here for me ^^

In the case I created the same variable in the window object and put self
Thank you for your help!!!
 

rIKmAN

Member
Just as a note, instead of using self it's generally always better to use id, as self is only really still a thing in GML for legacy support reasons.
 
Top