Difference between revisions of "A beginner's guide, lesson 7 - Using Scripts in Quests"

Jump to navigation Jump to search
GetQuestStage -> GetStage, use of UL's all over
imported>DragoonWraith
m (Reverted edits by Anubis4545 (Talk); changed back to last version by DragoonWraith)
imported>DragoonWraith
(GetQuestStage -> GetStage, use of UL's all over)
Line 175: Line 175:
We use the topic BGCluesFound that was added earlier. We want one response if the player has not collected the clues yet, and another for when they have collected the clue. We can use the quest stage as a condition. Set up the responses so that a new topic called BGRedRose is added if we have the clues.
We use the topic BGCluesFound that was added earlier. We want one response if the player has not collected the clues yet, and another for when they have collected the clue. We can use the quest stage as a condition. Set up the responses so that a new topic called BGRedRose is added if we have the clues.


TOPIC<br />
TOPIC
BGCluesFound
* BGCluesFound


RESPONSE<br />
RESPONSE
I recognise this amulet. It belongs to a gang of thieves called the Red Rose Brigade
* I recognise this amulet. It belongs to a gang of thieves called the Red Rose Brigade


CONDITIONS<br />
CONDITIONS
GetIsId  BGCptHubart == 1<br />
* GetIsId  BGCptHubart == 1
GetQuestStage BGM001 == 50
* GetStage BGM001 == 50


ADD TOPICS<br />
ADD TOPICS
BGRedRose
* BGRedRose


RESULT SCRIPT<br />
RESULT SCRIPT
And<br />
* (none)
TOPIC<br />
TOPIC
BGCluesFound<br />
* BGCluesFound


RESPONSE<br />
RESPONSE
I need more clues to work with.
* I need more clues to work with.


CONDITIONS<br />
CONDITIONS
GetIsId  BGCptHubart == 1<br />
* GetIsId  BGCptHubart == 1
GetQuestStage BGM001 < 50
* GetStage BGM001 < 50


ADD TOPICS<br />
ADD TOPICS
RESULT SCRIPT<br />
* (none)
RESULT SCRIPT
* (none)


For the Red Rose topic add this response and add a new topic called BGSmith.
For the Red Rose topic add this response and add a new topic called BGSmith.


TOPIC<br />
TOPIC
BGRedRose (Red Rose Brigade)
* BGRedRose (Red Rose Brigade)


RESPONSE<br />
RESPONSE
They are a nasty bunch led by a couple of villains called Blair and Brown.<br />
* They are a nasty bunch led by a couple of villains called Blair and Brown.
I know they have a secret hide out in the mountains.<br />
* I know they have a secret hide out in the mountains.
Your best bet is to talk to an ex gang member by the name of Smith.<br />
* Your best bet is to talk to an ex gang member by the name of Smith.
I am surprised. I never took Brown for a killer.
* I am surprised. I never took Brown for a killer.


CONDITIONS<br />
CONDITIONS
GetIsId  BGCptHubart == 1<br />
* GetIsId  BGCptHubart == 1
GetQuestStage BGM001 == 50<br />
* GetStage BGM001 == 50


ADD TOPICS<br />
ADD TOPICS
BGSmith
* BGSmith


RESULT SCRIPT
RESULT SCRIPT
* (none)


We can remove the quest clues as they are no longer needed.  
We can remove the quest clues as they are no longer needed.  
Line 227: Line 230:
Finally add the Brandy, if you wish. Alternatively we could omit this and allow the player to make his choices
Finally add the Brandy, if you wish. Alternatively we could omit this and allow the player to make his choices


TOPIC<br />
TOPIC
BGSmith (Smith)
* BGSmith (Smith)


RESPONSE<br />
RESPONSE
Yeah, he quit the gang a while back. you'll find him hanging out at the Aleswell Inn.<br />
* Yeah, he quit the gang a while back. you'll find him hanging out at the Aleswell Inn.
He's partial to a drop of Brandy. That might help loosen his lips.<br />
* He's partial to a drop of Brandy. That might help loosen his lips.
I take back the cottage key and hold on to this document.<br />
* I take back the cottage key and hold on to this document.


CONDITIONS<br />
CONDITIONS
GetIsId  BGCptHubart  == 1<br />
* GetIsId  BGCptHubart  == 1
GetQuestStage BGM001 == 50<br />
* GetStage BGM001 == 50


ADD TOPICS<br />
ADD TOPICS
* (none)


RESULT SCRIPT<br />
RESULT SCRIPT
Player.Additem "PotionCyrodiilicBrandy" 1<br />
<ul><li><pre>Player.Additem "PotionCyrodiilicBrandy" 1<br />
Player.RemoveItem "BGPartialLetter" 1<br />
Player.RemoveItem "BGPartialLetter" 1<br />
Player.RemoveItem "BGCourierKey" 1<br />
Player.RemoveItem "BGCourierKey" 1<br />
Player.RemoveItem "BGEmbossedAmulet" 1<br />
Player.RemoveItem "BGEmbossedAmulet" 1<br />
SetStage BGM001 60
SetStage BGM001 60</pre></ul>


To complete this section we need to update the journal and move on to Aleswell.
To complete this section we need to update the journal and move on to Aleswell.
Line 279: Line 283:
We can set up a GREETING for Smith. Here we use the quest stage for the miscellaneous quest called MS47  Zero Visibility. This is the stage where the people of Aleswell become visible.  
We can set up a GREETING for Smith. Here we use the quest stage for the miscellaneous quest called MS47  Zero Visibility. This is the stage where the people of Aleswell become visible.  


TOPIC<br />
TOPIC
GREETING<br />
* GREETING


RESPONSE<br />
RESPONSE
This is so weird. Everyone is invisible. I came here to blend in with a crowd. Just my luck
* This is so weird. Everyone is invisible. I came here to blend in with a crowd. Just my luck


CONDITIONS<br />
CONDITIONS
GetIsId  BGMSmith == 1<br />
* GetIsId  BGMSmith == 1
GetStage MS47 < 50
* GetStage MS47 < 50
 
ADD TOPICS
* (none)


ADD TOPICS<br />
RESULT SCRIPT
RESULT SCRIPT
* (none)


The next bit of the quest is a bit tricky.  
The next bit of the quest is a bit tricky.  
Line 302: Line 309:
Let’s do that now.
Let’s do that now.


TOPIC<br />
TOPIC
BGRedRoseBrigade
* BGRedRoseBrigade


RESPONSE<br />
RESPONSE
I don't know you, and I don't think I want to talk to you about them
* I don't know you, and I don't think I want to talk to you about them


CONDITIONS<br />
CONDITIONS
GetIsId  BGMSmith == 1<br />
* GetIsId  BGMSmith == 1
GetDisposition < 90
* GetDisposition < 90


ADD TOPICS<br />
ADD TOPICS
BGBrandy<br />
* BGBrandy


RESULT SCRIPT
RESULT SCRIPT
* (none)


We then check the '''Info Refusal''' flag.
We then check the '''Info Refusal''' flag.
Line 478: Line 486:
MessageBox "Some Message that appears in the Box”, Option A, OptionB, OptionC
MessageBox "Some Message that appears in the Box”, Option A, OptionB, OptionC


''OptionA selected GetButtonPressed=0
* ''OptionA selected GetButtonPressed=0''
OptionB selected GetButtonPressed=1
* ''OptionB selected GetButtonPressed=1''
OptionC selected GetButtonPressed=2''
* ''OptionC selected GetButtonPressed=2''


The value selected and assigned to the variable Button is then used in the third part of the script.  
The value selected and assigned to the variable Button is then used in the third part of the script.  
Line 523: Line 531:
We adjust its value using  topics called BGBrandy, BGBrandyChoice1, and BGBrandyChoice2
We adjust its value using  topics called BGBrandy, BGBrandyChoice1, and BGBrandyChoice2


TOPIC<br />
TOPIC
BGBrandy
* BGBrandy


RESPONSE<br />
RESPONSE
Yeah, I love the stuff. Have you  any to spare?
* Yeah, I love the stuff. Have you  any to spare?


CONDITIONS<br />
CONDITIONS
GetIsId  BGMSmith == 1<br />
* GetIsId  BGMSmith == 1
GetStage BGM001 == 50
* GetStage BGM001 == 50


ADD TOPICS<br />
ADD TOPICS
(in Choices) BGBrandyChoice1, BGBrandyChoice2
* (in Choices)
** BGBrandyChoice1
** BGBrandyChoice2


RESULT SCRIPT
RESULT SCRIPT
* (none)


We can then use the choices to set our control variable to 1.  
We can then use the choices to set our control variable to 1.  
Line 550: Line 561:
Add another quest variable to the quest script called DoNextBrandy
Add another quest variable to the quest script called DoNextBrandy


TOPIC<br />
TOPIC
BGBrandyChoice1(Yes, I might have)
* BGBrandyChoice1(Yes, I might have)


RESPONSE<br />
RESPONSE
I think I might warm to you.
* I think I might warm to you.


CONDITIONS<br />
CONDITIONS
GetIsId  BGMSmith == 1<br />
* GetIsId  BGMSmith == 1
GetStage BGM001 == 50<br />
* GetStage BGM001 == 50
GetQuestVariable BGM001.DoNextBrandy == 0
* GetQuestVariable BGM001.DoNextBrandy == 0


ADD TOPICS
ADD TOPICS


RESULT SCRIPT<br />
RESULT SCRIPT
Set BGM001.BrandyTalk to 1
<ul><li><pre>Set BGM001.BrandyTalk to 1
Set BGM001. DoNextBrandy to 1
Set BGM001. DoNextBrandy to 1</pre></ul>


The second response info reads
The second response info reads


TOPIC<br />
TOPIC
BGBrandyChoice1(Yes, I might have)
* BGBrandyChoice1(Yes, I might have)


RESPONSE<br />
RESPONSE
I think I might warm to you.
* I think I might warm to you.


CONDITIONS<br />
CONDITIONS
GetIsId  BGMSmith == 1<br />
* GetIsId  BGMSmith == 1
GetStage BGM001 == 50<br />
* GetStage BGM001 == 50
GetQuestVariable BGM001.DoNextBrandy == 1
* GetQuestVariable BGM001.DoNextBrandy == 1


ADD TOPICS
ADD TOPICS
* (none)


RESULT SCRIPT
RESULT SCRIPT
Set BrandyTalk to 1
<ul><li><pre>Set BrandyTalk to 1
Set DoNextBrandy to 2
Set DoNextBrandy to 2</pre></ul>


Add another couple of responses, make all of them goodbyes using the Good bye flag. this ends the dialogue automatically, closes the topic menu and forces the now active script to run.
Add another couple of responses, make all of them goodbyes using the Good bye flag. this ends the dialogue automatically, closes the topic menu and forces the now active script to run.
Line 590: Line 602:
We also need to add a negative response. Note there is no result for this one, and you don’t need to make it a goodbye.
We also need to add a negative response. Note there is no result for this one, and you don’t need to make it a goodbye.


TOPIC<br />
TOPIC
BGBrandyChoice2 (No sorry I’m out)
* BGBrandyChoice2 (No sorry I’m out)


RESPONSE<br />
RESPONSE
Pity, I might have liked you more if you did.
* Pity, I might have liked you more if you did.


CONDITIONS<br />
CONDITIONS
GetIsId  BGMSmith == 1<br />
* GetIsId  BGMSmith == 1
GetStage BGM001 == 50
* GetStage BGM001 == 50


ADD TOPICS
ADD TOPICS
* (none)


RESULT SCRIPT
RESULT SCRIPT
* (none)


By a combination of speech craft, factions, bribes disposition games and brandy gifts the Player should be able to raise the disposition to 90 eventually. This will trigger the next bit of dialogue and send us towards the quest climax. Return to the BGRedRoseBrigade topic and add this
By a combination of speech craft, factions, bribes disposition games and brandy gifts the Player should be able to raise the disposition to 90 eventually. This will trigger the next bit of dialogue and send us towards the quest climax. Return to the BGRedRoseBrigade topic and add this


TOPIC<br />
TOPIC
BGRedRoseBrigade
* BGRedRoseBrigade


RESPONSE<br />
RESPONSE
Ok, the truth is I've fallen out with the gang. They've threatened to kill me for leaving.<br />
* Ok, the truth is I've fallen out with the gang. They've threatened to kill me for leaving.
You look like you can take care of them.<br />
* You look like you can take care of them.
Watch out for Blair he is a nasty bit of work.<br />
* Watch out for Blair he is a nasty bit of work.
Here's the hideout key, and I'll mark the hideouts location on your map.<br />
* Here's the hideout key, and I'll mark the hideouts location on your map.
Mind you I am surprised at Brown. He was a decent chap when I was in the gang.
* Mind you I am surprised at Brown. He was a decent chap when I was in the gang.


CONDITIONS<br />
CONDITIONS
GetIsId  BGMSmith == 1<br />
* GetIsId  BGMSmith == 1
GetDisposition >= 90
* GetDisposition >= 90


ADD TOPICS
ADD TOPICS
* (none)


RESULT SCRIPT
RESULT SCRIPT
SetStage BGM001 70
<ul><li><pre>SetStage BGM001 70</pre></ul>


We can then use the result script to bump the stage to 70
We can then use the result script to bump the stage to 70
Line 637: Line 652:
''Smith has given me a key for the Red Rose Brigades hideout. I should go to the hideout and see if I can recover my uncle's Key and House Deed.''
''Smith has given me a key for the Red Rose Brigades hideout. I should go to the hideout and see if I can recover my uncle's Key and House Deed.''


Result script
RESULT SCRIPT
Player.Additem "BGHideoutKey" 1
<ul><li><pre>Player.Additem "BGHideoutKey" 1
ShowMap BGCaveMapMarker
ShowMap BGCaveMapMarker</pre></ul>


==Red Rose Hideout Phase==
==Red Rose Hideout Phase==
Line 855: Line 870:
We now have to set up the conversation. We use the conversation tab rather than the topic tab. Also set this conversation up as a goodbye, to terminate any further discussion.
We now have to set up the conversation. We use the conversation tab rather than the topic tab. Also set this conversation up as a goodbye, to terminate any further discussion.


CONVERSATION<br />
CONVERSATION
BGMBlairGreet
* BGMBlairGreet


RESPONSE<br />
RESPONSE
You are a fool for coming here. Now prepare to die.
* You are a fool for coming here. Now prepare to die.


CONDITIONS<br />
CONDITIONS
GetIsId  BGBlair== 1<br />
* GetIsId  BGBlair == 1
GetStage BGM001<95<br />
* GetStage BGM001 < 95
GetStage BGM001 == 90
* GetStage BGM001 == 90


ADD TOPICS
ADD TOPICS
* (none)


RESULT SCRIPT
RESULT SCRIPT
* (none)


When the PC kills Blair we can then update the journal
When the PC kills Blair we can then update the journal
Line 878: Line 895:
Initially we set up a greeting.  
Initially we set up a greeting.  


TOPIC<br />
TOPIC
Greeting
* Greeting


RESPONSE<br />
RESPONSE
Please, Please, don't kill me. I just want to get away from here. Please let me go
* Please, Please, don't kill me. I just want to get away from here. Please let me go


CONDITIONS<br />
CONDITIONS
GetIsId  BGBrown == 1<br />
* GetIsId  BGBrown == 1
GetStage BGM001 == 90
* GetStage BGM001 == 90


ADD TOPICS<br />
ADD TOPICS
BgBrownChoice1,BgBrownChoice2
* BgBrownChoice1
* BgBrownChoice2


RESULT SCRIPT
RESULT SCRIPT
* (none)


The positive response info for BGBrownC1 gives a stage boost, the negative one does not.
The positive response info for BGBrownC1 gives a stage boost, the negative one does not.


TOPIC<br />
TOPIC
BGBrownC1
* BGBrownC1


RESPONSE<br />
RESPONSE
Thank You! Thank you! The code is 1 4 7
* Thank You! Thank you! The code is 1 4 7


CONDITIONS<br />
CONDITIONS
GetIsId  BGBrown == 1<br />
* GetIsId  BGBrown == 1
GetStage BGM001 >= 90
* GetStage BGM001 >= 90


ADD TOPICS
ADD TOPICS
* (none)


RESULT SCRIPT
RESULT SCRIPT
SetStage BGM001 100
<ul><li><pre>SetStage BGM001 100</pre></ul>


We update the journal and run a bit of script as a result
We update the journal and run a bit of script as a result
Line 921: Line 941:
  SetQuestObject BGPartialLetter 0
  SetQuestObject BGPartialLetter 0


TOPIC<br />
TOPIC
BGBrownC2
* BGBrownC2


RESPONSE<br />
RESPONSE
Then you'll never learn the entry code.
* Then you'll never learn the entry code.


CONDITIONS<br />
CONDITIONS
GetIsId  BGBrown == 1<br />
* GetIsId  BGBrown == 1
GetStage BGM001 >= 90
* GetStage BGM001 >= 90


ADD TOPICS
ADD TOPICS
* (none)


RESULT SCRIPT
RESULT SCRIPT
* (none)


We will need to look at altering Browns behaviour for the final release. We will need to add some Ai in the next lesson to get him to run away.
We will need to look at altering Browns behaviour for the final release. We will need to add some Ai in the next lesson to get him to run away.
Line 1,249: Line 1,271:
   EndIf</pre>
   EndIf</pre>


TOPIC<br />
TOPIC
Greeting
* Greeting


RESPONSE<br />
RESPONSE
I can't help you until you find the key and deed.<br />
* I can't help you until you find the key and deed.
You have to go back and get the deed and key. Check if Blair has it.
* You have to go back and get the deed and key. Check if Blair has it.


CONDITIONS<br />
CONDITIONS
GetIsId  BGVilanusVilla == 1<br />
* GetIsId  BGVilanusVilla == 1
GetStage BGM001 >= 80<br />
* GetStage BGM001 >= 80
GetQuestVariable BGM001.QuestWon == 0
* GetQuestVariable BGM001.QuestWon == 0


ADD TOPICS
ADD TOPICS
* (none)


RESULT SCRIPT
RESULT SCRIPT
* (none)


and
and


TOPIC<br />
TOPIC
Greeting
* Greeting


RESPONSE<br />
RESPONSE
Hello, Have you managed to recover the deed and key?
* Hello, Have you managed to recover the deed and key?


CONDITIONS<br />
CONDITIONS
GetIsId  BGVilanusVilla == 1<br />
* GetIsId  BGVilanusVilla == 1
GetStage BGM001 >= 80<br />
* GetStage BGM001 >= 80
GetQuestVariable BGM001.QuestWon == 1
* GetQuestVariable BGM001.QuestWon == 1


ADD TOPICS
ADD TOPICS
* none


RESULT SCRIPT<br />
RESULT SCRIPT
AddTopic BGTopView
<ul><li><pre>AddTopic BGTopView</pre></ul>


(add topic via script to avoid issue with GREETINGS add topic's not appearing in the game)
(add topic via script to avoid issue with GREETINGS add topic's not appearing in the game)
Line 1,287: Line 1,312:
For the new topic we add several responses. This first info tell the player to come back later
For the new topic we add several responses. This first info tell the player to come back later


TOPIC<br />
TOPIC
BGTopView (Top View Cottage?)
* BGTopView (Top View Cottage?)


RESPONSE<br />
RESPONSE
Excellent, I will take the deed to the Property Registrar today. Come back tomorrow and I'll complete the transfer.
* Excellent, I will take the deed to the Property Registrar today. Come back tomorrow and I'll complete the transfer.


CONDITIONS<br />
CONDITIONS
GetIsId  BGVilanusVilla == 1<br />
* GetIsId  BGVilanusVilla == 1
GetQuestVariable BGM001.QuestWon == 1
* GetQuestVariable BGM001.QuestWon == 1


ADD TOPICS<br />
ADD TOPICS
BGTopView
* BGTopView


RESULT SCRIPT<br />
RESULT SCRIPT
Player.RemoveItem "BGM001HouseDeeduc" 1
<ul><li><pre>Player.RemoveItem "BGM001HouseDeeduc" 1
SetStage BGM001 110
SetStage BGM001 110
Stage 110 Journal Update
Stage 110 Journal Update</pre></ul>


''I have met with Vilanus Villa again. He has taken the deed to Top View and will complete the registration. I should come back in 24 hours to complete the transfer.''
''I have met with Vilanus Villa again. He has taken the deed to Top View and will complete the registration. I should come back in 24 hours to complete the transfer.''
Line 1,385: Line 1,410:
When the deed has not been completed ( DeedDone == 0) use
When the deed has not been completed ( DeedDone == 0) use


TOPIC<br />
TOPIC
BGTopView (Top View Cottage?)
* BGTopView (Top View Cottage?)


RESPONSE<br />
RESPONSE
I haven't quite finished the paperwork check with me later.
* I haven't quite finished the paperwork check with me later.


CONDITIONS<br />
CONDITIONS
GetIsId  BGVilanusVilla == 1<br />
* GetIsId  BGVilanusVilla == 1
GetQuestVariable BGM001.QuestWon == 1<br />
* GetQuestVariable BGM001.QuestWon == 1
GetQuestVariable BGM001.DeedDone == 0
* GetQuestVariable BGM001.DeedDone == 0


ADD TOPICS
ADD TOPICS
* (none)


RESULT SCRIPT
RESULT SCRIPT
* (none)


Once the deed is done you produce this message
Once the deed is done you produce this message


TOPIC<br />
TOPIC
BGTopView (Top View Cottage?)
* BGTopView (Top View Cottage?)


RESPONSE<br />
RESPONSE
Congratulations, you are new the proud Owner of Top View.<br />
* Congratulations, you are new the proud Owner of Top View.
Here is the paperwork. I'll mark it's location on the map for you.<br />
* Here is the paperwork. I'll mark it's location on the map for you.
May the gods be with you.
* May the gods be with you.


CONDITIONS<br />
CONDITIONS
GetIsId  BGVilanusVilla == 1<br />
* GetIsId  BGVilanusVilla == 1
GetQuestVariable BGM001.QuestWon == 1<br />
* GetQuestVariable BGM001.QuestWon == 1
GetQuestVariable BGM001.DeedDone == 0
* GetQuestVariable BGM001.DeedDone == 0


ADD TOPICS
ADD TOPICS
* (none)


RESULT SCRIPT<br />
RESULT SCRIPT
SetStage BGM001 120
<ul><li><pre>SetStage BGM001 120</pre></ul>


and add a Journal Update for Stage 120
and add a Journal Update for Stage 120
Line 1,445: Line 1,473:
We can also add the following as an end of quest reply from Vilanus.
We can also add the following as an end of quest reply from Vilanus.


TOPIC<br />
TOPIC
BGTopView (Top View Cottage?)
* BGTopView (Top View Cottage?)


RESPONSE<br />
RESPONSE
I hope you enjoy the house.
* I hope you enjoy the house.


CONDITIONS<br />
CONDITIONS*
GetIsId  BGVilanusVilla == 1<br />
* GetIsId  BGVilanusVilla == 1
GetQuestVariable BGM001.QuestWon == 1<br />
* GetQuestVariable BGM001.QuestWon == 1
GetQuestVariable BGM001.DeedDone == 1<br />
* GetQuestVariable BGM001.DeedDone == 1
GetStage BGM001 >= 120
* GetStage BGM001 >= 120


ADD TOPICS
ADD TOPICS
* (none)


RESULT SCRIPT
RESULT SCRIPT
* (none)


We then complete the quest script with a final block to check when the PC arrives at the house. Of course we will need  
We then complete the quest script with a final block to check when the PC arrives at the house. Of course we will need  

Navigation menu