Overview


Unlike the IID (which is a dynamic indexed value into an object type's current SOL), Construct does not support an expression-based UID indexer, eg: Enemy[10].Life would return the instance property "Life" from an enemy object type with a UID value of 10.

When comparing instances of the same object type in an event, a developer may need access to the properties of one of the instance's without affecting the current set of selected instances.

Example Scenario


Game has an object type called NPC with the following properties:
  • FriendUID - the UID value of an ally.
  • Status - Idle/Fighting/Helping
  • TargetUID - UID of an enemy

When an NPC is being attacked, it checks to see if it has a valid friend who is not already fighting, and requests help.

Event:
Local Variable tmpMeUID = -1
Local Variable tmpFriendUID = -1
NPC is being Attacked AND Trigger Once
-- tmpMeUID = NPC.UID
-- tmpFriendUID = NPC.FriendUID
-- Pick All NPC AND Pick NPC by tmpFriendUID AND NPC.Status = Idle
-- -- NPC.Status = Fighting
-- -- NPC.TargetUID = Attacker UID


Workarounds


  • Custom Getter Function
  • Subevent: Pick All, Pick by Unique UID: Save Object.MemberVariable to temporary local variable
  • Use rexrainbow's rex_uid2prop plugin.