Setting and using quest variables as conditions

Post » Sat Dec 29, 2012 2:38 pm

In my endeavor to learn, one thing I would like to learn is using variables in my quests. For example, a simple scenario could be you talk to one of my actors and they ask you "what is your favorite color" from several possibilities:

Red, Blue, Green, Yellow, Brown, Black, White, Purple

Now, lets say I said blue. Then later on in the quest someone says to you "I hear your favorite color is blue," and they give you a blue outfit or another item of some sort. Or there could be other dialog possibilities or options based on your choice of blue, using that variable as a condition to make the dialog valid. Or if you chose red, a different dialog would be valid.

I've never done this yet but would like to learn, but I assume it's all handled in your quest script? So how do I go about doing it? (I think one way to do the same thing would be to create a global for each color, and set it's value to 1 and use that in my conditions, but I think that might be a quirky to do it.)

Thanks!
User avatar
Marlo Stanfield
 
Posts: 3432
Joined: Wed May 16, 2007 11:00 pm

Post » Sat Dec 29, 2012 3:12 pm

"what is your favorite color"
Red! No, gree-aaaaaaahhhhhhhhhhhhhhhhhhhhhh *splattt*

To use quest properties in the condition system, flag your quest script and the desired properties with the 'Conditional' flag.
ScriptName YourQuestScript Extends Quest ConditionalInt iColor Property Auto Conditional
...then in the condition dropdown box, select GetVMQuestVariable and you'll be able to select any conditional variables.
User avatar
Rinceoir
 
Posts: 3407
Joined: Thu Jun 29, 2006 1:54 am

Post » Sat Dec 29, 2012 1:43 pm

Red! No, gree-aaaaaaahhhhhhhhhhhhhhhhhhhhhh *splattt*

To use quest properties in the condition system, flag your quest script and the desired properties with the 'Conditional' flag.
ScriptName YourQuestScript Extends Quest ConditionalInt iColor Property Auto Conditional
...then in the condition dropdown box, select GetVMQuestVariable and you'll be able to select any conditional variables.

Wow. I just realized how often I've made my life unnecessarily difficult.
Sigh.

Thanks again Justin.
User avatar
Allison Sizemore
 
Posts: 3492
Joined: Wed Jul 19, 2006 6:09 am

Post » Sat Dec 29, 2012 5:27 pm

OK, lets see if I got yhis right. I added a new script to my quest with the conditional variable, but the property is not filled. When I clicked on it to fill it had Int value that I could set. Should I leave it unfilled or set it to zero? Then in my dialog choices I need to set this value, right? So my fragments for each color choice would have something like:
 iColor.Value = http://forums.bethsoft.com/topic/1433730-setting-and-using-quest-variables-as-conditions/1 ;for red iColor.Value = 2 ;for blue iColor.Value = 3 ;for green

...and so on for each of the options the player might select for their color?

Then in the dialog that is conditioned on these options, use GetVMQuestVariable, select my quest and the iColor variable, then select the value that corresponds with the color selected? That's too easy!
User avatar
Kathryn Medows
 
Posts: 3547
Joined: Sun Nov 19, 2006 12:10 pm

Post » Sat Dec 29, 2012 4:45 pm

Bingo!
User avatar
Karl harris
 
Posts: 3423
Joined: Thu May 17, 2007 3:17 pm

Post » Sat Dec 29, 2012 12:08 pm

Wow. I just realized how often I've made my life unnecessarily difficult.
Sigh.

Thanks again Justin.
Before you start celebrating, you can only use numerical values in conditional properties. It's handy, but it could be better.
User avatar
Alisha Clarke
 
Posts: 3461
Joined: Tue Jan 16, 2007 2:53 am

Post » Sat Dec 29, 2012 4:43 am

Bingo!

Cool, a couple of last things. Do I fill the property on my quest script and leave the value at zero, or leave it unfilled? Secondly, what does the "VM" stand for in "GetVMQuestVariable," and is the "i" in "iColor" just there so you'll know it's an integer type?

Thanks JO!
User avatar
Susan
 
Posts: 3536
Joined: Sun Jun 25, 2006 2:46 am

Post » Sat Dec 29, 2012 12:43 pm

Property: Leave it unfilled or set to 0

VM: Virtual Machine

'i': Yeah, to follow the official argument/variable nomenclature. a : Argument :: b : Bool :: f : Float :: i : Int :: k : Form/Alias :: s : String :: u : Unsigned. Sometimes you'll see 'p' for Pointer rather than 'k', but Papyrus doesn't actually have pointers. 'r' can mean Reference, but references are forms so 'k' is more semantically correct.
User avatar
Annick Charron
 
Posts: 3367
Joined: Fri Dec 29, 2006 3:03 pm


Return to V - Skyrim