Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: tinchopunk on December 28, 2004, 03:37:08 AM

Title: a lot of questions
Post by: tinchopunk on December 28, 2004, 03:37:08 AM
ok the first one...
I have my character in 3d moving with keys (thank´s new wme version) i want to run first with the shift key+up, if the character colision with an object say something and you can pick up with some key or look or anything but with keys, and other thing how can i make that i move with the character and change the scene but if i move over with the character... sorry with my bad english explanation.
thanks
 Martin
Title: Re: a lot of questions
Post by: Mnemonic on December 28, 2004, 04:13:13 PM
I think the best approach would be to use the "ActorEntry" event which is triggered when the actor enters a region. That way you can place regions on the floor neer your active objects and execute some code when the actor approaches your object. Same with scene exits.

I created a small demo which uses this approach to roughly mimic Monkey Island 4 interface.
You can download the demo here: http://dead-code.org/download/demos/direct_control_3d.zip

Unfortunately I forgot to implement the ActorEntry functionality for 3D characters before, so I also uploaded a modified wme.exe. Please dowload it and replace the old one in WME installation directory, otherwise the demo won't work.

http://dead-code.org/download/wme_latest.zip



Title: Re: a lot of questions
Post by: Orange Brat on December 28, 2004, 05:24:50 PM
The new demo download is dead.
Title: Re: a lot of questions
Post by: Mnemonic on December 28, 2004, 05:29:06 PM
Oops, wrong link, sorry. It should work now.
Title: Re: a lot of questions
Post by: tinchopunk on December 29, 2004, 03:38:36 AM
nice thats my solution for a lot of things...
the only one i don´t have it´s to run but a lot of work have to do now
THANKS
 MArtin
Title: Re: a lot of questions
Post by: Jerrot on December 29, 2004, 04:03:16 AM
nice thats my solution for a lot of things...
the only one i don´t have it´s to run but a lot of work have to do now

In your actor's definition (e.g. trinity.act3d) you can add another animation block for "running" for this purpose, just copy the walk animation block, name it "run" and enter the start/end frames for it.

To associate the running animation to some key combination, you will have to add it to Mnemonic's script example in scripts/direct_control.script. The only difference is, that you always have to set the current walking/running animation and the actor's velocity when you change between running and walking. You can do this by setting the new actor attributes "Velocity" (walking speed), "AngularVelocity" (turning speed) and "WalkAnimName" (your new animation's name). Check the docs here: Scripting in WME -> Script language reference -> 3D actor object.

Good luck :)
Title: Re: a lot of questions
Post by: Mnemonic on December 29, 2004, 09:18:44 AM
The only difference is, that you always have to set the current walking/running animation and the actor's velocity when you change between running and walking. You can do this by setting the new actor attributes "Velocity" (walking speed), "AngularVelocity" (turning speed) and "WalkAnimName" (your new animation's name). Check the docs here: Scripting in WME -> Script language reference -> 3D actor object.
Yes, that's the idea. In case of direct controls it's even simpler, because you can specify different animation and speed directly when calling the DirectWalk method.
Title: Re: a lot of questions
Post by: tinchopunk on December 30, 2004, 04:21:27 AM
ok thanks that really help
 MArtin
Title: Re: a lot of questions
Post by: tinchopunk on December 31, 2004, 12:36:06 AM
ok i can´t do that of running, i try but was imposible for me, i have an animation of my character running but i faild in the part of ataching a key (shift+arrow) so any help??
thanks
 AMrtin
Title: Re: a lot of questions
Post by: Jerrot on December 31, 2004, 11:12:37 AM
Hi tinchopunk,

ok i can´t do that of running, i try but was imposible for me, i have an animation of my character running but i faild in the part of ataching a key (shift+arrow) so any help??

Ok, let's say you already inserted your animation into the actor's definition file and named it "run", you have to edit the direct_control.script. It might work for you this way:

Code: [Select]
#include "scripts\base.inc"
#include "scripts\keys.inc"

var IsTurning;
var IsWalking;

while(true)
{
IsTurning = false;
IsWalking = false;

if(Game.Interactive)
{
if(Keyboard.IsKeyDown(VK_LEFT))
{
if (true == Keyboard.IsShift)
{
actor.DirectTurnLeft(600);
}
else
{
actor.DirectTurnLeft();
}
IsTurning = true;
}
if(Keyboard.IsKeyDown(VK_RIGHT))
{
if (true == Keyboard.IsShift)
{
actor.DirectTurnRight(600);
}
else
{
actor.DirectTurnRight();
}
IsTurning = true;
}
if(Keyboard.IsKeyDown(VK_UP))
{
if (true == Keyboard.IsShift)
{
actor.DirectWalk(120,"run");
}
else
{
actor.DirectWalk();
}
IsWalking = true;
}
if(Keyboard.IsKeyDown(VK_DOWN))
{
if (true == Keyboard.IsShift)
{
actor.DirectWalkBack(120,"run");
}
else
{
actor.DirectWalkBack();
}
IsWalking = true;
}
}

if(!IsWalking) actor.DirectWalkStop();
if(!IsTurning) actor.DirectTurnStop();

Sleep(20);
}

Hope this helps.
Title: Re: a lot of questions
Post by: tinchopunk on January 01, 2005, 12:25:59 AM
thanks that really help
 Martin