Dialog puzzle

Started by , Tue 20/01/2004 08:09:57

Previous topic - Next topic

HELPME

I want to do a dialog puzzle but don't know how. I want it to be able to do this: Go into a room, pick up an object but a character won't let you. Talk to the character. When you get to a certain dialog topic you can pick up the object.

I have all the necessary dialogs, I have the object, the room etc.. but I don't know how to do what I want.
Is there a way to have a variable in the dialog script? Please somebody help me, I'm dying...(well not really, that was just for dramatic effect).

Ishmael

Using:



set-globalint GI VAL
Changes text script GlobalInt number GI to have the value VAL. This is equivalent to the SetGlobalInt text script command, and allows you to quickly set things without having to go through a run-script just to set an int value.

dialog script



SetDialogOption
SetDialogOption (int topic, int option, int new_state)

Changes whether an option in a conversation is available to the player or not. This allows you to add extra options to a conversation once the player has done certain things.
TOPIC is the topic number, from 0 to the number of topics - 1. Find this out in the Room Editor.

OPTION is the option number within that topic, from 1 to whatever the highest option is for that topic.

NEW_STATE controls what happens to this option. It can have the following values:

0   The option is disabled - the player will not see it
1   The option is enabled - the player can now see and use it
2   The option is permanently disabled - no other command can ever turn
   it back on again.

These are equivalent to the option-off, option-on, and option-off-forever dialog commands.
Example:

if (GetGlobalInt(10)==1)
   SetDialogOption(4,2,1);  

will enable option 2 of topic number 4 if the Global Integer 10 is 1.

global script, in dialog_request or so



Any luck?
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

HELPME

I can't get it to work. I thought the top thing was what I wanted, I put it in but it didn't work....

Ishmael

Ok, lets see again:

You have 1 topic, which has all the needed options. Lets say we have topic number 5 here.

* Options 1, 2, 3, 4 and 12 are visible in start.
* Options 1, 3 and 4 are dead-ends. Option 12 is the "goodbye" option.
* Option 2 opens options 5, 6 and 7 and closes options 1, 3 and 4 - if they aren't closed already. (Option 12 still visible)
* Options 5 and 7 are dead ends.
* Option 6 opens options 8, 9, 10 and 11. (Option 12 visible aswell)
* Options 8 and 11 are ead ends.
* Option 9 ends the conversation on a quarrel. This activates option 13 and disables all other * options, so next time the dialog is run, option 13 is ran automatically.
This option 13 runs to clear the quarrel and returns to the last option list. (Options 8, 10, 11 and 12)
* Option 10 ends the conversation, allows the player to pick up the item, and sets the dialog to "off", so it can't be ran anymore.

How to script it?

Well, like this:



@S // Dialog Start point.
return // put just return, so we can easily change the start of the conversation.

@1 // Option of the 1st list, dead end
man: blah
ego: blah
man: blah
ego: blah
option-off-forever 1
return

@2 // Option of the 1st list, opens 2nd list
man: blah
ego: blah
man: ok
option-off-forever 1
option-off-forever 2
option-off-forever 3
option-off-forever 4
option-on 5
option-on 6
option-on 7
set-globalint 17 1
return

@3 // Option of the 1st list, dead end
man: blah
ego: blah
man: blah
ego: blah
option-off-forever 3
return

@4 // Option of the 1st list, dead end
man: blah
ego: blah
man: blah
ego: blah
option-off-forever 4
return

@5 // Option of the 2nd list, dead end
man: blah
ego: blah
man: blah
ego: blah
option-off-forever 5
return

@6 // Option of the 2nd list, opens 3rd list
man: blah
ego: blah
man: ok
option-off-forever 5
option-off-forever 6
option-off-forever 7
option-on 8
option-on 9
option-on 10
option-on 11
set-globalint 17 2
return

@7 // Option of the 2nd list, dead end
man: blah
ego: blah
man: blah
ego: blah
option-off-forever 7
return

@8 // Option of the 3rd list, dead end
man: blah
ego: blah
man: blah
ego: blah
option-off-forever 8
return

@9 // Option of the 3rd list, end dialog, close others, open option 13
man: blah
ego: blah
man: blah
ego: **** **** ****
man: *** ****
option-off-forever 9
option-off 8
option-off 10
option-off 11
option-off 12
option-on 13
stop

@10 // Option of the 3rd list, end and disable dialog, allow player to pick the object
man: blah
ego: blah
man: ok, whatever, go ahead.
ego: Thanks
option-off-forever 8
option-off-forever 9
option-off-forever 10
option-off-forever 11
option-off forever 12
option-off-forever 13
option-off-forever 14
option-on 14
set-globalint 17 3
stop

@11 // Option of the 3rd list, dead end
man: blah
ego: blah
man: blah
ego: blah
option-off 11
return

@12 // "Goodbye" message
man: see you
option-off 1
option-off 2
option-off 3
option-off 4
option-off 5
option-off 6
option-off 7
option-off 8
option-off 9
option-off 10
option-off 11
option-off 12
option-on 14
stop

@13 // dialog entry after option 9 has been selected
ego: sorry
man: balh
ego: blah balh
man: ...
ego: blah blah blah sorry blah
man: ok, I forgive.
option-off-forever 13
option-on 8
option-on 10
option-on 11
option-on 12
return

@14 // original dialog entry
run-script 1
return

@15 // dialog entry after option 10
narrator: The man looks like he doesn't want to talk with you right now.
stop




and, to the global script, add (unless you already have dialog_request. In that case just change the call numbers and add the clauses.):

function dialog_request(int val) {
if (val == 1) {
 if (GetGlobalInt(17) == 0) { // the 1st list
  SetDialogOption(5,1,1);
  SetDialogOption(5,2,1);
  SetDialogOption(5,3,1);
  SetDialogOption(5,4,1);
  SetDialogOption(5,12,1);
 } else if (GetGlobalInt(17) == 1) { // the 2nd list
  SetDialogOption(5,5,1);
  SetDialogOption(5,6,1);
  SetDialogOption(5,7,1);
  SetDialogOption(5,12,1);
 } else if (GetGlobalInt(17) == 2) { // the 3rd list
  SetDialogOption(5,8,1);
  SetDialogOption(5,9,1);
  SetDialogOption(5,10,1);
  SetDialogOption(5,11,1);
  SetDialogOption(5,12,1);
 } else if (GetGlobalInt(17) == 3) { // permission to pick the object
  SetDialogOption(5,15,1);
 }
 if (GetGlobalInt(17) < 3) {
  SetDialogOption(5,14,0);
  DisplaySpeech(MAN,"Waddaya want?");
 }
}
}



And in the "Pick up object" script check if GlobalInt 17 is 3, if it isn't run the dialog, if it is, get the object.




I belive...
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

SMF spam blocked by CleanTalk