Jump to content
Sign in to follow this  
Luke

(EE) Script trigger 0x26 TargetUnreachable(O:Object*)

Recommended Posts

Does someone know when this trigger is supposed to return true? I wanted to use it to make sure a certain creature doesn't attempt to move towards another creature if it's completely surrounded by other creatures, but it doesn't seem to work...

Share this post


Link to post

There was some talk during SoD's development about using this trigger for AI, but it remained just a talk. I would assume it only, if ever, returns true when path is blocked by searchmap/doors.

Share this post


Link to post
Posted (edited)
57 minutes ago, Ardanis said:

but it remained just a talk.

What a pity!

It'd be really handy for the aforementioned situation – I mean, it's of limited use as of now (true when path is blocked by searchmap/doors)... the 2.6 update will hopefully take that into account and improve it...

In the meantime, I'm wondering if 0x4063 InWeaponRange(O:Object*) can be of any help...

Edited by Luke

Share this post


Link to post
Posted (edited)

TargetUnreachable() only returns true if an attacker, (either using weapons or spells), suddenly loses the ability to target what it is attacking - given some specific circumstances:

Attack() - Attacker can't see invisible creatures, and target either went STATE_INVISIBLE or went under sanctuary.

Spell() - Target is a sprite (creature), the caster isn't the target, caster can't see invisible creatures, spellFlags & 0x1000000 == 0, and target either went STATE_INVISIBLE, STATE_IMPROVEDINVISIBILITY, or went under sanctuary.

UseItem() - Target is a sprite (creature), the caster isn't the target, caster can't see invisible creatures, abilityFlags & 0x4000000 != 0, and target either went STATE_INVISIBLE, STATE_IMPROVEDINVISIBILITY, or went under sanctuary.

This basically mirrors Auto-Pause: Target Gone, (listed as "Character's Target Destroyed" in the Auto-Pause menu), except it doesn't trigger on target death.

Edited by Bubb

Share this post


Link to post
Posted (edited)

@Bubb

Thanks for the extra details (it confirms I cannot achieve what I wanted to achieve...)

Just to clarify: what about opcode #211 (Imprisonment) and #213 (Maze)? Do they count as "Target Gone" along with STATE_INVISIBLE, STATE_IMPROVEDINVISIBILITY, and Sanctuary?

Edited by Luke

Share this post


Link to post

Interesting, so it doesn't trigger on inaccessibility (eg. a door being shut or other actors getting in the way) in bg2? Most uses are in the iwds, but I didn't expect this.

Come to think of it, I've seen the uses before and thought it was just bad coding:

IF
  Allegiance(Myself,ENEMY)
  ActionListEmpty()
  !TargetUnreachable([PC])
THEN
  RESPONSE #100
    MoveToObject([PC])
END

... since it currently causes them to move to pcs hiding in shadows etc. I should test the original more before dismissing it, heh.

Share this post


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.

Sign in to follow this  

×
×
  • Create New...