Mnemonic you are the man!! :-)
Now it works perfectly!
Now i have inserted another NPC, i call it "guard1" coz it's going to be one of the guards, and whenever the main actor gets too close to the exit of the camp, guard 1 says "YOU DON'T WANNA GO THAT WAY, PAL..." and then walks up to where the actor is.
The problem is that after guard1 reached the actor for some reason he repeats again his line and the both of them seem to be stuck in their Talk animation forever and the main actor is unable to move. Also for some reason when that happens, guard1 is on the foreground of everything...
lol sorry man, looks like i'm monopolizing you!
here is guard1 script:
#include "scripts\base.inc"
///////////////////////////////////////////////////////////////////////////////
global StateRoom;
global guard1;
global Idle;
////////////////////////////////////////////////////////////////////////////////
on "Talk"
{
actor.GoTo(Scene.MouseX, Scene.MouseY);
actor.TurnTo(this);
this.TurnTo(actor);
Game.Interactive = false;
// greetings
if(!StateRoom.TalkedToNPC) actor.Talk("*stares*");
else actor.Talk("...");
this.Talk("what are you staring at?");
// set the flag, so that we know we've already talked to him
StateRoom.TalkedToNPC = true;
// and let the dialogue begin
NPCDialogue();
// restore interactivity
Game.Interactive = true;
}
////////////////////////////////////////////////////////////////////////////////
function NPCDialogue()
{
var Responses;
var Selected;
var Loop = true;
while(Loop)
{
// prepare the sentences
Responses[0] = "just wondering what's up...";
Responses[1] = "What are you doing here?";
Responses[2] = "i hear we have a new guest around here...";
Responses[3] = "yeah... see ya.";
// fill the response box
Game.AddResponse(0, Responses[0]);
Game.AddResponse(1, Responses[1]);
Game.AddResponse(2, Responses[2]);
Game.AddResponse(3, Responses[3]);
// let the player choose one
Selected = Game.GetResponse();
// let the actor say the selected sentence
// (that's why I use the array for storing the sentences)
actor.Talk(Responses[Selected]);
// this.GoTo(1000, 500);
// this.TurnTo(actor);
// now let the guard reply depending on the selected sentence
if(Selected==0)
{
this.Talk("mind your business, pal.");
actor.Talk("...");
}
else if(Selected==1) this.Talk("Look i'm working here, beat it.");
else if(Selected==2)
{
this.Talk("news get around quickly... yeah we got another one of those animals in the wastes around here.");
// go to the second branch of dialogue
NPCDialogue2();
}
else if(Selected==3)
{
this.Talk("don't make any trouble, pal, i'm watching you.");
Loop = false; // we want to end the dialogue
}
}
}
////////////////////////////////////////////////////////////////////////////////
function NPCDialogue2()
{
var Responses;
var Selected;
var Loop = true;
while(Loop)
{
// prepare the sentences
Responses[0] = "so...?";
Responses[1] = "What's he's called?";
Responses[2] = "i see..";
Responses[3] = "mmh...";
// fill the response box
Game.AddResponse(0, Responses[0]);
Game.AddResponse(1, Responses[1]);
Game.AddResponse(2, Responses[2]);
Game.AddResponse(3, Responses[3]);
// let the player choose one
Selected = Game.GetResponse();
// let the actor say the selected sentence
// (that's why I use the array for storing the sentences)
actor.Talk(Responses[Selected]);
// now let the NPC reply depending on the selected sentence
if(Selected==0)
{
this.Talk("What's it it to you?.");
//this.GoTo(990, 600);
//this.TurnTo(actor);
this.Talk("you all look alike, you damn mutants, how the hell am i supposed to know?");
actor.Talk("*right...*");
}
else if(Selected==1)
{
this.Talk("No one is allowed near him for now, we have reason to believe he's infected.");
actor.Talk("I see.");
}
else if(Selected==2)
{
this.Talk("i don't know.");
this.Talk("Are we done with the questioning?");
actor.Talk("sure...");
}
else if(Selected==3) Loop = false;
}
}
////////////////////////////////////////////////////////////////////////////////
on "LookAt"
{
actor.GoTo(Scene.MouseX, Scene.MouseY);
actor.TurnTo(this);
this.TurnTo(actor);
if(!StateRoom.TalkedToguard1) actor.Talk("A guard, i wonder if he knows what's going on with the new guy.");
else actor.Talk("One of those dumb guards.");
}
////////////////////////////////////////////////////////////////////////////////
on "Take"
{
actor.GoTo(Scene.MouseX, Scene.MouseY);
actor.TurnTo(this);
this.TurnTo(actor);
this.Talk("Try anything funny and i'll open a can of whoop on your ass.");
}
////////////////////////////////////////////////////////////////////////////////
on "LeftClick"
{
actor.GoTo(Scene.MouseX, Scene.MouseY);
actor.TurnTo(this);
this.TurnTo(actor);
}
////////////////////////////////////////////////////////////////////////////////
and here is the redzone script (the region that triggers guard1's behavior):
#include "scripts\base.inc"
global NPC;
global guard1;
////////////////////////////////////////////////////////////////////////////////
on "ActorEntry"
{
actor.Talk("...whistles...*");
guard1.TurnTo(actor);
guard1.GoTo(actor.X,actor.Y);
guard1.Talk("YOU DON'T WANNA GO THAT WAY, PAL");
}