I've run into a strange problem. What I want to happen is the character changes rooms right after a certain dialog takes place.
I've done the dialog request function in the global script. When the NPC says something in the dialog editor, I have run-script 3 which triggers the variable. In the interact with hot-spot, that's where the whole thing starts. And where I have the variable that if the dialog takes place the player character changes room. But I'll go through the interaction, and then the proper dialog sequence, and then...nothing happens.
Obviously I'm not doing this quite right. And the way I understand it, it should work.
I'd appreciate any help I can get on this.
Best to show code if your using code to do it?
Here's what I have:
Global script:
int to_jail;
export to_jail;
function dialog_request(int parameter) {
if (parameter==1)
to_jail=1;
}
Script header:
import int to_jail;
(I interact with a door in Room 15. NPG walks on screen and we have a conversation. At a point in the conversation, I want my player character to go to Room 16.)
Dialog editor:
ORT: Is that a fact?
run-script 1
stop
Interaction editor in Room 15:
if (to_jail==1) {
character[EGO].ChangeRoom(16, 218, 200);
}
That's about it. Am I doing something wrong?
You only wrote "Interaction editor in Room 15:", which interaction did you actually put those codes in?
It's in the "Interact hotspot" script.
Change it to "repeatedly_execute".
Otherwise you need to interact with the hotspot a second time for the room change.
Okay, I tried putting
"if (to_jail==1) {
character[EGO].ChangeRoom(16, 218, 200);
}"
in repeatedly_execute of the Room Editor. Still nothing happens when I finish that dialog.
Place a display line in dialog_request and check if the function was indeed get called, and if the variable was set correctly:
function dialog_request(int parameter) {
Ã, if (parameter==1)Ã, to_jail=1;
Ã, Display("to_jail=%d",to_jail);
}
Why not just put
character[EGO].ChangeRoom(16, 218, 200);
in the dialog_request script ?
Gilbot, I did what you said and once the dialog was finished, I would get a display that read: "to_jail=1". And then nothing else.
Wretched, I tried your suggestion and it worked perfectly. I still don't know why it wouldn't work the other way, but I'm content with the results.
Thanks for the help everyone.
Quote from: sloppy on Mon 14/11/2005 14:24:29I still don't know why it wouldn't work the other way
Did you create the room's rep_ex function using the interaction editor? Putting a "repeatedly_execute" function directly into the room script doesn't work at the moment (http://www.adventuregamestudio.co.uk/tracker.php?action=detail&id=514).
Quote from: Wretched on Mon 14/11/2005 08:10:18
Why not just put
character[EGO].ChangeRoom(16, 218, 200);
in the dialog_request script ?
what is the dialog_request script ? Im having the same problem
http://www.adventuregamestudio.co.uk/yabb/index.php?action=search