Jump to content

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

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

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

@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
Link to comment

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.

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