Jump to content

Issues with Nearest([PC.HUMANOID])


Lauriel

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 comment

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 comment
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 comment

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 comment

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.

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...