Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

Dialogue Conditionals

Page: 1 of 1
 Ataris
11-29-2008, 3:55 PM
#1
What are the common dialogue conditional scripts?

Specifically for now I just want one that will turn on a new node after you've talked to the character once so that they don't give their monologue twice. Somehow I don't think that would be a good thing. >_>
 Star Admiral
11-29-2008, 4:59 PM
#2
This probably isn't the most efficient way to do it, but you could declare a global variable in globalcat.2da and then check to see if the variable is set to determine if the character should launch his monologue. The variable starts as 0, but once the character completes the monologue, set the variable to 1 to prevent a relaunch.

Use "c_global_eq" to check the variable, and use "a_global_set" to set the variable.

- Star Admiral
 stoffe
11-29-2008, 7:24 PM
#3
What are the common dialogue conditional scripts?

Specifically for now I just want one that will turn on a new node after you've talked to the character once so that they don't give their monologue twice. Somehow I don't think that would be a good thing. >_>

KOTOR1: put k_con_talkedto as conditional script name and k_act_talktrue as action script name on the dialog entry node that should only be available the first time the player talks to the NPC. (Greeting etc)

TSL: put c_talkedto as conditional script name and a_talktrue as action script name on the dialog entry node...
 Ataris
12-01-2008, 4:47 PM
#4
Actually I wanted something a bit more complicated. I have more than one nodes within the same dialogue I want using conditionals. For example:

1st time you talk: "Hey dude. Let's warp to the next module."
2nd time: "Welcome back. Do you want to warp to the next module?"
3rd time: "Welcome back. Are you ready?"

Hierarchy, I guess....
 Star Admiral
12-01-2008, 5:26 PM
#5
I haven't checked the scripts that stoffe mentioned, so I'm not sure if they can be used for this. They probably can, as I've only just started scripting and don't know what all the ingame scripts do yet.

To continue on the method that I use for my own upcoming mod, use the global variable again. For the first node, have it trigger only if the variable is set to 0. At the end of that branch, set the variable to 1. The second node will trigger only if the variable is set to 1. At the end of the second one, set the variable to 2. You can continue on for as many times as you like, each node incrementing the variable by 1.

Hope that it helps.

- Star Admiral
 Ataris
12-01-2008, 5:31 PM
#6
Well, I'll use that as a last resort. I would pick scripting over variables in this case.
 tk102
12-01-2008, 7:23 PM
#7
Think through what criteria you want to apply to each dialog node. Try drawing the hierarchy on paper if that helps along with little "if..then..." notes in the margins. Then take a look at nwscript.nss for pertinent functions that might be able to provide the needed information for the conditionals.

For example if you wanted to allow a certain dialog choice only if an item is possessed you might try using GetItemPossessedBy function. If you wanted the dialog only to appear within a certain module, you could use GetModuleFileName to check.

Global numerics are good for quest-type dialog trees, with each value of the numeric representing a different "state" within the quest, though these tend to make the quest designs more linear. But no one says you can't use more than one global. :)
Page: 1 of 1