Jump to content

Home

CancelCurrentCombatAction() ?


Dashus

Recommended Posts

Is there a way to clear the current/about-to-happen action on the combat queue without wiping the entire thing with CancelCombat()?

 

As far as I am aware there is no way to selectively manipulate the content of the action queue. To get rid of something from it you'll have to use ClearAllActions() which removes all queued-up actions. The CancelCombat() function brings them out of combat mode as well without the usual 10 second cooldown.

 

The scripting language is very limited in that regard. The only things you can do with the action queue from it, aside from issuing new actions and clearing, is to lock it down to prevent new actions being added, or check what the action currently being performed is.

 

(Trying to make a decent AI in the KOTOR/TSL NWscript is mostly a huge series of workarounds and ugly tricks. I can understand why Obsidian didn't bother much with it if they didn't have the time to expand the scripting language. :))

Link to comment
Share on other sites

So there's not even a way to look at other actions in the queue other than the last in? I have no problem storing off, clearing and then rebuilding the action queue if that's possible.

 

Unfortunately not, you can only see what the action that is currently being performed is. The only way I can think of around it (in a controlled environment) would be to keep a list of what actions should be performed and then issue them to the action queue one at a time when the prior action has finished executing. That way you'd only keep one action in the queue at any given time, and keep track of what should be performed elsewhere.

 

Since you can place custom functions on the action queue via ActionDoCommand() you could use that to run a script whenever the current action in the queue has finished executing.

Link to comment
Share on other sites

Sadly I'd need to do this in a non-controlled environment where the user can specify actions on the queue, which I don't see a way to do...

 

That might cause complications when using workarounds, yes.

 

What is it you are trying to do? Remove player-assigned actions from the action queue? You can lock the action queue which should prevent the player from adding more actions to it if you need them to act on auto-pilot during some scene.

Link to comment
Share on other sites

Ideally? Here's the scenario I'm trying to find a workaround for:

The player, controlling Bao-Dur, pauses, and assigns the following actions:

1) Attack force field

2) Do anything #1

3) Do anything #2

I'm trying to modify this so that in the UserDef OnCombatRoundEnd I look at the next action and if it's an attack against a forcefield (GetObjectType == ffield in genericdoors.2da), I clear that action and replace it with a walk to door and play shield breaker anim. However given that there is no way to clear the next action without wiping out 2 & 3 I am reticent to do so.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...