You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have read and understand the suggestion guidelines
Checked for duplicate suggestions
I checked for existing similar suggestions
Summary
Currently I am not aware of any way to know if an instance or object is part of a specific family in scripting.
Possible workarounds or alternatives
none that I am aware of. (aside from looping through every families instances and compare uid)
Proposed solution
A way to query if an instance is in a family.
could be: IInstance.isInFamily(runtime.objects.SpriteFam) //or maybe just pass the name as string?
could also be on IObjectClass, or both, but on IInstance will be the most useful.
Why is this idea important?
Sometimes you want to run logic only if an instance is part of a specific family and this cannot be infered in cases were you haven't gotten the instance by that family.
for example *children(), getInstanceByUId() or any case where you got it by its base type or a different family.
example:
for (const child of player.children()) {
if (child.isInFamily(runtime.objects.arms)) {
equipWeapon(child)
}
}
(this specific example case could also be solved by an objectType specific children iterator, but a general solution for this problem makes sense regardless)
Additional remarks
No response
The text was updated successfully, but these errors were encountered:
Reviewed guidelines
Checked for duplicate suggestions
Summary
Currently I am not aware of any way to know if an instance or object is part of a specific family in scripting.
Possible workarounds or alternatives
none that I am aware of. (aside from looping through every families instances and compare uid)
Proposed solution
A way to query if an instance is in a family.
could be:
IInstance.isInFamily(runtime.objects.SpriteFam) //or maybe just pass the name as string?
could also be on IObjectClass, or both, but on IInstance will be the most useful.
Why is this idea important?
Sometimes you want to run logic only if an instance is part of a specific family and this cannot be infered in cases were you haven't gotten the instance by that family.
for example
*children()
,getInstanceByUId()
or any case where you got it by its base type or a different family.example:
(this specific example case could also be solved by an objectType specific children iterator, but a general solution for this problem makes sense regardless)
Additional remarks
No response
The text was updated successfully, but these errors were encountered: