hi guys...i've just started programming with ags but i can't find out if it is possible to set conditions in a dialogue; such as: i want that after the player got the "BEER" item in his inventory,if the player talks to the barman he won't show "Here's a beer" but "You already got one!".
so..
is there a way to create an if/then/else funcion in the dialogue scripting?
thanks!
Cisco
the way i do those kind of things, (dont know if it the best one) is to write both options in the dialog editor, and have the 'you already got one' disabled from start.
Then, when you get the beer, disable 'here is a beer' and enable 'you already...'.
I think the function for disabling/enabling dialog options is 'SetDialogOption'.
Normally this kind of thing is implemented using the option-on/off command. There is not an if-then-else construct in the dialog script language. However, you can use the run-script command to trigger the dialog_request() event handler function in the global script which can have if-then-else constructs and which can enable/disable dialog options using the SetDialogOption() function. Lookup the following in the help file:
- SetDialogOption()
- Dialog
- dialog_request()
From thehep file:
run-script X
Runs global text script function "dialog_request", with X
passed as the single parameter. This allows you to do
more advanced things in a dialog that are not supported
as part of the dialog script. The "dialog_request" function
should be placed in your game's global script file, as
follows:
function dialog_request (int xvalue) {
// your code here
}
thx guys! it worked!