Help required with SetDialogOption

Started by JudasFm, Thu 13/11/2003 10:56:47

Previous topic - Next topic

JudasFm

I'm not sure if this belongs here or in the Technical Forum, but I'll start here :)

I want to know how to enable an option in a separate topic.  So far the story's this:

The character has gone to a door and been asked by a guard for a password, which they don't know.  They then do a favour for an NPC fighter in a different room who tells them the password.

I've got the password option written in the Dialogs section.  What I don't know is how to enable it from when the fighter gives it to you.  Any help...?

MrColossal

i do believe this is what you want, from the manual:

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.
See Also: GetDialogOption, RunDialog, StopDialog



good luck

eric
"This must be a good time to live in, since Eric bothers to stay here at all"-CJ also: ACHTUNG FRANZ!

JudasFm

Maybe I should have been slightly clearer; I meant I've read that part in the manual, I basically understand what it's saying but have no idea how to insert it into the script ???

Ishmael

Read the FAQs, KBs etc? There's surely told how do you script things... and the scripting tutorial in the manual...
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.

JudasFm

Again, perhaps I should have mentioned this earlier, but to be honest, I thought it was taken as read that if someone posted a request for help on these forums, they'd already checked the manual, FAQs, KB etc.  I've also looked at some third-party tutorials but they don't answer my question either.  Can someone out there please help me? :)

Ishmael

Well, in the dialog script of the topic, where you aquire the password, put

run-script 1

where you want the option to be enabled, and then createa new function to the global script like folllows:

function dialog_request (int xval) {
if (xval == 1) {
SetDialogOption(a, b, 1);
}
}

where you replace the a with the password query topic number, the b with the option number.
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.

JudasFm


SMF spam blocked by CleanTalk