instance_create(x, y, obj) without coordinates?



Is it possible to create object without specifying x and y?

The matter is that obj_warrior can be spawned within (x:100, x:200) while obj_archer can be spawned within (x:0, x:100); The available spawn range for each sprite is supplied as their properties (rangeXstart, rangeXend). But I can't access them unless I create the object.

The only solution comes on my mind to create object somewhere outside of playground (x:-100,y:-100) and then inside scr_create update object's coordinates.


you can do that, or even create it in 0,0
the object won't draw before the create event.

another thing is that you can use macros or global variables to store rangeXstart and rangeYstart
that way you can access them before you create your object.


a very stupid solution could be:

#macro instance_create instance_create_custom
#macro instance_create_pos instance_create

/// @func instance_create_custom
/// @arg object
return instance_create(0, 0, argument0);
where you create a script called ``instance_create_custom`` which only takes an object as argument, and creates the instance at a default location of 0,0. Then using a macro to override the normal function with your custom function, and creating an additional macro ``instance_create_pos`` to ``instance_create`` which will allow you to use the default fucnction. This is pointless and you should really just type out ``0,0`` when creating it. It's 3 symbols if you don't use spaces...