Controlling an NPC

Added by David Burden over 1 year ago

Having got the chatbot working I now want to have a non-player character in the scene. I tried the example in avatar-scripted-movement.imml with characterplugin:move(vector3(0,0,5)) but that does nothing with its single avatar. And even if it worked then if I drop that code in an existing scene with my PC avatar controlled by me then how does it know which avatar to control with characterplugin:move (and BTW where can I find the documentation for the characterplugin plugin so I know what other methods are available?)

I've managed to move the NPC avatar quite happily with scene:getelement('AV-Chloe').position = vector3(-4.440683,3.46736,10) but of course that's just an instant movement.

Thanks

David


Replies (6)

RE: Controlling an NPC - Added by Jeremy Massey over 1 year ago

Hi David,

I attempted to put together a sample for you, however it seems the :move() method is no longer functioning. I'll ask one of our developers to look into this and get back to you.

Alternatively, you could use an avatar which contains animation in the asset along with timelines to move the avatar through the scene. I've attached an example avatar demonstrating this behaviour.

Clicking the avatar model enables the first timeline, which causes the avatar to walk forward, pause, turn, and walk back.

RE: Controlling an NPC - Added by David Burden over 1 year ago

Thanks, glad it wasn't just me!

Alternate route will do for a start to prove the concept, but be great to get move() working.

BTW are there any good links to the XML functions you've implemented in LUA - looks like LUA has lots of different XML solutions.

David

RE: Controlling an NPC - Added by Craig Presti over 1 year ago

David Burden wrote:

BTW are there any good links to the XML functions you've implemented in LUA - looks like LUA has lots of different XML solutions.

If you are referring to things like the Timeline element in IMML, I'd suggest to download ImmlPad or the Creator as they both feature auto complete as you type.

The IMML schema is also well documented and available in the public SVN repository: http://vastpark.svn.cvsdude.com/common/trunk/src/legacy-slimdx/Imml/Imml/Source/imml.xsd

There is a PDF with information on VastScript (Lua) here: http://vastpark.org/attachments/download/44/VastScript_API.pdf

Each plugin has it's own API, we don't have nice UI for displaying the functions just yet unfortunately, but you could use something like reflector to find the public properties and methods.

RE: Controlling an NPC - Added by David Burden over 1 year ago

Craig

Thanks for the XSD link, could be useful, but not what I was after re XML. What I was after was things like:

text = xdoc.documentelement['an']['dam']['d'].innertext
and
options = xdoc:selectnodes('/xml/an/links/o')

for manipulating XML documents and which I had to more or less guess at given a combination of LUA and XPATH fragments out on the web. Do you know what other methods xdoc takes?

David

RE: Controlling an NPC - Added by Craig Presti over 1 year ago

David Burden wrote:

Craig

Thanks for the XSD link, could be useful, but not what I was after re XML. What I was after was things like:

text = xdoc.documentelement['an']['dam']['d'].innertext and options = xdoc:selectnodes('/xml/an/links/o')

for manipulating XML documents and which I had to more or less guess at given a combination of LUA and XPATH fragments out on the web. Do you know what other methods xdoc takes?

David

Ah, understand.

Try MSDN - the xmldocument class we provide LUA is almost the exact same class as the .NET one, the main difference is that we've blocked loading from and saving to disk - you should use scene.user.savefiledialog/openfiledialog instead for this

RE: Controlling an NPC - Added by Jeremy Massey over 1 year ago

Hi David,

David Burden wrote:

Alternate route will do for a start to prove the concept, but be great to get move() working.

A working example of the move() and rotate() feature of the Avatar Controller plugin has been uploaded to the wiki.

avatar-scripted-movement.imml
http://www.vastpark.org/wiki/vp/Working_with_IMML

Jeremy

(1-6/6)