# Game Maker 8.0 - Can a local instance's parent object type be changed?

I have an object I am adding in dynamically. The object type is a generic object that has two strings that are executed in the step and draw events using execute_string(string);. I find this to be better and more stable than the built-in resource modification functions.

Is there a way to change a local instance's parent object type? I wish to change its type so that it becomes a wall. There will be no conflict in terms of events. I've been reading through the Game Maker 8.0 documentation for some time and haven't been able to find confirmation one way or the other.

It would be greatly appreciated if anyone could solve this issue for me. It would make it far easier for me to deal with my issue.

You can't directly change a particular instance's parent because it would violate the concept of inheritance, which applies to objects and not instances.

Objects are the blueprints the engine refers to when computing instances' behaviors; only local variables are independent among instances of the same object, while other properties such as object_index, the object parent, and so on are referring to the object definition (it would be redundant storing this kind of information multiple times, since its value is the same for every instance of the same object).

Generally speaking, class (read: "object") properties are stored in one places only to be shared among instances; changing even just one of these properties for one instance only will require you to create a new class ("object") in order to store them.

A workaround I can think of is creating as many objects as many parents you need to refer to when creating your dynamic instances: inheritance hierarchy is defined statically, on the other hand the single instances' behavior depends on the execute_string() function you provide.

• Actually, if you read my question properly you would see that that is not what I used. I specifically stated that I did not use object_add in my first paragraph. I am looking to change only one instances parent and not all objects of that type. – user64742 Apr 3 '17 at 22:07
• My bad, I misunderstood what you wrote. I edited my answer. – liggiorgio Apr 3 '17 at 22:42
• Alright. This is technically for a mod that uses those heavily. So the better option for me is probably to just workaround needing the inheritance. I wasn't sure. Game maker tends to make a lot of it's more exotic game-design concepts at the instance level. I wasn't sure if this applied to parent types. Thanks for the answer! – user64742 Apr 4 '17 at 2:10
• Execute_string() takes in a string and executes that string as if it were a line of game maker code. It's possible that if I dig deep enough that I can find a way to check for collision and use that to have the effect of an event. Thanks once again. – user64742 Apr 4 '17 at 4:12
• @TheGreatDuck My bad, you can re-edit the post. I read it was deprecated, so I wasn't sure if he meant script_execute, or execute_string. – Vaillancourt Apr 4 '17 at 11:33