As I find it easier to reference a single thread here I go again. For anyone new to dialogue it probably contains many answers to common questions
For my own benefit here are some highlights of http://www.gamesas.com/index.php?/topic/976365-some-dialogue-questions/page__view__findpost__p__14106679 - many thanks to all the contributors of thread #1
Scripting Persuasion
The relevant snip of script:
short fondnessif ( getDisposition != fondness ) if ( fondness > 0 ) setDisposition fondness endIfendIf
And a bit of sample dialog:
"It's nice to hear you say such sweet things."
ID: NICI_Carrie, Disp: 75
[Global][Random100][>=][75]
[Function][Same six][=][1]
Result:
set fondness to fondness + 3
"You're going to make me blush."
ID: NICI_Carrie, Disp: 75
[Global][Random100][>=][50]
[Function][Same six][=][1]
Result:
set fondness to fondness + 2
The game engine would modify Carrie's disposition by some random amount when the player succeeds in persuasion with her. The bit of code above runs while the dialog menu is open and promptly undoes the dialog change. The game then looks up the dialog response. For the sample results shown above the results box alters Carrie's fondness variable. This triggers the the script to update Carrie's disposition. A bit cumbersome but it give the modder control of the NPC's disposition score. These two lines of dialog are placed above the line "I feel the same way. It's been some time now for me." in the Admire Fail section. (The filter [Global][Random100][>=][75] looks at a global variable that is rerolled by the game every frame - about 17 times per second or more)
Using Restart for Quests
The journal structure might look like this:
Index Type Text0 N Name of quest10 So-and-so needs my help.15 F I told So-and-so that I did not have time.20 I agreed to help So-and-so.25 R I decided to help So-and-so after all.100 F So-and-so thanked me for my help.
Journal entry 20 and 25 do not have to be different. The normal entry for accepting the quest could be the same as that recorded if the player first declines and later accepts. But in that case you would want to make the quest Restart at that point.
Using Variables in Dialogue
In the East Empire Company (EEC) quest, the player is supposed to have a Telvanni spy kill Canctunian Ponius by a scentless and tasteless poison. If the player decides to kill Ponius directly, an official enquiry will follow, and the Telvanni spy will have to flee. In that case, House Telvanni will lose its influence in the EEC completely.
Now, a scentless and tasteless poison is hard to find. It takes a master alchemist to make one, and neither Nalcarya of White Haven nor Abelle Chriditte are inclined to get involved in House politics and make one. So the player needs to find someone else. That someone was once a member of House Telvanni before he had to leave and hide from Therana. In order to persuade him to brew that poison, he'll demand a tower of his own, complete with guards.
Now there are three possible endings to that quest:
- The master alchemist gets his tower, brews the poison, and the Telvanni spy uses it to poison Canctunian Ponius.
- The master alchemist gets his tower, brews the poison, but the player decides to kill Canctunian Ponius by other means (or Ponius dies in an accident). The spy flees Vvardenfell.
- The master alchemist doesn't get his tower. The player kills Canctunian Ponius directly, or Canctunian has been dead from the beginning of the quest.
This situation is difficult to control by Journal entries alone, so I made global variables to keep track on the master alchemist's tower and on whether the spy takes over the EEC or flees Vvardenfell.
Let's get our hands dirty with some actual code:
The variables are called RoHT_EEC_status and RoHT_TelAzura_status. I added a global script to keep track of Canctunian Ponius' health:
begin RoHT_Canctunian_Script; this script checks, whether Canctunian is killed by the furtive poison or other means.; It is started by RoHT_advisor in the dialogue topic "imprudent activity"; global RoHT_EEC_status; This variable is set by RoHT_advisor in the dialogue "Greeting 1" and in this script; 0 = Canctunian Ponius lives and is in charge of the East Empire Company; 1 = Canctunian Ponius is dead and Mehitabel Llaras has taken office; 2 = Canctunian Ponius is dead and Mehitabel Llaras had to fleeif ( MenuMode == 1 ) returnendifif ( GetJournalIndex "RoHT_EastEmpireCompany" < 100 ); Canctunian should be alive if ( GetDeadCount, "Canctunian Ponius" > 0 ); but if he isn't, you have probably killed him before and this quest can't be solved as intended Journal, "RoHT_EastEmpireCompany", 110; stop this script, it has served its purpose; RoHT_EEC_status will be set to 2 by RoHT_advisor in the dialogue "Greeting 1", so that Mehitabel won't vanish before your eyes StopScript, "RoHT_Canctunian_Script" endif else return endifelseif ( GetJournalIndex "RoHT_EastEmpireCompany" == 100 ); this Journal entry is set by your advisor in the dialogue "Greeting 1" set RoHT_EEC_status to 1 "Canctunian Ponius"->SetHealth, 0 "Canctunian Ponius"->disable; quest solved, stop the script StopScript, "RoHT_Canctunian_Script"endifEnd
That script is started in dialogue at the appropriate time and will run until Canctunian Ponius is dead, regardless of his cause of death. RoHT_TelAzura is also set in dialogue:
; global RoHT_TelAzura_status; This variable is set to 1 by RoHT_advisor in the dialogue topic "master alchemist"; 0 = Tel Azura isn't built yet, Ammardunibi Camp is active; 1 = Tel Azura is completely built; Ranos and Bodrusa have moved there
With these two variables I'm able to keep track of this quest's outcome, regardless of Journal entries. For example:
"RoHT_TelAzura_status = 1" and "RoHT_EEC_status = 0" means that the player has recruited the master alchemist, but hasn't made any progress on taking over the EEC yet.
"RoHT_TelAzura_status = 1" and "RoHT_EEC_status = 1" means complete success.
"RoHT_TelAzura_status = 1" and "RoHT_EEC_status = 2" means partial success - master alchemist won, EEC lost
"RoHT_TelAzura_status = 0" and "RoHT_EEC_status = 2" means complete failure.
I have made extensive use of these possibilties in later quests, for example when I needed to filter dialogue independently of the EEC quest but with regard to the master alchemist's status in House Telvanni. To get an idea of how convoluted this can get, have a look at http://i271.photobucket.com/albums/jj158/bhlmods/WIP%20Rise%20of%20House%20Telvanni/RoHTQuestTree.png. Doing this by Journal entries alone would be a royal pain in the ****.
If you'd like to take a closer look at it, let me know: I can send you the current WIP version. It contains quite a few interesting dialogue techniques, like quest deflectors, quest delays, quests within quests, dialogue-and-script-choreographed sequences... lots of stuff to browse through. :read:
Expect to find some bugs in later quests, though. I'm not done testing yet.
B
Edit:
I forgot to mention that using global variables also enables other mods to interact with your mod without being dependend on it. All that is required is that both mods feature the same global variable. For example, if you wanted one of your NPCs to comment on House Telvanni taking over the EEC, you'd add the global short variable "RoHT_EEC_status" to your mod and filter your dialogue for "global RoHT_EEC_status == 1". If RoHT is also running, players would be able to see that dialogue; if RoHT isn't running, they won't even notice that it exists. Point is that your mod will work, regardless of whether RoHT is present or not.
Modify PC Faction
I suggest you make a global variable to store the faction's disposition, then use something like set Illu_somefac_rep to ( illu_somefac_rep + 5 ) in the dialogue results to change it.
When adding a new topic and a journal entry which is linked to the new topic at the same time
I was describing the situation that we have discussed before. A quest topic is introduced in a greeting (or another topic) at the same time the first journal entry for that quest is added. The new (quest) topic is filtered for that journal index. Because the index does not exist at the moment the greeting's dialog is displayed, the text of the new topic is not hyperlinked nor is the topic listed. Only after the dialog window is refreshed (choosing a different topic is sufficient) will the filter condition for the new topic be satisfied so it can be linked and listed.
Example:
Greeting:
No Filter: Hello, %PCName, are willing to help a mer who is down on his luck?
Result:
Journal "cyr_HardLuck" 10
AddTopic "down on his luck"
Topic: down on his luck
Filter [Journal: cyr_HardLuck = 10]: Yes, it seems that ever since I found this old Dwemer bone I have had nothing but bad luck.
It looks like it would work, but the journal condition for the topic needs to be satisfied before the greeting displays. In this case the topic 'down on his luck' will not be hyperlinked. However if the journal is not added until the player chooses the topic and no filter for the topic (as Bethesda regularly did), or if the topic is filtered for Journal: cyr_HardLuck <= 10 the hyperlink will appear at the moment of the initial greeting.
Why my scripts started from Dialogue won't save
And to start this thread off I have a question about placeatme versus placeatpc
All I can understand from the MWSFD is that The PlaceAtMe function works the same as PlaceAtPC without it being centered on the PC. But what does this actually mean? Is placeatme working on another NPC or object?