Hi, I ran into a scenario where I had multiple characters on screen with effect items pinned to them. Whenever a character dies, I need to destroy the effects associated with that character. My first solution was to add instance variables to all characters. When creating each effect, I would do something like:
Effect1: Pin Pin to Character (position and angle)
Character: Set Effect1UID to Effect1.UID
And then when a character dies, choose effect instance by:
Effect1: Pick instance with UID Character.Effect1UID
It would be nicer if I didn't need to set and refer to the instance variable like that. It would be nicer if, on death, I could simply say:
Effect1: Pinned to UID Character.UID
I've included code to add that functionality to make it super easy for you if you think it's a good idea!
edittime.js:44
AddNumberParam("UID", "The UID of the object this object is pinned to.");
AddCondition(1, cf_none, "Is pinned to UID", "", "{my}ned to UID <b>{0}</b>", "True if object is pinned to the object with given UID", "IsPinnedTo");
Cnds.prototype.IsPinnedTo = function (uid)
{
return !!this.pinObject && this.pinObject.uid === uid;
};
Also, if you do agree that this change is useful, it's probably worth removing the text "Pin " on this line since "Pin" is implicit in "{my}".
edittime.js:65
//results in "Pin Pin to obj (method)"
AddAction(0, af_none, "Pin to object", "", "{my} Pin to {0} ({1})", "Pin the object to another object.", "Pin");
//results in "Pin to obj (method)"
AddAction(0, af_none, "Pin to object", "", "{my} to {0} ({1})", "Pin the object to another object.", "Pin");