G
GunnyBoy
Guest
I have objects used for the player to collide into to change rooms called "o_transition". Each object has a unique with a naming convention (current_room_to_target_room) and has a a variable for the current room it's in and the target room to move to in the creation code. I'm trying to find a way to automatically build the unique ID of the target rooms transition object using those variables but I'm having some trouble. It currently works fine if I just the objects unique ID name in a variable, but if I try to build the unique as a string from variables and use "asset_get_index" it doesn't work.
Here's a bit of the code:
"_target_spawn" returns "100045" which works fine with the rest of my code but "_target_spawn_test" returns "-1" even though the code inside "asset_get_index" returns exactly as "rm_2_to_rm_1"
So my thinking is both ways should return the ID, but I can't seem to get the second one to work. Maybe "asset_get_index" isn't what I should be using to return the ID of named object? My end goal here is be able to build a string from variables that read the same as the object it's named as.
Here's a bit of the code:
Code:
_current_room = room;
_target_room = rm_2;
_target_spawn = rm_2_to_rm_1;
_target_spawn_test = asset_get_index(string(room_get_name(_target_room) + "_to_" + room_get_name(_current_room)));
So my thinking is both ways should return the ID, but I can't seem to get the second one to work. Maybe "asset_get_index" isn't what I should be using to return the ID of named object? My end goal here is be able to build a string from variables that read the same as the object it's named as.