Dr_Nomz
Member
I'm trying to use a console to spawn in an object, and if the arguments provided don't have specific coords (x and y aren't sent through the console) it'll spawn at the Character's position instead.
I've used this same type of thing before many times but now here for some reason it acts like the object doesn't exist, even though it clearly does.
The weird thing is it knows that it's own object exists, obj_console, and it'll gladly accept those coords when spawning the item, but not for the player character.
That's the error I get when I try to use this code:
Basically it spawns the object based on it's name in the index, but the coords are the issue here. When I use these, it just throws an error like obj_Character doesn't exist. Any idea why?
This is the console I'm using if it helps:
https://marketplace.yoyogames.com/assets/1356/developer-console
I've used this same type of thing before many times but now here for some reason it acts like the object doesn't exist, even though it clearly does.
The weird thing is it knows that it's own object exists, obj_console, and it'll gladly accept those coords when spawning the item, but not for the player character.
Code:
action number 1
of Step Event0
for object obj_console:
Unable to find any instance for object index '0' name 'obj_Character'
at gml_Object_obj_console_StepNormalEvent_1 (line 30) - instance_create(obj_Character.x,obj_Character.y,obj_1); }
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_obj_console_StepNormalEvent_1 (line 30)
Code:
var obj_1 = asset_get_index(console_value(_console,1));
if(obj_1 > -1){
instance_create(obj_Character.x,obj_Character.y,obj_1); }
This is the console I'm using if it helps:
https://marketplace.yoyogames.com/assets/1356/developer-console