Lauriel Posted January 22, 2021 Share Posted January 22, 2021 (edited) I'm trying to get a script to move the group member that is nearest to an NPC. I can get 2nd nearest, but not nearest, and I can't figure out why. I'm specifying 'HUMANOID' because I want to bypass party members like Grey who are animals. What is the difference in usage between Nearest([PC.HUMANOID]) and SecondNearest([PC.HUMANOID]) Edited January 22, 2021 by Lauriel Quote Link to comment
lynx Posted January 22, 2021 Share Posted January 22, 2021 I see two odd things there, so my guess it works by chance. From the spec: https://gibberlings3.github.io/iesdp/scripting/triggers/index.htm Quote An object identifier can apply to a whole group/category of creatures. The format is [EA.FACTION.TEAM.GENERAL.RACE.CLASS.SPECIFIC.GENDER.ALIGN], though some engines do not accept the faction and team specifiers. Each field within the identifier is from the associated IDS file. An entry of 0 in a field will match any value. For example: [ENEMY.0.0.MAGE] specifies all creatures that are enemies of the party, any general category, any race, mages. An object identifier only evaluates visible creatures. I have no idea how yours gets evaluated — the closing bracket should be at the end. And you need some zeroes to make the value of HUMANOID actually do a lookup vs the race stat. Quote Link to comment
Lauriel Posted January 22, 2021 Author Share Posted January 22, 2021 1 minute ago, lynx said: I see two odd things there, so my guess it works by chance. From the spec: https://gibberlings3.github.io/iesdp/scripting/triggers/index.htm I have no idea how yours gets evaluated — the closing bracket should be at the end. And you need some zeroes to make the value of HUMANOID actually do a lookup vs the race stat. Right - I was on my way back to fix the brackets. But SecondNearest([PC.HUMANOID]) does work...well seems to. I never could find any documentation on the usage, just looked at how it was used in the game files. I'll take what you've given me and see if I can get it to work. Thank you! Quote Link to comment
Lauriel Posted January 22, 2021 Author Share Posted January 22, 2021 (edited) There doesn't seem to be a GENERAL or TEAM IDS TABLE in EET so back to my Nearest([PC.HUMANOID])...that should have worked? HUMANOID is in GENERAL.IDS, in case there's confusion. Edited January 22, 2021 by Lauriel Quote Link to comment
Lauriel Posted January 22, 2021 Author Share Posted January 22, 2021 And to be more precise, this is how I'm using it: ActionOverride(Nearest([PC.HUMANOID]),MoveToPoint([533.402])) => hangs the script but ActionOverride(SecondNearest([PC.HUMANOID]),MoveToPoint([533.402])) works as expected Quote Link to comment
argent77 Posted January 22, 2021 Share Posted January 22, 2021 (edited) The group of "Nearest()" identifiers has never worked correctly for me. Afaik, "Nearest()" also takes the active creature into account, and "SecondNearest()" actually targets the third nearest (when taking the active creature into account). In your case the NearestAllyOf() specifier in combination with Allegiance() and General() checks might produce the desired result: IF See(NearestAllyOf(Myself)) Allegiance(LastSeenBy(Myself),PC) General(LastSeenBy(Myself),HUMANOID) THEN ... However, that only works in EE games. Edit: You might even drop the Allegiance() check, but I don't know of NearestAllyOf also includes familiars and other ally types in the check. Edited January 22, 2021 by argent77 Quote Link to comment
Lauriel Posted January 22, 2021 Author Share Posted January 22, 2021 That did the trick. Thank you so much, @argent77! Lifesaver!! Is there a list of these identifiers somewhere. I couldn't find one in the IESDP docs, not saying they're not there, just that I haven't found them. Quote Link to comment
argent77 Posted January 22, 2021 Share Posted January 22, 2021 They are all listed in OBJECT.IDS. Quote Link to comment
Lauriel Posted January 22, 2021 Author Share Posted January 22, 2021 Just now, argent77 said: They are all listed in OBJECT.IDS. Once again, thank you! Quote Link to comment
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.