Jump to content

Question about EA


Skye

Recommended Posts

No, not the big bad evil publisher. I'm trying to make sense of some scripts that make extensive use of object classes, and EA has me consistently scratching my head. It seems pretty straightforward when I look at the IDS file, but working with the values seems counterintuitive at times.

 

Maybe I just need some clarification on how objects are parsed by functions.

 

From what I understand, a trigger like See([GOODCUTOFF]) will evaluate to true for any friendly crature in sight. On the other hand, if you do something like See(NearestEnemyOfType([GOODCUTOFF])) it evaluates to true for any enemy in sight, but in both cases the actual object class is the same.

 

The only way the above makes sense to me is if the first trigger checks if the EA value is lower (or equal) to the given class value whereas the second one checks if it's higher (or equal) since it's looking for enemies.

 

Is that correct? Am I missing something obvious? ???

Link to comment
From what I understand, a trigger like See([GOODCUTOFF]) will evaluate to true for any friendly crature in sight.

 

The nearest actor with a green foot circle, as well as GOODBUTBLUE (e.g. friendly guards) and GOODBUTRED (e.g. summoned fiends).

 

On the other hand, if you do something like See(NearestEnemyOfType([GOODCUTOFF])) it evaluates to true for any enemy in sight

 

The nearest green-circled actor (plus the two exceptions above) who is my enemy. Such actors can only be my enemies if I am EVILCUTOFF, e.g. anything red-circled plus a couple exceptions like with good.

If the script owner is GOODCUTOFF themselves, then it will always return false, because NearestEnemyOf() only works on evil vs good, EA wise.

 

 

Therefore such a trigger is pretty pointless, and if you saw it in game files, then chances are high it was superfluous at best, and a bug at worst. The same can be achieved by See(NearestEnemyOf()), unless you specifically need your AI script to behave differently, depending on its owner's allegiance. Even so, I've found it easier to just use Allegiance(Myself,EVILCUTOFF) See(NearestEnemyOf()) to the same result, as it's more intuitive.

Link to comment

The nearest actor with a green foot circle, as well as GOODBUTBLUE (e.g. friendly guards) and GOODBUTRED (e.g. summoned fiends).

So, basically anything above GOODCUTOFF (hence the "cutoff").

 

Therefore such a trigger is pretty pointless, and if you saw it in game files, then chances are high it was superfluous at best, and a bug at worst.

It's actually taken from SimDing0's tutorial and I've seen it used elsewhere as well. Possibly because of the tutorial in question.

 

The thing is, it works as stated. See(NearestEnemyOfType([GOODCUTOFF])) evaluates to true for enemies, which is why I'm confused. I don't know whether it's a bug or whether the NearestEnemyOfType() function simply parses the object class differently as I postulated in my original post. If it's just some weird quirk in the parser, it might very well be superfluous, although I haven't tested it enough to see if the resulting group differs in any way from one where the class is omitted.

Link to comment

If you mean this:

IF
  OR(4)
    See(NearestEnemyOfType([GOODCUTOFF])) // Lowest priority (any enemy)
    See(NearestEnemyOfType([GOODCUTOFF.0.0.CLERIC_ALL]))
    See(NearestEnemyOfType([GOODCUTOFF.0.0.MAGE_ALL]))
    See(NearestEnemyOfType([GOODCUTOFF.0.0.SORCERER])) // Highest priority (sorcerer)
  False()
THEN
  RESPONSE #100
END

then it is equal to:

Allegiance(Myself,EVILCUTOFF)
OR(4)
See(NearestEnemyOf()) // Lowest priority (any enemy)
See(NearestEnemyOfType([0.0.0.CLERIC_ALL]))
See(NearestEnemyOfType([0.0.0.MAGE_ALL]))
See(NearestEnemyOfType([0.0.0.SORCERER])) // Highest priority (sorcerer)

As long as that block is not meant to be used by party-friendly actors, it does no harm to keep the GOODCUTOFF specification, even though it is superfluous.

Like I said, the NearestEnemyOf() trigger is relative, not absolute. If the script owner is party member, then it will return true for some gibberling. If it's assign to that gibberling, then it will target party members, but not other gibberlings.

 

The only reason when you do need to specify the allegiance is when you want the same script to be universally used by any character, friend or foe, AND you want it to act differently depending on who it is assigned to.

Link to comment

As long as that block is not meant to be used by party-friendly actors...

Damn, that was so obvious. It's a script meant for monsters. :laugh2:

 

Things are much clearer now, although I'm still not entirely sure why it works for friendly creatures, but I can safely move along.

 

Thanks for the help, sometimes I tend to overthink things.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...