Hi everybody on this Forum!
I have a very very veeery basic problem. My actor goes to idle state when he is talking with another character/npc. How to prevent this from happen? I have tried different things but all the time idle state turns on and the talking starts. I have tried with the following idle code (the same as in tutorial):
include "scripts\base.inc"
var IsIdle = false;
var IdleStartTime = 0;
while(true) // endless loop
{
if(actor.Ready) // is the actor doing something
{
if(!IsIdle)
{
// actor enters idle state
IsIdle = true;
IdleStartTime = Game.CurrentTime;
}
else if(Game.CurrentTime - IdleStartTime > 5000) // is the actor idle for 5 seconds
{
IdleStartTime = Game.CurrentTime;
actor.ApplyEvent("idle");
}
}
else IsIdle = false; // actor is busy; set IsIdle to false
Sleep(100); // wait for 100 milliseconds
}
////////////////////////////////////////////////////////////////////////////////
on "idle"
{
// do some idle processing here
actor.Talk("ZzzZZz...Yawn!");
Sleep(1000);
actor.Talk("Huoh!");
Sleep(1500);
actor.GoTo(Random(0, 1000), Random(0, 600));
}
////////////////////////////////////////////////////////////////////////////////
I have tried to put something like this:
if(!IsIdle && !actor.IsTalking)
to make the if sentence have AND operator...but unfortenately this doesn't work...I have also tried to make boolean variable for contain the true/false value when the actor is talking/not talking and then use that variable in that if statement, but can't get it rolling yet...
So if somebody has solved a problem like this before please help, cos I don't want my actor say zzz when talking to some npc.
Thanks
- Kypho the beginner