hi, here I am again, I have another little problem, this is about the talks, I have to talk with a NPC, lather I give some object and he says other dialogue, but the NPC doesn´t talks two diferent dialogues, I explain, change all their dialogue after giving the object.
this is the code have put in NPC.script:
global StateRoom;
global NPC;
on "Talk"
{
if (StateRoom.book==2)
{
actor.GoTo(880 ,700);
this.GoTo(550, 542);
Game.Interactive = false;
// greetings
if(!StateRoom.TalkedToNPC) actor.Talk("Hola");
else actor.Talk("Mmm");
this.Talk("Que narices quieres, tengo mucho trabajo");
// 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;
}
else if (StateRoom.book==1)
{
actor.GoTo(880 ,700);
this.GoTo(550, 542);
Game.Interactive = false;
// greetings
if(!StateRoom.TalkedToNPC) actor.Talk("Hola");
else actor.Talk("Mmm");
this.Talk("Que narices quieres, tengo mucho trabajo");
// set the flag, so that we know we've already talked to him
StateRoom.TalkedToNPC = true;
// and let the dialogue begin
NPCDialogue2();
// restore interactivity
Game.Interactive = true;
}
}
NPCDialogue is put after, in the book.script:
on "book"
{
Game.Interactive = false;
Game.DeleteItem("book");
StateRoom.book = 1;
Game.Interactive = true;
}
and in the Scene.init:
if(StateRoom==null)
{
StateRoom.Visited = false;
// add scene states here
StateRoom.TalkedToNPC = false;
StateRoom.book = 2;
}
i have create a variable called stateRoom.book that have two states, 1 or 2, depending if the actor gives the book or not, but dont work, only works after the actor gives to the NCP the book, if I talk before with the NPC dont talk