• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

SOLVED Cuestion about "instance_create_layer"

X

xpii

Guest
Hello, I'm the first to use this community and I have a question about "instance_create_layer".

"instance_create_layer" requires object name as argument 4.
If I simply write the object name, it works.
However, I write the return value of my script, it doesn't work and I get the following code error.


>> instance_create_layer argument 4 incorrect type (undefined) expecting a Number (YYGI32)

How can I write the return value of a script in "instance_create_layer"?
I'm sorry about my poor English.
 

Mr Magnus

Viking King
A ) Did you call the script so that it actually returns something? "my_cool_script" is just the script itself. "my_cool_script()" will execute the script and if the return is valid that will work.

B ) Does the script actually return an object index and not say, a string? obj_player is fine, but "obj_player" is just a string with no meaning to gameMaker.


Without actually showing us the line in question we're a bit trapped at having to simply guess.
 
X

xpii

Guest
I'm sorry. I solved it myself.
Next time I'll ask by showing the actual code.
Thank you.
 
Top