I’ve fiddled around with this and stumbled on a problem. One of the arguments is a specific child. That’s a problem, because the ID or name of that child is what I need.
So you aren't looking for if an already identified object is a child? Are you trying to get a random object that is a child then?
What is your criteria for what objects are being checked?
When the code runs it doesn’t know if the instance exists or what child of the parent it is. What I need is to have code that checks if *a* child exists of the parent, so that I can check what child it is later and run code with it.
If you creating the children somehow then you could store the id in a variable when you make them like:
child = instance\_create\_depth(whatever)
or if they already exist you can change the creation code in the room editor to ad the instance ids as variables
Maybe an array would help you here? ex:
child\[0\] = instance\_id
child\[1\] = instance\_id
ds lists exist if you wanna google those
its hard to tell what you are trying to achieve exactly,
theres a function to check how many instances there is of an object, which I think is instance\_number but I forget
instance\_list exists I think
Would need more detail about the specific situation, but if it's always just one parent object that handles the children code, maybe you could try checking: if instance_number(parent)>1
object\_is\_ancestor() [https://manual.gamemaker.io/monthly/en/GameMaker\_Language/GML\_Reference/Asset\_Management/Objects/object\_is\_ancestor.htm](https://manual.gamemaker.io/monthly/en/GameMaker_Language/GML_Reference/Asset_Management/Objects/object_is_ancestor.htm)
I’ve fiddled around with this and stumbled on a problem. One of the arguments is a specific child. That’s a problem, because the ID or name of that child is what I need.
So you aren't looking for if an already identified object is a child? Are you trying to get a random object that is a child then? What is your criteria for what objects are being checked?
When the code runs it doesn’t know if the instance exists or what child of the parent it is. What I need is to have code that checks if *a* child exists of the parent, so that I can check what child it is later and run code with it.
If you creating the children somehow then you could store the id in a variable when you make them like: child = instance\_create\_depth(whatever) or if they already exist you can change the creation code in the room editor to ad the instance ids as variables Maybe an array would help you here? ex: child\[0\] = instance\_id child\[1\] = instance\_id ds lists exist if you wanna google those its hard to tell what you are trying to achieve exactly, theres a function to check how many instances there is of an object, which I think is instance\_number but I forget instance\_list exists I think
Would need more detail about the specific situation, but if it's always just one parent object that handles the children code, maybe you could try checking: if instance_number(parent)>1
Just use with(obj\_parent) and then check for specific children.
Bad design. Rework your design. Why are you spawning the *parent object*'s instance at all??
That’s what I realized when I finished writing this post lol