Jump to content

Issues with Nearest([PC.HUMANOID])


Recommended Posts

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 by Lauriel
Link to post

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.
 

Link to post
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!  :)

Link to post

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 by Lauriel
Link to post

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

Link to post

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 by argent77
Link to post

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.

Link to post
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...