• 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!

Using variables in ds_grid_get not working

R

Retrotation

Guest
I really want lil Jimmy to be able to mod my game, but because he is 7 years old, I don't want to have him get messy with any heavy code. To do this, I'm making my "Dirt" object a child of a "Solid" object, where I store the actual code for working with the DS Grid. So, I create a variable inside the "Dirt" Create Event that lists it's object id, and then call the variable when working with the grid.

However, I am sad to say that this method does not successfully write any value to the DS Grid.

Does anyone have any idea on how to get this working?

 
I

icuurd12b42

Guest
Move the event inherited call above the code block.

or type
event_inherited();
before the other code (and remove the D&D)
 
R

Retrotation

Guest
I tried that originally. I got it working by making sure all objects along the parent/child chain had the inherited event call, including objects without any events or action-calls.

Thank you for your reply! I will try to force the inheritance with the code event_inherited(); next time this arises.

Another trick someone mentioned on Reddit was that I could use object_index instead of writing the blocktype into a variable :)
 
I

icuurd12b42

Guest
Another trick someone mentioned on Reddit was that I could use object_index instead of writing the blocktype into a variable :)
yes. initialize the grid with noone instead of 0 though since 0 is a valid object index
 
Top