Is it possible to set a variable's value to something else in the dialog script?
I think it might look like this.
option 1 clicked
EGO: Hello
SetVariableValue (Variable1, 2)
Something like that but I don't know what script to type, where to put it or if it's possible.
You can set GlobalInts using set-globalint GI VAL (e.g. set-globalint 5 3). To set other variables, or do anything not directly supported in dialogs, you need to look up run-script x and dialog_request, which is explained in the BFAQ. (http://bfaq.terran-x.com/#coding02)
What if I have scriptophobia and need people to tell me EXACTLY what to do and EXACTLY what script to write?
I just realised that I haven't actually said what I need to do in the game I'm making. In my game, I want the following things to happen. When you choose a specific dialog option and click on it. Not only will the character say the words, it will also change a variable's value to 2.
Quote from: Anon. on Fri 04/03/2005 22:53:54
need people to tell me EXACTLY what to do
Do you
know how tempting that is?
I'm faily sure this is all in the manual, whcih you really should've read. Anyway, to reiterate:
If you want to set a Global Int, use
set-globalint GI VAL, e.g.:
option 1 clicked
EGO: Hello
set-globalint 1 2
If you want to use an int you created yourself, you need to use
run-script x and
dialog_request which is explained in the BFAQ. (http://bfaq.xylot.com/#coding02) Note how the words "in the BFAQ" (http://bfaq.xylot.com/#coding02) are actually a link, taking you to the place in the BFAQ (http://bfaq.xylot.com/#coding02) that explains
run-script x and
dialog_request. It also explains creating your own variables (http://bfaq.xylot.com/#coding01). That's about as detailed as I can get, without knowing what variable you want to change.
Ah, what the heck:
option 1 clicked
EGO: Hello
run-script 1
Then, insert this somewhere in the global script (unless it already exists):
function dialog_request(int param) {
if (param==1) {
Variable1 = 2;
}
}
Formally 'Anon.'...
Thanks a bunch (not sarcastic)
It works now.