Please login or register.

Login with username, password and session length
Advanced search  

News:

Forum rules - please read before posting, it can save you a lot of time.

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - kypho

Pages: 1 2 [3]
31
Technical forum / Re: Idle intelligence
« on: October 24, 2008, 08:54:19 AM »
Hey Catacomber!

Thanks, I think it works with this new piece of script :)


32
Technical forum / Re: Idle intelligence
« on: October 24, 2008, 08:48:17 AM »
Hi Folks, thanks for your quick response!

Hmm...the actor.IsTalking thing is something I just tried to fix it, actually I guess it should be actor.IsTalking(true) or something cos it's a game's basic functions (or is it?). This function as read in help file should return true value if actor is talking. But again I am not sure. So should I try to make a variable which contains the information about talking (true/false) in my npc script and then somehow use it in actor script. Of course I should also initialize that global variable in script_init? I tried this before, but I couldn't do it right :/

- Kypho the beginner

33
Technical forum / Idle intelligence
« on: October 23, 2008, 07:55:35 PM »
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

Pages: 1 2 [3]

Page created in 0.037 seconds with 18 queries.