Hi there Guys
This is the small problem i have.
I have a gate in my game. It is currently locked I want my character to talk to the guard and get him to open it. Can u guys help me with the scripting of this please.
Cheers
Well, that's rather simple. First of all, put this code into the "Interact with Door" section:
if (GetGlobalInt(1)==0) player.Say("I can't. It's locked."); //or something like that
else player.ChangeRoom(3); //whichever room you want the gate to lead to
You can use other global ints and values, too, but you get the idea.
Now, set up the dialog with the guard just as you would normally. In the option that leads to him unlocking the gate, you need the following.
ego: ... and that is why I need you to unlock the gate.
guard: I'm convinced!
run-script 1
option-off 5
return
Or probably more refined dialog and a different number (especially after option-off; it should be the number of the option that causes the guard to unlock the door); that's up to you. Now, in dialog_request:
if (parameter==1) {
//probably some sort of animation of the guard walking over to the door and unlocking it, but it's not needed
SetGlobalInt(1,1);
player.Say("Thanks!");}
And you're good to go. :)
Can't you set global ints directly in dialog scripts without using the dialog request function?
Just looked it up in the manual and yes, you can use
set-globalint 1 1
too. Nice. Learned something today.
Thank you so much for your help guys it works perfectly now cheers.