Salk Posted August 5, 2022 Posted August 5, 2022 Hello! Can someone tell me if any of the function above could be used by an object to return itself? Ex. heartbeat script for one door: void main() { object oDoor = GetNearestObject(OBJECT_TYPE_DOOR, OBJECT_SELF); SignalEvent(oDoor,EventUserDefined(20)); } or void main() { string sDoor = GetTag(OBJECT_SELF) object oDoor = GetNearestObjectByTag(sDoor, OBJECT_SELF); SignalEvent(oDoor,EventUserDefined(20)); } The reason I am investigating this as opposed to simply using OBJECT_SELF is that it seems like doors in one area using the same name and sharing the same script don't identify themselves properly. Quote
DarthParametric Posted August 5, 2022 Posted August 5, 2022 No, you can't return the nearest object as OBJECT_SELF. Presumably that's why the nth index starts at 1 and not 0. Quote
DarthParametric Posted August 5, 2022 Posted August 5, 2022 You could use GetNearestObjectToLocation: // 228: Get the nNth object nearest to lLocation that is of the specified type. // - nObjectType: OBJECT_TYPE_* // - lLocation // - nNth // * Return value on error: OBJECT_INVALID object GetNearestObjectToLocation(int nObjectType, location lLocation, int nNth=1); Another option might be ObjectToString: // 272: Convert oObject into a hexadecimal string. string ObjectToString(object oObject); I think that should be a unique value, but I only ever tried it once and not for use with multiple instances of a single template. Even if it is unique, I suspect it would not be universal across installs, or perhaps even individual sessions on the same machine. Quote
Salk Posted August 5, 2022 Author Posted August 5, 2022 I can but test for possible solutions then. Much appreciated, DP. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.