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

Problem turning instanceId into objectId

O

OptimumKA

Guest
So im trying to convert an instanceId into an objectId, i get the instanceId via instance_position and storing it in a variable, example "instanceId". Then i try to convert it into an objectId with storing it in a variable again, example: objectId = object_get_name(instanceId.object_index);

Now when i try to create it with instance_create, it just picks the first object in my objects folder. Why?
 

Simon Gust

Member
So im trying to convert an instanceId into an objectId, i get the instanceId via instance_position and storing it in a variable, example "instanceId". Then i try to convert it into an objectId with storing it in a variable again, example: objectId = object_get_name(instanceId.object_index);

Now when i try to create it with instance_create, it just picks the first object in my objects folder. Why?
Because object_get-name returns a string. What you want is a number starting from 0.
To get that, just use object_index ->
Code:
objectId = instanceId.object_index;
 
Top