Jump to content

IWD2: Attack() action stuff (combat scripting)


Recommended Posts

This is probably known information, considering how old the game is, but I don't see anything in the IESDP pages or a forum search (I only checked a few related terms). Basically, I noticed some unexpected behavior (compared to the EEs) while testing attacking blocks for a combat script.

First thing is with LastSeenBy(). This example block, with nothing else in the script, attacks as soon as enemies are in visual range:

IF
	ActionListEmpty()
THEN
	RESPONSE #100
		EquipWeapon()
		Attack(LastSeenBy())
END

The same block, using AttackOneRound() or AttackReevaluate(), does not attack without LastSeenBy() being set first. It only attacks enemies as well, so it seems like Attack() is auto-filling the LastSeenBy() identifier with any enemies seen. This applies to other identifiers that should need to be set like LastMarkedObject as well.

 

 

The second thing is after killing an enemy. From what I noticed, Attack() doesn't automatically return ActionListEmpty() after a target is dead, nor does it reparse the triggers. I think the same might happen with AttackOneRound() and AttackReevaluate(), but it's less noticeable because they do re-parse the triggers after the durations. So it works similarly to manually clicking an enemy target. With manual attacking, the character will automatically move to other targets when an enemy dies, even if AI is turned off.

For initially starting the auto-attack, the trigger restrictions (i.e. Range) do matter. But once the Attack() action has started, the character attacks without restrictions, as long as enemies are in visual range.

If you forcefully stop the attacking, such as with an action that doesn't require ActionListEmpty(), or by manually clicking the character, then it will need to check through the triggers again before attacking.

Edited by Dan_P
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...