Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: Igorrr on July 27, 2004, 07:29:07 AM

Title: new Direct Control Script idea...
Post by: Igorrr on July 27, 2004, 07:29:07 AM
I have an idea to improve the Direct Control Script, but I need some help...

The problem with the current script most of all is that the waypoints are considered when the actor is walking using the direct control.
But I want the actor to ignore the waypoints when using the direct control.

Instead of having the actor "walking" by using the GoTo function you can have the actor walk ignoring the waypoints by using the PlayAnim function instead.
Problems of course are that because of the looping the actor won't stop moving and at the same time also ignores the unwalkable areas.
So in some way while he is "walking" you have to make sure that he stops short before reaching a unwalkable area and also find a way to interrupt the movement anyhow.

I've tried this out and it works more or less:
Code: [Select]
     if (actor.Ready==true) actor.PlayAnimAsync("actors/knight/up/move_up.sprite");
     if (actor.Ready==true) actor.PlayAnimAsync("actors/knight/down/move_down.sprite");

The problem here is if I want to walk down while he is walking up he will first finish walking up before walking down.
Also I don't believe the loop will end if I interrupt with any other key. First when the actor reaches a not walkable area. (right??)

Does anyone have any idea how to solve this?
Title: Re: new Direct Control Script idea...
Post by: Mnemonic on July 27, 2004, 07:59:04 AM
Ok, how about this?

(warning: quick&dirty code ahead)
#include "scripts\"
#include "scripts\"

var TargetX, TargetY;

var LastDir = -1;
var CurrentDir = -1;

Title: Re: new Direct Control Script idea...
Post by: Igorrr on July 27, 2004, 08:24:55 PM
Mnemonic YOU'RE A MACHINE!!!

It works really sweet!!! Much better than the old script.
I added a Game.Interactive query to have the actor only perform the action if the game is interactive.
The problem is the script alone sometimes makes other scripts stop abruptly.
I handled that problem by detaching the script everytime I set the game to NOT interactive.
It works flawlessly now, but I wonder if my solution was elegant...
Title: Re: new Direct Control Script idea...
Post by: tinchopunk on December 08, 2004, 04:24:14 AM
how can improve this to 3dcharacter???
move with the keys...
Title: Re: new Direct Control Script idea...
Post by: SOLO on August 15, 2012, 11:19:56 PM
     I am using your Direct Control Script Mnemonic and it works great but I want it only to work when Game.Interactive =true;
I have it at the moment attached in Project Manager should I have it attached to the ACTOR script?

It works to a degree but stops other scripts running properly how can this be overcome, I see from a historic topic the IGORR did this but I cannot figure it out.........

Any help would be great!

As always........ Thanks

Its OK I have sorted this myself with the detach and attach script commands that IGORR mentioned.