PDA

View Full Version : adding actions in front of actionlist


IGoudt
01-25-2010, 07:17 AM
Hello,

I know that {avatar}.addAction adds an action pending in the end of an actionqueue, waiting to get handled. Now, in my project I would like to edit the pending actionqueue, in particular: add an extra action in front of the actionlist.

For example I would have this scenario:

avatar.addAction(walkToBar)
avatar.addAction(orderAdrink)
avatar.addAction(drink)

but, considering above scenario, I would like to be able to edit this on the fly (by A.I. of the avatar) to for example:

avatar.addAction(walkToBar)
avatar.addAction(orderAdrink)
avatar.addAction(drink)

while the avatar is performing the walktoBar action, but on his path he meets a friend. Then I would like to change his actionqueue to:

- talk with friend
- walk to bar (continue the walk or restart a walk action)
- order a drink
- drink

Is this possible in the current node3d/avatar implementation, or would I have to change my already inherited avatar class by extending it with a new sort of InsertAction()?
Pseudo:

todoActions = avatar.getActionList()
avatar.clearActions()
avatar.addAction(newAction)
avatar.addAction(todoActions)

Another question I would like to ask is what 'pools' are with respect to actions. The helpfile is not totally clear on that. Does vizard run multiple pools on an object simultaneously or after each other (first all actions in pool
1, then in 2, etc..)

Thanks!

Jeff
01-25-2010, 10:55 AM
You would need to do something like your InsertAction code there and call a clearActions or runAction command and then add your list of actions again.

The different pools will be executed simultaneously so you can have actions running in parallel on an object.