Claspo Jones
Member
I'm trying to set up a system where once a teleporter object (obj_teleporter) collides with the player, it looks through a DS list "global.tele_list" which stores the ids of any teleport stops (obj_teleportstop) in the current room, then when it finds one with a matching tele_id value (ex: both the teleporter and teleport stop have a their tele_id set to 1), it'll store that object in a variable (target) and change the players x and y to match the target's;
I have an object (manager) that has the code;
The teleport stops have this code in their create events;
And the teleporters have this set of code;
(IDs are set in creation code).
Though when I try to run the game, I get this error message;
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Create Event
for object obj_teleportstop:
global variable name 'tele_list' index (100006) not set before reading it.
at gml_Object_obj_teleportstop_Create_0 (line 2) - ds_list_add(global.tele_list, id);
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_obj_teleportstop_Create_0 (line 2)
I'd like to know how I would actually achieve this if my code is horribly wrong, as I've only recently started using Gamemaker.
I have an object (manager) that has the code;
Code:
Room Start:
global.tele_list = ds_list_create();
Code:
Create:
tele_id = 0;
ds_list_add(global.tele_list, id);
Code:
Create:
tele_id = 0;
target = 0;
Code:
Step:
if (place_meeting(x,y,obj_player))
{
target = ds_list_find_value(global.tele_list, tele_id);
obj_player.x = target.x;
obj_player.y = target.y;
}
Though when I try to run the game, I get this error message;
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Create Event
for object obj_teleportstop:
global variable name 'tele_list' index (100006) not set before reading it.
at gml_Object_obj_teleportstop_Create_0 (line 2) - ds_list_add(global.tele_list, id);
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_obj_teleportstop_Create_0 (line 2)
I'd like to know how I would actually achieve this if my code is horribly wrong, as I've only recently started using Gamemaker.