T
TheTwistedMan
Guest
Hey All, this is my first post in the community. I hope it's clear for everyone to understand.
So, I'm trying to place an Id for every enemy that my project has in the room at the start, I do it with the first paragraph of code that I'm showing here.
What's the problem? The problem is that, the second chunk of code works nicely, but the third one (that is supposed to do the exact same) does not get the right id from each monster, it only gets the number "3" for whatever reason.
So, my question is, can I save objects into a ds list and then use the function "ds_list_find_value(list_of_enemies, index).auxId" to get the variable auxId from it? or am I doing something wrong?
What I suppose it is happening, is that I can't access the local variables of the object by calling the value from a ds_list. Is there any way to access all the properties of an object by calling it from a ds_list?
So, I'm trying to place an Id for every enemy that my project has in the room at the start, I do it with the first paragraph of code that I'm showing here.
Code:
// The variable auxId is created at the create event of the obj_enemy_slime
var w = 1;
with(obj_enemy_slime){
auxId = w; // Changing the auxId variable of the object
ds_list_add(global.enemiesList, obj_enemy_slime);
show_debug_message(string(auxId));
w++;
} // 3 enemies, the console throws 1, 2 and 3
Code:
with(obj_enemy_slime){
show_debug_message(string(auxId));
} // 3 enemies, the console also throws 1, 2 and 3
for(var i = 0; i < ds_list_size(global.enemiesList); i++){
var a = ds_list_find_value(global.enemiesList, i).Name;
var b = string(ds_list_find_value(global.enemiesList, i).auxId);
show_debug_message("Enemy " + a + " Added to the list with the id: " + b);
} // 3 enemies, the console throws 3, 3 and 3
What I suppose it is happening, is that I can't access the local variables of the object by calling the value from a ds_list. Is there any way to access all the properties of an object by calling it from a ds_list?