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

wikified - still needs work, I just did formatting
imported>Qazaaq
(ready to by wikified)
 
imported>DragoonWraith
(wikified - still needs work, I just did formatting)
Line 1: Line 1:
[quote name='dtom' date='Jul 24 2006, 06:49 PM' post='7398680']
{{Update}}
[url=http://www.elderscrolls.com/forums/index.php?showtopic=517001]Index Page[/url]  
{{Byline}}
Originally posted by dtom at the [http://www.bethsoft.com/bgsforums/index.php?showforum=24 Elder Scrolls Forums - General TES Construction Set - Oblivion]


[b]TES IV: Oblivion Modding for Beginners
([http://www.elderscrolls.com/forums/index.php?showtopic=517001 Original Thread])
 
'''TES IV: Oblivion Modding for Beginners


B. Scripts, Quests and NPC’s
B. Scripts, Quests and NPC’s
Lesson Seven: Using Scripts in Quests[/b]
Lesson Seven: Using Scripts in Quests'''


[b]Preamble[/b]
'''Preamble'''


This is the Seventh in a proposed series of Tutorial Lessons aimed at teaching how to mod TES IV: Oblivion aimed at beginners. It will build up into a Complete Modding Course. Don't worry there are no exams, though there is some homework.
This is the Seventh in a proposed series of Tutorial Lessons aimed at teaching how to mod TES IV: Oblivion aimed at beginners. It will build up into a Complete Modding Course. Don't worry there are no exams, though there is some homework.


[b]Files[/b]
'''Files'''


I have uploaded some files which we will use to accompany the next few tutorials.  
I have uploaded some files which we will use to accompany the next few tutorials.  
It contains
It contains


[i]A. BGModTutBase.esp:  
''A. BGModTutBase.esp:  
This contains a building, a farmhouse, and a dungeon that we will use as sets in lessons 6, 7 and 8. This file is referred to in the text as the BASE files
This contains a building, a farmhouse, and a dungeon that we will use as sets in lessons 6, 7 and 8. This file is referred to in the text as the BASE files


Line 25: Line 28:
This is a small optional cheat mod to give users 5000 septims to allow them to follow this tutorial if they have not completed the quest. (See Introduction to lesson 4)
This is a small optional cheat mod to give users 5000 septims to allow them to follow this tutorial if they have not completed the quest. (See Introduction to lesson 4)


C. A RTF document containing the text for the first 7 lessons (as requested).
C. A RTF document containing the text for the first 7 lessons (as requested).''
[/i]


[b]Introduction[/b]
'''Introduction'''


We have already begun  building a quest. This lesson continues directly where lesson Six left off. We have set up a cottage which the PC will need to investigate to gain clues to identify who has stolen the deed and key. We have learned how to add dialogue using Topic/Response combinations and conditional statements to limit who gets to say the dialogue.  
We have already begun  building a quest. This lesson continues directly where lesson Six left off. We have set up a cottage which the PC will need to investigate to gain clues to identify who has stolen the deed and key. We have learned how to add dialogue using Topic/Response combinations and conditional statements to limit who gets to say the dialogue.  
Line 34: Line 36:
We have seen how to use a limited amount of scripting to progress our quest. While there is loads more dialogue to include in this part of the quest, we will focus far more on the use of scripting.  
We have seen how to use a limited amount of scripting to progress our quest. While there is loads more dialogue to include in this part of the quest, we will focus far more on the use of scripting.  


[b]At the Cottage[/b]
'''At the Cottage'''


We cannot rely on any information from NPC’s to progress our quest because the courier is dead.
We cannot rely on any information from NPC’s to progress our quest because the courier is dead.
Line 46: Line 48:
We will use the distance 300 which is fairly close to but not necessarily on top of the x marker we made. When the character gets close we want to move to stage 40. We can use the stage to limit when the active part of the script runs. We first need to add stage 40 in the stage tab. Now add this below the current IF-End if block inside the begin block of our quest script.
We will use the distance 300 which is fairly close to but not necessarily on top of the x marker we made. When the character gets close we want to move to stage 40. We can use the stage to limit when the active part of the script runs. We first need to add stage 40 in the stage tab. Now add this below the current IF-End if block inside the begin block of our quest script.


[b]If (GetStage BGM001 == 30)
If (GetStage BGM001 == 30)
If (player.GetDistance BgCourierLodgeXMarker <= 300)
  If (player.GetDistance BgCourierLodgeXMarker <= 300)
SetStage BGM001 40
    SetStage BGM001 40
EndIf
  EndIf
EndIf[/b]
EndIf


In this case the quest stage acts as a DoOnce type control.  
In this case the quest stage acts as a DoOnce type control.  
Line 66: Line 68:
So we declare the three variables to add to our variable list at the top of the script. You will notice that the list keeps growing as we find we need new variables.
So we declare the three variables to add to our variable list at the top of the script. You will notice that the list keeps growing as we find we need new variables.


[b]Short Qobjectcount
Short Qobjectcount
Short Count1Once
Short Count1Once
Short Count 2 Once[/b]
Short Count 2 Once


We will add to the script already inside the current Begin GameMode block. We could always add a new Begin Block, but why add lines that we don’t need. Note the use of indents in an IF statement is purely for clarity and has no bearing on the running of the script.  
We will add to the script already inside the current Begin GameMode block. We could always add a new Begin Block, but why add lines that we don’t need. Note the use of indents in an IF statement is purely for clarity and has no bearing on the running of the script.  
Line 77: Line 79:
So we set an IF condition
So we set an IF condition


[i]If (QObjectCount < 2)[/i]
If (QObjectCount < 2)


Now we can use a nested IF statement. This is an IF statement within an IF statement. We will also use the && (AND) command. This combines IF conditions so that BOTH must be met for the first bit of script to work. If either or both fail the IF block moves on to any elseIF, or else statements. Otherwise it ends that block.
Now we can use a nested IF statement. This is an IF statement within an IF statement. We will also use the && (AND) command. This combines IF conditions so that BOTH must be met for the first bit of script to work. If either or both fail the IF block moves on to any elseIF, or else statements. Otherwise it ends that block.
Line 85: Line 87:
This will stop the script from counting this item again the next time it runs (5 secs)
This will stop the script from counting this item again the next time it runs (5 secs)
 
 
If (Player.GetItemCount "BGPartialLetter" >=1) && (Count1Once==0)
If (Player.GetItemCount "BGPartialLetter" >=1) && (Count1Once==0)
Set QObjectCount to QObjectCount +1
  Set QObjectCount to QObjectCount +1
Set Count1Once to 1
  Set Count1Once to 1
EndIf
EndIf


We repeat this for the second clue item the BGEmbossedAmulet
We repeat this for the second clue item the BGEmbossedAmulet


If (Player.GetItemCount "BGEmbossedAmulet" >=1) && (Count2Once==0)
If (Player.GetItemCount "BGEmbossedAmulet" >=1) && (Count2Once==0)
Set QObjectCount to QObjectCount +1
  Set QObjectCount to QObjectCount +1
Set Count2Once to 1
  Set Count2Once to 1
EndIf
EndIf


Finally, we add  
Finally, we add  


EndIf
EndIf


To finish this whole block
To finish this whole block
Line 105: Line 107:
It should read.
It should read.


[b]If (QObjectCount < 2)
If (QObjectCount < 2)
If (Player.GetItemCount "BGPartialLetter" >=1) && (Count1Once==0)
  If (Player.GetItemCount "BGPartialLetter" >=1) && (Count1Once==0)
Set QObjectCount to QObjectCount +1
    Set QObjectCount to QObjectCount +1
Set Count1Once to 1
    Set Count1Once to 1
EndIf
  EndIf
If (Player.GetItemCount "BGEmbossedAmulet" >=1) && (Count2Once==0)
  If (Player.GetItemCount "BGEmbossedAmulet" >=1) && (Count2Once==0)
Set QObjectCount to QObjectCount +1
    Set QObjectCount to QObjectCount +1
Set Count2Once to 1
    Set Count2Once to 1
EndIf
  EndIf
EndIf


EndIf[/b]
We now have the following bits of info in usable mathematical form.


We now have the following bits of info in usable mathematical form.
We know when we have both clues - QObjectCount


We know when we have both clues - QObjectCount
We know when we have each individual clue - Count1Once and Count2Once  
We know when we have each individual clue - Count1Once and Count2Once  


We want to display different messages depending on what combination of clues we have. There are four possibilities leading to four simple IF statements.  
We want to display different messages depending on what combination of clues we have. There are four possibilities leading to four simple IF statements.
The values of the new variable MessageStage are just so we can clearly tell them apart.  
 
The values of the new variable MessageStage are just so we can clearly tell them apart.
I chose 100, 50, 25, and 10. It could be any number you like.  
I chose 100, 50, 25, and 10. It could be any number you like.  
You will need to declare the variable MessageStage first.  
You will need to declare the variable MessageStage first.  
Do this and then type this script, once again inside the Begin End block.
Do this and then type this script, once again inside the Begin End block.


[b]If (count1Once == 0) && (Count2Once==0)
If (count1Once == 0) && (Count2Once==0)
Set MessageState to 100
  Set MessageState to 100
EndIf
EndIf
If (count1Once == 0) && (Count2Once==1)
If (count1Once == 0) && (Count2Once==1)
Set MessageState to 50
  Set MessageState to 50
EndIf
EndIf
If (count1Once == 1) && (Count2Once==0)
If (count1Once == 1) && (Count2Once==0)
Set MessageState to 25
  Set MessageState to 25
EndIf
EndIf
If (count1Once == 1) && (Count2Once==1)
If (count1Once == 1) && (Count2Once==1)
Set MessageState to 10
  Set MessageState to 10
EndIf[/b]
EndIf
 
Now we use the message state to set the on screen message. This part of the script is very clumsy and can be cleaned up. We will do this in lesson eight.
Now we use the message state to set the on screen message. This part of the script is very clumsy and can be cleaned up. We will do this in lesson eight.
Again we need to set some DoOnce variables to stop the messages being displayed again and again. I have called these DoM2Once etc.
The first message state can be ignored because we don’t need to prompt them again to search for clues.
[b]If (DoM2Once == 0) && (MessageStage == 50)
MessageBox "I have found a strange amulet. I should continue to look for clues"
Set DoM2Once to 1
EndIf


If (DoM3Once == 0) && (MessageStage == 25)
Again we need to set some DoOnce variables to stop the messages being displayed again and again. I have called these DoM2Once etc.
MessageBox "I have found a torn document. I should look for more clues"
 
Set DoM3Once to 1
The first message state can be ignored because we don’t need to prompt them again to search for clues.
EndIf[/b]
 
If (DoM2Once == 0) && (MessageStage == 50)
  MessageBox "I have found a strange amulet. I should continue to look for clues"
  Set DoM2Once to 1
EndIf
If (DoM3Once == 0) && (MessageStage == 25)
  MessageBox "I have found a torn document. I should look for more clues"
  Set DoM3Once to 1
EndIf


The final situation does not require a MessageBox. As the quest journal can convey the message. But we do need to bump the quest stage. Again create stage 50 first.
The final situation does not require a MessageBox. As the quest journal can convey the message. But we do need to bump the quest stage. Again create stage 50 first.


[b]If (DoM4Once == 0) && (MessageStage == 10)
If (DoM4Once == 0) && (MessageStage == 10)
Set DoM4Once to 1
  Set DoM4Once to 1
SetStage BGM001 50
  SetStage BGM001 50
EndIf
EndIf
[/b]


This produces a stage bump. Add stage 50 and this journal entry.
This produces a stage bump. Add stage 50 and this journal entry.
Line 167: Line 175:


Now we can now set up the next bit of interaction with Hubart.  
Now we can now set up the next bit of interaction with Hubart.  
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
 
TOPIC<br />
BGCluesFound
BGCluesFound


RESPONSE
RESPONSE<br />
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
CONDITIONS<br />
GetIsId  BGCptHubart  == 1
GetIsId  BGCptHubart  == 1<br />
GetQuestStage BGM001 == 50
GetQuestStage BGM001 == 50


ADD TOPICS
ADD TOPICS<br />
BGRedRose
BGRedRose
RESULT SCRIPT


And  
RESULT SCRIPT<br />
TOPIC
And<br />
BGCluesFound
TOPIC<br />
BGCluesFound<br />


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


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


ADD TOPICS
ADD TOPICS<br />
RESULT SCRIPT
RESULT SCRIPT<br />


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
 
TOPIC<br />
BGRedRose (Red Rose Brigade)
BGRedRose (Red Rose Brigade)


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


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


ADD TOPICS
ADD TOPICS<br />
BGSmith
BGSmith
RESULT SCRIPT
 
RESULT SCRIPT


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 218: 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 BGSmith (Smith)
TOPIC<br />
BGSmith (Smith)


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


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


ADD TOPICS
ADD TOPICS<br />


RESULT SCRIPT
RESULT SCRIPT<br />
Player.Additem "PotionCyrodiilicBrandy" 1
Player.Additem "PotionCyrodiilicBrandy" 1<br />
Player.RemoveItem "BGPartialLetter" 1
Player.RemoveItem "BGPartialLetter" 1<br />
Player.RemoveItem "BGCourierKey" 1
Player.RemoveItem "BGCourierKey" 1<br />
Player.RemoveItem "BGEmbossedAmulet" 1  
Player.RemoveItem "BGEmbossedAmulet" 1<br />
SetStage BGM001 60
SetStage BGM001 60
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.
Add this to the Stage 60 journal entry.
Add this to the Stage 60 journal entry.


I should travel to Aleswell and talk to ex red Rose Gang member Smith. He may be able to help me locate the gangs hide out
''I should travel to Aleswell and talk to ex red Rose Gang member Smith. He may be able to help me locate the gangs hide out''


[b]Aleswell Phase.[/b]
'''Aleswell Phase.'''


Objectives: - [i]This is the last section prior to the big show down. We want to set up a disposition based dialogue in which Smith, once he likes you enough, will give you the location and key to the hidden Red Rose Brigade cave system.[/i]
Objectives: - '''This is the last section prior to the big show down. We want to set up a disposition based dialogue in which Smith, once he likes you enough, will give you the location and key to the hidden Red Rose Brigade cave system.'''


We need to create  
We need to create  


[i]Hideout Key.
'''Hideout Key.
NPC called Smith.
NPC called Smith.
a map marker to the exterior of the Cave system.
a map marker to the exterior of the Cave system.
the Cave system (if you are not using the base files)[/i]
the Cave system (if you are not using the base files)'''


First we want set up our NPC.  
First we want set up our NPC.  
We need this so we can add a quest target.  
We need this so we can add a quest target.  
I used a member of the thieves guide as a base. I again stripped out his AI, but I left him as a member of the thief’s guild. This will help fellow guild members get a bit of a boost to their disposition.  
I used a member of the thieves guide as a base. I again stripped out his AI, but I left him as a member of the thief’s guild. This will help fellow guild members get a bit of a boost to their disposition.  


Line 262: Line 279:


But as is so often the case, the simplest solution, is to just brush over it with a quick bit of dialogue.  
But as is so often the case, the simplest solution, is to just brush over it with a quick bit of dialogue.  
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
TOPIC<br />
GREETING
GREETING<br />


RESPONSE
RESPONSE<br />
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
CONDITIONS<br />
GetIsId  BGMSmith == 1
GetIsId  BGMSmith == 1<br />
GetStage MS47 < 50
GetStage MS47 < 50


ADD TOPICS
ADD TOPICS<br />
RESULT SCRIPT
RESULT SCRIPT
 
The next bit of the quest is a bit tricky.  
The next bit of the quest is a bit tricky.  


Line 286: Line 305:
Let’s do that now.
Let’s do that now.


TOPIC
TOPIC<br />
BGRedRoseBrigade
BGRedRoseBrigade


RESPONSE
RESPONSE<br />
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
CONDITIONS<br />
GetIsId  BGMSmith == 1
GetIsId  BGMSmith == 1<br />
GetDisposition < 90
GetDisposition < 90


ADD TOPICS
ADD TOPICS<br />
BGBrandy
BGBrandy<br />
 
RESULT SCRIPT
 
We then check the '''Info Refusal''' flag.


RESULT SCRIPT
We then check the[b] Info Refusal[/b] flag.
This means this topic can be revisited and the response will be re-evaluated.
This means this topic can be revisited and the response will be re-evaluated.


Line 307: Line 328:
Somehow we will need to get that disposition up. If the PC is a member of the thieves guide that will help. We can bribe the NPC or play the disposition game. Of course PC’s with good speech craft will also get a bonus. However, I have deliberately set the threshold high because I want to use the BRANDY idea we set up in Chorrol.  
Somehow we will need to get that disposition up. If the PC is a member of the thieves guide that will help. We can bribe the NPC or play the disposition game. Of course PC’s with good speech craft will also get a bonus. However, I have deliberately set the threshold high because I want to use the BRANDY idea we set up in Chorrol.  


[b]Designing an Object Script[/b]
'''Designing an Object Script'''


The first bit of scripting we did was to overcome the lack of an NPC to progress our quest. This time the problem is a little less clear. We want to set the game up so that giving some Brandy to Smith that boosts his disposition towards us.  
The first bit of scripting we did was to overcome the lack of an NPC to progress our quest. This time the problem is a little less clear. We want to set the game up so that giving some Brandy to Smith that boosts his disposition towards us.  
Line 313: Line 334:
It is no great chore to add a choices response to the Brandy topic.
It is no great chore to add a choices response to the Brandy topic.


Choice 1 – Gives him the brandy and bump disposition via a result script
Choice 1 – Gives him the brandy and bump disposition via a result script<br />
Choice 2 – Refuses to give him brandy.
Choice 2 – Refuses to give him brandy.


Line 320: Line 341:
The first problem is that it is a one time only action. You can’t keep giving him Brandy because the result script as we have set up the quest only allows this script to run once.  
The first problem is that it is a one time only action. You can’t keep giving him Brandy because the result script as we have set up the quest only allows this script to run once.  


The second problem is more serious. If we give him some Brandy we have to remove it from the players inventory. But what happens if the player does not have any Brandy in his inventory. Perhaps he drunk the supply Hubart gave him, or sold it, or put it in a safe place and forgot it. The RemoveItem function does not check if an item is there. If it is not the item is removed and the inventory is set at -1.  
The second problem is more serious. If we give him some Brandy we have to remove it from the players inventory. But what happens if the player does not have any Brandy in his inventory? Perhaps he drunk the supply Hubart gave him, or sold it, or put it in a safe place and forgot it. The RemoveItem function does not check if an item is there. If it is not the item is removed and the inventory is set at -1.  


This is not a good situation. Of course the player can reset it to zero by obtaining some more Brandy, but it is messy. It also is silly that the player hands smith a bottle of Brandy when he hasn’t got one.
This is not a good situation. Of course the player can reset it to zero by obtaining some more Brandy, but it is messy. It also is silly that the player hands Smith a bottle of Brandy when he hasn’t got one.


We need to have some kind of if statements that check the Brandy is in the inventory, and another option to offer more.
We need to have some kind of if statements that check the Brandy is in the inventory, and another option to offer more.
Line 328: Line 349:
The solution is to Script this. Here is a working script that does this. We can use a bit of dialogue to set the value of the variable BrandyTalk. Before we look in detail at the script. Take a look through it. Try to work out what each bit is doing. This is a great way to learn scripting. Scour the forums for examples of scripts and try to work out what is happening.   
The solution is to Script this. Here is a working script that does this. We can use a bit of dialogue to set the value of the variable BrandyTalk. Before we look in detail at the script. Take a look through it. Try to work out what each bit is doing. This is a great way to learn scripting. Scour the forums for examples of scripts and try to work out what is happening.   


[b]Scriptname BGM001SmithScript
<pre>Scriptname BGM001SmithScript


Short DoOnce
Short DoOnce
Line 338: Line 359:
If (Player.GetItemCount "PotionCyrodiilicBrandy" >=1)
If (Player.GetItemCount "PotionCyrodiilicBrandy" >=1)
If (DoOnce==0)
If (DoOnce==0)
MessageBox "How many Bottles of brandy would you like to give to Smith", "None", "One", "Two", "Three", "Four"
MessageBox "How many Bottles of brandy would you like to give to Smith",
"None", "One", "Two", "Three", "Four" ;note that this should not
; be returned, it is only because of page width problems that it is.
Set DoOnce to 1
Set DoOnce to 1
EndIf
EndIf
Line 396: Line 419:
EndIf
EndIf
EndIf
EndIf
End[/b]


(you may have to edit “ marks for script, problem with my text ecitor)
End</pre>


We attach this script once compiled to the NPC character BGMsmith using the script box in the character interface.
We attach this script once compiled to the NPC character BGMsmith using the script box in the character interface.
Line 409: Line 431:
Firstly
Firstly


[i]If (BGM001.BrandyTalk == 1) && (GetStage BGM001 == 60)
<pre>If (BGM001.BrandyTalk == 1) && (GetStage BGM001 == 60)
If (Player.GetItemCount "PotionCyrodiilicBrandy" >=1)
If (Player.GetItemCount "PotionCyrodiilicBrandy" >=1)
If (DoOnce==0)
If (DoOnce==0)
MessageBox "How many Bottles of brandy would you like to give to Smith", "None", "One", "Two", "Three", "Four"
MessageBox "How many Bottles of brandy would you like to give to Smith",
"None", "One", "Two", "Three", "Four" ;should not return
Set DoOnce to 1
Set DoOnce to 1
EndIf
EndIf
Line 418: Line 441:
Else
Else
Return
Return
EndIf
EndIf</pre>
[/i]
 
(Note the MessageBox statement should all be on one line, it is only the result of wrap around text in this document that produces the look above . It should be
(Note the MessageBox statement should all be on one line, it is only the result of wrap around text in this document that produces the look above . It should be


Line 427: Line 450:
Firstly it checks the status of a variable called BrandyTalk. We set this to 1 using a conversation between the PC and Smith. Until this happens the script will fail it conditions and skip to the  
Firstly it checks the status of a variable called BrandyTalk. We set this to 1 using a conversation between the PC and Smith. Until this happens the script will fail it conditions and skip to the  


[i]Else
Else
Return[/i]
Return


This terminates the script and prevents any further processing.  
This terminates the script and prevents any further processing.  
Line 436: Line 459:
If we have talked to Smith about Brandy, the core bit of this check runs.
If we have talked to Smith about Brandy, the core bit of this check runs.


[i]If (Player.GetItemCount "PotionCyrodiilicBrandy" >=1)
<pre>If (Player.GetItemCount "PotionCyrodiilicBrandy" >=1)
If (DoOnce==0)
If (DoOnce==0)
MessageBox "How many Bottles of brandy would you like to give to Smith", "None", "One", "Two", "Three", "Four"
MessageBox "How many Bottles of brandy would you like to give to Smith",
"None", "One", "Two", "Three", "Four" ;should not return
Set DoOnce to 1
Set DoOnce to 1
EndIf
EndIf
EndIf
EndIf</pre>
[/i]


We again carry out some relevant tests. The first checks that the player does indeed have Brandy in his inventory. This uses the GetItemCount function.  We then set up a DoOnce loop to prevent the message box from being displayed again and again.
We again carry out some relevant tests. The first checks that the player does indeed have Brandy in his inventory. This uses the GetItemCount function.  We then set up a DoOnce loop to prevent the message box from being displayed again and again.
Line 450: Line 473:
The second block will only run once the value of DoOnce has been set to one in the above block
The second block will only run once the value of DoOnce has been set to one in the above block


[i]If (DoOnce==1) &&(GetStage BGM001 == 60)
If (DoOnce==1) &&(GetStage BGM001 == 60)
Set Button to GetButtonPressed
Set Button to GetButtonPressed
EndIf
EndIf
[/i]
 
GetButtonPressed returns a value equivalent to the ‘buttons’ position in the message box list. It is normally set at -1 but takes the values 0-9 depending on the button selected.
GetButtonPressed returns a value equivalent to the ‘buttons’ position in the message box list. It is normally set at -1 but takes the values 0-9 depending on the button selected.


MessageBox “Some Message that appears in the Box” ,Option A, OptionB, OptionC
MessageBox “Some Message that appears in the Box” ,Option A, OptionB, OptionC


[i]OptionA selected GetButtonPressed=0
''OptionA selected GetButtonPressed=0
OptionB selected GetButtonPressed=1
OptionB selected GetButtonPressed=1
OptionC selected GetButtonPressed=2
OptionC selected GetButtonPressed=2''
[/i]
 
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.  


This is a little longer. It begins with a check that we have assigned a value by pressing the button.
This is a little longer. It begins with a check that we have assigned a value by pressing the button.


[i]If (Button>= -1)&&(GetStage BGM001 == 60)[/i]
If (Button>= -1)&&(GetStage BGM001 == 60)


Then we move onto the working parts of the script.  
Then we move onto the working parts of the script.  


If we select none, the script resets the value of BrandyTalk and DoOnce to zero. We are then able to use the script again later.  
If we select none, the script resets the value of BrandyTalk and DoOnce to zero. We are then able to use the script again later.  
[i]if (Button == 0)
<pre> if (Button == 0)
Set BGM001.BrandyTalk to 0
Set BGM001.BrandyTalk to 0
Set DoOnce to 0
Set DoOnce to 0
return
return
EndIf[/i]
EndIf</pre>
 
If we select one bottle. Then the next bit of script checks if we have enough brandy in our inventory to give Smith one bottle. It takes the bottle from your inventory. It then increases Smiths Disposition towards you by 15.


If we select one bottle. Then the next bit of script checks if we have enough brandy in our inventory to give Smith one bottle. It takes the bottle from your inventory. It then increases Smiths Disposition towards you by 15.
Finally It resets the control variables to allow the script to run again later.
Finally It resets the control variables to allow the script to run again later.
Note in this version we don’t actually give Smith the brandy. There is no technical need to do so.
Note in this version we don’t actually give Smith the brandy. There is no technical need to do so.


If you don’t have enough you get a message and then it  resets the controlling  variables.
If you don’t have enough you get a message and then it  resets the controlling  variables.


[i]If (Button == 1)
<pre> If (Button == 1)
If(Player.GetItemCount "PotionCyrodiilicBrandy" >=1)
If(Player.GetItemCount "PotionCyrodiilicBrandy" >=1)
Player.RemoveItem "PotionCyrodiilicBrandy" 1
Player.RemoveItem "PotionCyrodiilicBrandy" 1
Line 494: Line 518:
Set DoOnce to 0
Set DoOnce to 0
EndIf
EndIf
EndIf[/i]
EndIf</pre>


The remainder of the script is a repeat of this for the options 2 bottles, 3 bottles, and 4 bottles.
The remainder of the script is a repeat of this for the options 2 bottles, 3 bottles, and 4 bottles.
Line 502: Line 526:
We adjust its value using  topics called BGBrandy, BGBrandyChoice1, and BGBrandyChoice2
We adjust its value using  topics called BGBrandy, BGBrandyChoice1, and BGBrandyChoice2


TOPIC
TOPIC<br />
BGBrandy
BGBrandy


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


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


ADD TOPICS
ADD TOPICS<br />
(in Choices) BGBrandyChoice1, BGBrandyChoice2
(in Choices) BGBrandyChoice1, BGBrandyChoice2
RESULT SCRIPT
 
We can then use the choices to set our control variable to 1.
RESULT SCRIPT
But the problem still remains that this result script will only be carried out once.  
 
We can then use the choices to set our control variable to 1.  
 
But the problem still remains that this result script will only be carried out once.
 
The solution is simply to make copies of the response and use another variable to increment through them so that each one becomes valid.  
The solution is simply to make copies of the response and use another variable to increment through them so that each one becomes valid.  
You can do this as many times as you like.  
 
I settled for 4. I think it is unlikely you will need more than three turns but the option is there.  
You can do this as many times as you like.
 
I settled for 4. I think it is unlikely you will need more than three turns but the option is there.
 
Add another quest variable to the quest script called DoNextBrandy
Add another quest variable to the quest script called DoNextBrandy


TOPIC
TOPIC<br />
BGBrandyChoice1(Yes, I might have)
BGBrandyChoice1(Yes, I might have)
RESPONSE
 
RESPONSE<br />
I think I might warm to you.
I think I might warm to you.
CONDITIONS
 
GetIsId  BGMSmith == 1
CONDITIONS<br />
GetStage BGM001 == 50
GetIsId  BGMSmith == 1<br />
GetStage BGM001 == 50<br />
GetQuestVariable BGM001.DoNextBrandy == 0
GetQuestVariable BGM001.DoNextBrandy == 0
ADD TOPICS
 
RESULT SCRIPT
ADD TOPICS
Set BGM001.BrandyTalk to 1
 
Set BGM001. DoNextBrandy to 1
RESULT SCRIPT<br />
Set BGM001.BrandyTalk to 1
Set BGM001. DoNextBrandy to 1
 
The second response info reads
The second response info reads


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


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


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


ADD TOPICS
ADD TOPICS
RESULT SCRIPT
 
Set BrandyTalk to 1
RESULT SCRIPT
Set DoNextBrandy to 2
Set BrandyTalk to 1
Set DoNextBrandy to 2
 
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.


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
TOPIC<br />
BGBrandyChoice2 (No sorry I’m out)
BGBrandyChoice2 (No sorry I’m out)


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


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


ADD TOPICS
ADD TOPICS
 
RESULT SCRIPT
RESULT SCRIPT
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
 
TOPIC<br />
BGRedRoseBrigade
BGRedRoseBrigade


RESPONSE
RESPONSE<br />
Ok, the truth is I've fallen out with the gang. They've threatened to kill me for leaving
Ok, the truth is I've fallen out with the gang. They've threatened to kill me for leaving.<br />
You look like you can take care of them.  
You look like you can take care of them.<br />
Watch out for Blair he is a nasty bit of work.
Watch out for Blair he is a nasty bit of work.<br />
Here's the hideout key, and I'll mark the hideouts location on your map.
Here's the hideout key, and I'll mark the hideouts location on your map.<br />
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
CONDITIONS<br />
GetIsId  BGMSmith == 1
GetIsId  BGMSmith == 1<br />
GetDisposition >=90
GetDisposition >=90


ADD TOPICS
ADD TOPICS
RESULT SCRIPT
 
SetStage BGM001 70
RESULT SCRIPT
SetStage BGM001 70
 
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


In the quest stage section for stage 70 we can add an appropriate journal entry and a quest stage result script to add a key and activate another map marker.  
In the quest stage section for stage 70 we can add an appropriate journal entry and a quest stage result script to add a key and activate another map marker.  
Of course before we do this we need to add the MapMarker to the exterior of our cave. The cave system is called BGmodRRBCave.  
Of course before we do this we need to add the MapMarker to the exterior of our cave. The cave system is called BGmodRRBCave.  
Again we can use the door teleport marker to get ourselves to the exterior location.  
Again we can use the door teleport marker to get ourselves to the exterior location.  
Drop in a MapMarker and give it a Suitable reference name like BGCaveMapMarker.  
Drop in a MapMarker and give it a Suitable reference name like BGCaveMapMarker.  
Line 594: Line 638:
Journal entry
Journal entry
[i]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 uncles Key and House deed.[/i]
''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
ShowMap BGCaveMapMarker


[i]Player.Additem "BGHideoutKey" 1
'''Red Rose Hideout Phase'''
ShowMap BGCaveMapMarker
[/i]


[b]Red Rose Hideout Phase[/b]
Objectives:- ''This is the climax of our quest. The player will travel to a cave/dungeon, and will finally have his show down with the boss villain. We also want to set up a treasure chest as an additional reward. To make the players task a little harder, we will need to add some goons to fight along the way.''
 
Objectives:- [i]This is the climax of our quest. The player will travel to a cave/dungeon, and will finally have his show down with the boss villain. We also want to set up a treasure chest as an additional reward. To make the players task a little harder, we will need to add some goons to fight along the way.  
[/i]


We will need  
We will need  


[i]Dungeon/Cave system
''Dungeon/Cave system
Letter, adding extra clue from Brown about chest
Letter, adding extra clue from Brown about chest
Several NPC goons
Several NPC goons
Line 618: Line 659:
First Deed Document
First Deed Document
A special chest.
A special chest.
Some traps etc
Some traps etc''
[/i]


[b]Dungeon Design Ideas[/b]
'''Dungeon Design Ideas'''


The first thing we will need is a cave system or Dungeon for the player to delve. The dungeon pieces are a little harder to work with compared to the standard building interiors, as they are not complete pieces. Instead they slot together, piece by piece to create whole rooms.  
The first thing we will need is a cave system or Dungeon for the player to delve. The dungeon pieces are a little harder to work with compared to the standard building interiors, as they are not complete pieces. Instead they slot together, piece by piece to create whole rooms.  


A lot of the CS building parts work this way. Castles, Large Basements, Caves, ruins, and Dungeons are all created using this slotting method. Firstly make sure you switch on the snap to guides and the angle rotation guides, it makes life easier. Then open files/preferences and alter the snap to value to 1.  
A lot of the CS building parts work this way. Castles, Large Basements, Caves, ruins, and Dungeons are all created using this slotting method. Firstly make sure you switch on the snap to guides and the angle rotation guides, it makes life easier. Then open files/preferences and alter the snap to value to 1.
 
This alters the sensitivity of the snap, giving a closer fit.
This alters the sensitivity of the snap, giving a closer fit.


Line 632: Line 673:
The cave system I have set up for this tutorial, was created in a hurry. I simply visited other cave systems in the CS, and cut and pasted chambers that I then linked together.  
The cave system I have set up for this tutorial, was created in a hurry. I simply visited other cave systems in the CS, and cut and pasted chambers that I then linked together.  


It’s funny how you can come full circle. I now realise that the problem with the My First Dungeon tutorial in the Wiki is that it choose to illustrate it techniques using a dungeon. Had the Wiki went for my first house instead, it would have been much better of. However, we now know what we are doing, and working dungeons should be no problem.  
It’s funny how you can come full circle. I now realise that the problem with the My First Dungeon tutorial in the Wiki is that it choose to illustrate its techniques using a dungeon. Had the Wiki went for my first house instead, it would have been much better off. However, we now know what we are doing, and working dungeons should be no problem.  


As I have said the tutorials dungeon supplied in the files is not the greatest dungeon in the world. Far from it. It is a simple multi chamber linear cave system. This means the PC has very little choice how he progresses. He must make his way through each room, and face each challenge. This is both an advantage and a disadvantage. If I was building this cave system for ‘Full Mod’, I must admit I would have spent much more time on it.  
As I have said the tutorial's dungeon supplied in the files is not the greatest dungeon in the world. Far from it. It is a simple multi chamber linear cave system. This means the PC has very little choice how he progresses. He must make his way through each room, and face each challenge. This is both an advantage and a disadvantage. If I was building this cave system for ‘Full Mod’, I must admit I would have spent much more time on it.  


It would for instance have been nice to give players alternative paths, so those who prefer to avoid ‘hack and Slash’ trawling could sneak pat a few goons. Of course you would then have to set up a few more traps to keep them on their toes. One of things I have been disappointed about has been the lack of intelligent traps in Oblivion. By that I mean traps and puzzles where you have to stop and think of a solution. The game mechanics don’t easily lend them selves to this but it is a shame.
It would for instance have been nice to give players alternative paths, so those who prefer to avoid ‘hack and Slash’ trawling could sneak pat a few goons. Of course you would then have to set up a few more traps to keep them on their toes. One of things I have been disappointed about has been the lack of intelligent traps in Oblivion. By that I mean traps and puzzles where you have to stop and think of a solution. The game mechanics don’t easily lend them selves to this but it is a shame.
Line 640: Line 681:
I don’t intend to give you a click by click, bit by bit guide to building dungeons. If you get stuck use the PLAYTEST version as a guide.  
I don’t intend to give you a click by click, bit by bit guide to building dungeons. If you get stuck use the PLAYTEST version as a guide.  


[b]
'''Dressing the Dungeon.'''
Dressing the Dungeon.[/b]


Okay, let’s add some bits to help move our story forward. First let’s add an Xmarkerheading close to the interior door. We can then use the marker as a reference in an addition to our growing quest script.
Okay, let’s add some bits to help move our story forward. First let’s add an Xmarkerheading close to the interior door. We can then use the marker as a reference in an addition to our growing quest script.


[i]if (GetStage BGM001 == 70)
if (GetStage BGM001 == 70)
if (player.GetDistance BGRRCaveMarkerRef <= 300)
  if (player.GetDistance BGRRCaveMarkerRef <= 300)
SetStage BGM001 80
    SetStage BGM001 80
endif
  endif
endif[/i]
endif


We can also update the Journal  
We can also update the Journal  


[i]I've Arrived at the Red Rose Brigades Hideout. I will need to move cautiously. I need that house key.[/i]
''I've Arrived at the Red Rose Brigades Hideout. I will need to move cautiously. I need that house key.''


Although this first chamber is quite large, I have decided to limit the threat to a single small random creature, a rat or a crab (LL0NuissanceBeast100). Why? Two reasons I want to be able to escalate my threat and I want to build suspense.
Although this first chamber is quite large, I have decided to limit the threat to a single small random creature, a rat or a crab (LL0NuissanceBeast100). Why? Two reasons I want to be able to escalate my threat and I want to build suspense.
Line 660: Line 700:


The player is also expecting to meet bad guys, hopefully he will edge his character down into the first chamber fully expecting an army of trolls. I want to disappoint him. I want him to start to think this is easy before we hit him/her with the big stuff.
The player is also expecting to meet bad guys, hopefully he will edge his character down into the first chamber fully expecting an army of trolls. I want to disappoint him. I want him to start to think this is easy before we hit him/her with the big stuff.
I also want to set the scene a little. For this I created another corpse, and placed near it a letter which informs them about the special treasure chest and Browns imprisonment.
 
I also want to set the scene a little. For this I created another corpse, and placed near it a letter which informs them about the special treasure chest and Brown's imprisonment.
 
Make a corpse and the letter. Don’t give the corpse too much inventory, after all this is a freebee. I also added a levelled nuisance creature at the far end of the chamber; this should allow the PC to get to the corpse and then have to deal with the annoyance of a one hit kill creature.
Make a corpse and the letter. Don’t give the corpse too much inventory, after all this is a freebee. I also added a levelled nuisance creature at the far end of the chamber; this should allow the PC to get to the corpse and then have to deal with the annoyance of a one hit kill creature.


The text for the letter is
The text for the letter is
[i]<br>
<pre><br>
<font face=5><br>
<font face=5><br>
Dear Smith,
Dear Smith,
Line 671: Line 713:
I beg of you, please help me. Blair has gone mad. I have been imprisoned<br>
I beg of you, please help me. Blair has gone mad. I have been imprisoned<br>
<br>
<br>
It all began when we attacked the White Horse Courier near Chorrol. It was supposed to be a simple robbery. But when Blair found that the only treasure was a key to a house and a deed which had to be registered in the Imperial City he went beserk.  
It all began when we attacked the White Horse Courier near Chorrol.
It was supposed to be a simple robbery. But when Blair found that the only treasure
was a key to a house and a deed which had to be registered in the Imperial City he went beserk.  
<br>
<br>
He killed the courier in cold blood. I wanted no part of it.<br>
He killed the courier in cold blood. I wanted no part of it.<br>
I suggested the gang might do better with me in charge. He accused me of being a member of our rivals, the Torch Gang. Now he's had me locked up because I know how to open his treasure chest. He wants to  kill me but he fears the other gang members might turn on him.
I suggested the gang might do better with me in charge. He accused me of being a
member of our rivals, the Torch Gang. Now he's had me locked up because I know how
to open his treasure chest. He wants to  kill me but he fears the other gang members
might turn on him.
<br>
<br>
Please Smith, send help.I have asked one of gang member loyal to me to take this letter to you. I hope he makes it. Blair is watching my every move.
Please Smith, send help.I have asked one of gang member loyal to me to take this
letter to you. I hope he makes it. Blair is watching my every move.
<br>
<br>
<br>
<br>
Your old friend,
Your old friend,
<br>
<br>
Brown[/i]
Brown</pre>
 
We make and add the following script to the letter
We make and add the following script to the letter


[b]Scriptname BGM001BrownScript
<pre>Scriptname BGM001BrownScript


Begin OnAdd Player
Begin OnAdd Player
Line 692: Line 741:
EndIf
EndIf


End
End</pre>
[/b]


Again we can bump the stage and enter another journal entry for stage 90
Again we can bump the stage and enter another journal entry for stage 90


[i]I have found a letter from Brown. It appears the Red Rose leader has imprisoned him. Brown has knowledge of a secret treasure. I should try to talk to him
''I have found a letter from Brown. It appears the Red Rose leader has imprisoned him. Brown has knowledge of a secret treasure. I should try to talk to him.''
[/i]
 
Finally I messed about with the lighting, to try to create a little more atmosphere. Clearly caves should be darker than the normal world. Try to use spot lights to pick out the bit you want the PC to see and to hide threats you want to be a surprise.
Finally I messed about with the lighting, to try to create a little more atmosphere. Clearly caves should be darker than the normal world. Try to use spot lights to pick out the bit you want the PC to see and to hide threats you want to be a surprise.


The second chamber will contain a single NPC. We want all the Red Rose Brigade NPC’s to act as a team. How? Factions are the answer.
The second chamber will contain a single NPC. We want all the Red Rose Brigade NPC’s to act as a team. How? Factions are the answer.


[b]Factions[/b]
'''Factions'''


Factions are used in three ways by the game. Firstly they are used to establish a hierarchy or internal structure for organisations the PC can join. Secondly they are used to group NPC’s into teams with similar behaviours; these teams will act to protect each other when threatened. The final use of factions is to collect NPC’s together to allow grouped conditions statements.
Factions are used in three ways by the game. Firstly they are used to establish a hierarchy or internal structure for organisations the PC can join. Secondly they are used to group NPC’s into teams with similar behaviours; these teams will act to protect each other when threatened. The final use of factions is to collect NPC’s together to allow grouped conditions statements.
Line 720: Line 768:


We want the Red Rose member to be openly hostile to the PC. This is achieved because there is a faction called the PlayerFaction which has a solitary member, the PC. We can adjust the Red Rose disposition for this faction to -100. This means they will hate us and attack on site.
We want the Red Rose member to be openly hostile to the PC. This is achieved because there is a faction called the PlayerFaction which has a solitary member, the PC. We can adjust the Red Rose disposition for this faction to -100. This means they will hate us and attack on site.
Create a NPC. I used the BanditMelee character as a base Template. This character already comes with levelled armour etc. Although the will appear to be naked in the render window.
 
Create an NPC. I used the BanditMelee character as a base Template. This character already comes with levelled armour etc. Although the will appear to be naked in the render window.


I also popped in a chest, renamed it so I could alter it contents and add a few coins. The levelness of a NPC is controlled by the flags and boxes to the left of the character box.  
I also popped in a chest, renamed it so I could alter it contents and add a few coins. The levelness of a NPC is controlled by the flags and boxes to the left of the character box.  
Line 726: Line 775:
We can make two choices.
We can make two choices.


[b]Level to a value[/b]: In this option we select a pre ordained level for the NPC. The advantage is that we can control how tough a NPC is, and therefore the challenge set by that enemy. This is ideal if we have a particular reward which we feel should be earned by high ranking, or indeed low ranking PC’s. Suppose you design a one hit kill sword. This is a big reward. The player should have to earn this reward by defeating a big boss.  
'''Level to a value''': In this option we select a pre ordained level for the NPC. The advantage is that we can control how tough a NPC is, and therefore the challenge set by that enemy. This is ideal if we have a particular reward which we feel should be earned by high ranking, or indeed low ranking PC’s. Suppose you design a one hit kill sword. This is a big reward. The player should have to earn this reward by defeating a big boss.  
 
Equally, perhaps the reward is a few coins. Then it may be appropriate to set a simple challenge.
Equally, perhaps the reward is a few coins. Then it may be appropriate to set a simple challenge.
The disadvantage is that if you set an NPC at level 40, only a small number of players will meet this challenge, and many may simple unplug your mod.  
The disadvantage is that if you set an NPC at level 40, only a small number of players will meet this challenge, and many may simple unplug your mod.  
[b]
 
Level against PC:[/b] This is one of the more controversial developments in Oblivion. Many Morrowind veterans have been particularly vocal in their criticism of these technique. The advantage is that no matter what level your PC is at you will meet a decent challenge which will test your PC. It allows access to all PC’s and does not exclude any. However, it has disadvantages as well. This approach does mean that sometime the risk does not match the reward.  
'''Level against PC''': This is one of the more controversial developments in Oblivion. Many Morrowind veterans have been particularly vocal in their criticism of this technique. The advantage is that no matter what level your PC is at you will meet a decent challenge which will test your PC. It allows access to all PC’s and does not exclude any. However, it has disadvantages as well. This approach does mean that some times the risk does not match the reward.  


For this tutorial I have chosen to use the Level against PC method as this is the Oblivion norm. It is of course a matter for each designer to choose. I would suggest that what ever method you choose is consistent through out the mod. If you mix and match you could have the situation where the first goons is 10 levels above your boss, or a situation where after defeating a series of level 2 goons you suddenly encounter a level 30 boss.
For this tutorial I have chosen to use the Level against PC method as this is the Oblivion norm. It is of course a matter for each designer to choose. I would suggest that what ever method you choose is consistent through out the mod. If you mix and match you could have the situation where the first goons is 10 levels above your boss, or a situation where after defeating a series of level 2 goons you suddenly encounter a level 30 boss.
Line 741: Line 792:


Finally I messed around with the lighting a bit. I wanted to give a stealthy player a chance. I remove the lighting from the linking corridor and close to the entrance.  
Finally I messed around with the lighting a bit. I wanted to give a stealthy player a chance. I remove the lighting from the linking corridor and close to the entrance.  
[b]
 
The Final Chamber.[/b]
'''The Final Chamber'''


This consists of a large chamber with two ante chambers. In the first ante chamber we create a cell by placing a door in the corridor. We can use this to house NPC BGBrown. I used the Bandit Boss as a model, but removed his factions.. Remember do not make Brown a member of the faction.  
This consists of a large chamber with two ante chambers. In the first ante chamber we create a cell by placing a door in the corridor. We can use this to house NPC BGBrown. I used the Bandit Boss as a model, but removed his factions.. Remember do not make Brown a member of the faction.  
Line 755: Line 806:
Add the BGTopViewKey to the house to Blairs inventory. Now create a ’uncertified’ deed and add this to his inventory.  
Add the BGTopViewKey to the house to Blairs inventory. Now create a ’uncertified’ deed and add this to his inventory.  


[i]Deed Text.
<pre>Deed Text.


<font face=5>
<font face=5>
Line 765: Line 816:
<BR>
<BR>
This document also empowers the bearer transfer rights to reassign the property as he sees fit. The bearer may amend this document to rename the manor  by submitting the proper forms and payments to the Tamerial Construction Charter and by filing duplicate forms with the Documents Division of the Imperial City Archives.
This document also empowers the bearer transfer rights to reassign the property as he sees fit. The bearer may amend this document to rename the manor  by submitting the proper forms and payments to the Tamerial Construction Charter and by filing duplicate forms with the Documents Division of the Imperial City Archives.
THIS DOCUMENT MUST BE REGISTERED IN THE IMPERIAL CITY BY A QUALIFIED NOTARY PUBLIC TO GAIN LEGAL FORCE
THIS DOCUMENT MUST BE REGISTERED IN THE IMPERIAL CITY BY A QUALIFIED NOTARY PUBLIC TO GAIN LEGAL FORCE.</pre>
[/i]


This document explains why we have to return to the Imperial City
This document explains why we have to return to the Imperial City
Line 775: Line 825:


How does the game know he is dead? Scripts of course. We can combine both functions into a single script.
How does the game know he is dead? Scripts of course. We can combine both functions into a single script.
[b]Scriptname BGBlairDeathScript
 
<pre>Scriptname BGBlairDeathScript


short doOnce
short doOnce
Line 796: Line 847:
endif
endif


End[/b]
End</pre>


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
CONVERSATION<br />
BGMBlairGreet
BGMBlairGreet
RESPONSE
 
RESPONSE<br />
You are a fool for coming here. Now prepare to die.
You are a fool for coming here. Now prepare to die.


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


GetStage
RESULT SCRIPT
BGM001 == 90
ADD TOPICS
RESULT SCRIPT


When the PC kills Blair we can then update the journal
When the PC kills Blair we can then update the journal


[i]I have killed Blair. I should search his body for the deed and my house key. I should also see if he has a key so I can release Brown. I can then return to the Imperial City to see Vilanus[/i].
''I have killed Blair. I should search his body for the deed and my house key. I should also see if he has a key so I can release Brown. I can then return to the Imperial City to see Vilanus.''


We have set the quest up so that as well as the reward of the house the player can also get access to the treasure chest if they get the combination this is dictated by setting up a choices dialogue through Brown.  
We have set the quest up so that as well as the reward of the house the player can also get access to the treasure chest if they get the combination this is dictated by setting up a choices dialogue through Brown.  


Initially we set up a greeting.  
Initially we set up a greeting.  
TOPIC
 
TOPIC<br />
Greeting
Greeting


RESPONSE
RESPONSE<br />
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
CONDITIONS<br />
GetIsId  BGBrown == 1
GetIsId  BGBrown == 1<br />
GetStage  
GetStage BGM001 == 90
BGM001 == 90


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


RESULT SCRIPT
RESULT SCRIPT
 
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
TOPIC<br />
BGBrownC1
BGBrownC1


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


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


ADD TOPICS
ADD TOPICS
RESULT SCRIPT SetStage BGM001 100
 
RESULT SCRIPT
SetStage BGM001 100
 
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


[i]Brown has given me the code to the Combination Chest I need to enter the numbers 147 to unlock it. Once I've done that I will need to go and see Vilanus Villa in the Imperial City. Vilanus will need to transfer ownership of my uncle's house to me.[/i]
''Brown has given me the code to the Combination Chest I need to enter the numbers 1 4 7 to unlock it. Once I've done that I will need to go and see Vilanus Villa in the Imperial City. Vilanus will need to transfer ownership of my uncle's house to me.''


The script is used to remove the quest object status from a number of items which are no longer needed and which the PC can now dispose of.
The script is used to remove the quest object status from a number of items which are no longer needed and which the PC can now dispose of.


[b]SetQuestObject BGHideoutCELLKey 0
SetQuestObject BGHideoutCELLKey 0
SetQuestObject BGHideoutKey 0
SetQuestObject BGHideoutKey 0
SetQuestObject BGBrownLetter 0
SetQuestObject BGBrownLetter 0
SetQuestObject BGPartialLetter 0
SetQuestObject BGPartialLetter 0
[/b]


TOPIC
TOPIC<br />
BGBrownC2
BGBrownC2


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


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


ADD TOPICS
ADD TOPICS
 
RESULT SCRIPT
RESULT SCRIPT
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 882: Line 939:
It controls a chest with a three digit combination style lock.
It controls a chest with a three digit combination style lock.


[b]Scriptname BGCombinationChestScript
<pre>Scriptname BGCombinationChestScript


Short DigitCount
Short DigitCount
Line 923: Line 980:


If (DigitCount == 2)
If (DigitCount == 2)
MessageBox, "Please input the second digit of the combination","0","1","2","3","4","5","6","7","8","9"
MessageBox, "Please input the second digit of the combination",
"0","1","2","3","4","5","6","7","8","9" ;one line
Set DigitCount to 3
Set DigitCount to 3
EndIf
EndIf
Line 938: Line 996:


If (DigitCount == 4)
If (DigitCount == 4)
MessageBox, “Please input the third digit of the combination","0","1","2","3","4","5","6","7","8","9"
MessageBox, “Please input the third digit of the combination",
"0","1","2","3","4","5","6","7","8","9" ;one line
Set DigitCount to 5
Set DigitCount to 5
EndIf
EndIf
Line 1,004: Line 1,063:
return
return
EndIf
EndIf
End
End</pre>
 
In this case we control when the script runs using what I call a two block script. The first block sets up the conditions in which the second block works.
In this case we control when the script runs using what I call a two block script. The first block sets up the conditions in which the second block works.


Begin OnActivate
<pre>Begin OnActivate


If (ChestOpen == 2)
If (ChestOpen == 2)
Line 1,015: Line 1,075:
EndIf
EndIf


End
End</pre>
[/b]
 
This first block runs only when the chest is activated. It uses a control variable called ChestOpen.  
This first block runs only when the chest is activated. It uses a control variable called ChestOpen.  


Line 1,030: Line 1,090:


We use the Chest Open == 1 to enable the main body of the script.
We use the Chest Open == 1 to enable the main body of the script.
[i]
 
If (ChestOpen == 1)[/i]
If (ChestOpen == 1)


For this we use another variable called DigitCount to help work through the different stages of the script
For this we use another variable called DigitCount to help work through the different stages of the script


[i]If (DigitCount == 0)
<pre> If (DigitCount == 0)
MessageBox, "Please input the first digit of the combination","0","1","2","3","4","5","6","7","8","9"
MessageBox, "Please input the first digit of the combination",
"0","1","2","3","4","5","6","7","8","9" ;should be one line
Set DigitCount to 1
Set DigitCount to 1
EndIf
EndIf</pre>
[/i]
 
Note here that the message box statement must all be on one line of code. On some editors the word wrap may make it look like this is on two or even three lines. If you cut and paste, the script editor may pick this up.  The PC can now  select the first digit.
Note here that the message box statement must all be on one line of code. On some editors the word wrap may make it look like this is on two or even three lines. If you cut and paste, the script editor may pick this up.  The PC can now  select the first digit.


[i]if (DigitCount == 1)
<pre> if (DigitCount == 1)
set button1 to GetButtonPressed
set button1 to GetButtonPressed
if button1 == -1
if button1 == -1
Line 1,050: Line 1,111:
Set DigitCount to 2
Set DigitCount to 2
EndIf
EndIf
EndIf
EndIf</pre>
[/i]


We then set the value of  Button1. We also bump DigitCount up one to enable the next step. If no button is pressed the script halt for that frame only using the return command. We then repeat this process to get the second and third  digits.
We then set the value of  Button1. We also bump DigitCount up one to enable the next step. If no button is pressed the script halt for that frame only using the return command. We then repeat this process to get the second and third  digits.
[i]If (DigitCount == 2)
<pre> If (DigitCount == 2)
MessageBox, “Please input the second digit of the combination","0","1","2","3","4","5","6","7","8","9"
MessageBox, “Please input the second digit of the combination",
"0","1","2","3","4","5","6","7","8","9" ;again, one line
Set DigitCount to 3
Set DigitCount to 3
EndIf
EndIf
Line 1,070: Line 1,131:


If (DigitCount == 4)
If (DigitCount == 4)
MessageBox, “Please input the third digit of the combination","0","1","2","3","4","5","6","7","8","9"
MessageBox, “Please input the third digit of the combination",
"0","1","2","3","4","5","6","7","8","9" ;one line
Set DigitCount to 5
Set DigitCount to 5
EndIf
EndIf
Line 1,082: Line 1,144:
Set DigitCount to 6
Set DigitCount to 6
EndIf
EndIf
EndIf
EndIf</pre>
[/i]
 
Once Digit count is at 6 we can test to see if the combination is indeed 1 4 7. We use another variable called CombiRight to track this. If this reaches 3 the PC has opened the chest.
Once Digit count is at 6 we can test to see if the combination is indeed 1 4 7. We use another variable called CombiRight to track this. If this reaches 3 the PC has opened the chest.
i[i]f (DigitCount == 6)
 
<pre> if (DigitCount == 6)
If button1 == 1
If button1 == 1
Set CombiRight to CombiRight +1
Set CombiRight to CombiRight +1
Line 1,095: Line 1,158:
Set CombiRight to CombiRight +1
Set CombiRight to CombiRight +1
EndIf
EndIf
EndIf
EndIf</pre>
[/i]
 
We test that CombiRight is indeed 3. If it is we set the chest open variable to 2, and we reset the digit count to zero to end any further progression.
We test that CombiRight is indeed 3. If it is we set the chest open variable to 2, and we reset the digit count to zero to end any further progression.


[i]If (DigitCount == 6) && (CombiRight ==3)
<pre> If (DigitCount == 6) && (CombiRight ==3)
Set ChestOpen to 2
Set ChestOpen to 2
set DigitCount to 0
set DigitCount to 0
return
return
EndIf
EndIf</pre>
[/i]


If it fails we want to punish the player for his failure, and nothing hurts quite lick taking a chunk of gold off the PC.  
If it fails we want to punish the player for his failure, and nothing hurts quite lick taking a chunk of gold off the PC.  


[i]If (DigitCount == 6) && (CombiRight <=2)
If (DigitCount == 6) && (CombiRight <=2)
[/i]
 
This bit of script displays a message
This bit of script displays a message


[i]MessageBox, “Naughty, naughty. Now take your punishment"[/i]
MessageBox, “Naughty, naughty. Now take your punishment"[/i]


Then checks that the PC can afford the ‘fine’
Then checks that the PC can afford the ‘fine’


[i]If (Player.GetItemCount "gold001") >=100
If (Player.GetItemCount "gold001") >=100
[/i]
 
It takes away the gold from the PC and then adds it to the chest. It then resets the control variable so the player  can try to open the chest again.
It takes away the gold from the PC and then adds it to the chest. It then resets the control variable so the player  can try to open the chest again.


[i]Player.RemoveItem "gold001" 100
Player.RemoveItem "gold001" 100
BGBlairChestref.additem "gold001" 100
BGBlairChestref.additem "gold001" 100
      Set DigitCount to 0
      Set DigitCount to 0
Set ChestOpen to 0
Set ChestOpen to 0
Return[/i]
Return


Of course the player may not have 100 septims, so we use a variable called gold count which we set to the value of the player’s current gold count
Of course the player may not have 100 septims, so we use a variable called gold count which we set to the value of the player’s current gold count


[i]Else
Else
Set GoldCount to Player.GetItemCount "gold001" [/i]
Set GoldCount to Player.GetItemCount "gold001"


Then we take that away and add it to the chest.
Then we take that away and add it to the chest.


[i]Player.RemoveItem "gold001" GoldCount
Player.RemoveItem "gold001" GoldCount
BGBlairChestref.additem "Gold001" GoldCount
BGBlairChestref.additem "Gold001" GoldCount
Player.Additem "gold001" 1
Player.Additem "gold001" 1
Set DigitCount to 0
Set DigitCount to 0
Set ChestOpen to 0
Set ChestOpen to 0
EndIf
EndIf
EndIf


EndIf[/i]
Finally we wrap the script up with a couple of brief tidy ups. The first deals with the fact that the game mode block will run every frame while we are in the dungeon cell. Not just the room. Prior to touching the chest the chest open status is 0. If this is so the script returns and does nothing for the frame.


Finally we wrap the script up with a couple of brief tidy ups. The first deals with the fact that the game mode block will run every frame while we are in the dungeon cell. Not just the room. Prior to touching the chest the chest open status is 0. If this is so the script returns and does nothing for the frame.
elseIF (ChestOpen == 0)
  Return


[i]elseIF (ChestOpen == 0)
Return
[/i]
This bit opens the chest if we have the correct combination.
This bit opens the chest if we have the correct combination.


[i]ElseIF (ChestOpen == 2)
ElseIF (ChestOpen == 2)
If DoOnce == 0
If DoOnce == 0
set DoOnce to 1
set DoOnce to 1
BGBlairChestref.Activate Player
BGBlairChestref.Activate Player
return
return
EndIf
EndIf
else
else
return
return
EndIf
EndIf
End[/i]
End
 
Now its time to wrap up our little adventure. We move the scene back to the Imperial City
Now its time to wrap up our little adventure. We move the scene back to the Imperial City


[b]Imperial City Phase Two.[/b]
'''Imperial City Phase Two'''
 
Objective:- ''In this phase the player will again meet Vilanus, who will set about transferring the deeds of the property over to you. After 24 hours you can revisit and he will have the documents ready.''


Objective:- [i]In this phase the player will again meet Vilanus, who will set about transferring the deeds of the property over to you. After 24 hours you can revisit and he will have the documents ready.[/i]
We will need
We will need


[i]A second complete deed document.
''A second complete deed document.
The Prize House.
The Prize House.
A map marker.[/i]
A map marker''


We begin with another dialogue pair involving Vilanus Villa.  
We begin with another dialogue pair involving Vilanus Villa.  
One for before you have the key and deed.  
One for before you have the key and deed.  
The second for when you are successful.  
The second for when you are successful.  


Again we need to add a small bit of script to the Quest Script to check for this.
Again we need to add a small bit of script to the Quest Script to check for this.


If (Player.GetItemCount "BGM001HouseDeedUC">=1) &&(Player.GetItemCount "BGTopViewKey">=1) {ALL ON ONE LINE}
<pre>If (Player.GetItemCount "BGM001HouseDeedUC">=1) &&(Player.GetItemCount "BGTopViewKey">=1)
[indent]If DoOnce3 ==0
If DoOnce3 ==0
Set QuestWon to 1
Set QuestWon to 1
Set DoOnce3 to 1/[indent]
Set DoOnce3 to 1
EndIf
EndIf
EndIf
EndIf</pre>


TOPIC
TOPIC<br />
Greeting
Greeting


RESPONSE
RESPONSE<br />
I can't help you until you find the key and deed  
I can't help you until you find the key and deed.<br />
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
CONDITIONS<br />
GetIsId  BGVilanusVilla == 1
GetIsId  BGVilanusVilla == 1<br />
GetStage BGM001 >= 80
GetStage BGM001 >= 80<br />
GetQuestVariable BGM001.QuestWon == 0
GetQuestVariable BGM001.QuestWon == 0


ADD TOPICS
ADD TOPICS
RESULT SCRIPT
 
RESULT SCRIPT
 
and
and


TOPIC
TOPIC<br />
Greeting
Greeting


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


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


ADD TOPICS
ADD TOPICS
RESULT SCRIPT
 
AddTopic BGTopView (add topic via script to avoid issue with GREETINGS add topic's not appearing in the game)
RESULT SCRIPT<br />
AddTopic BGTopView
 
(add topic via script to avoid issue with GREETINGS add topic's not appearing in the game)
 
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
TOPIC<br />
BGTopView (Top View Cottage?)
BGTopView (Top View Cottage?)


RESPONSE
RESPONSE<br />
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
CONDITIONS<br />
GetIsId  BGVilanusVilla == 1
GetIsId  BGVilanusVilla == 1<br />
GetQuestVariable BGM001.QuestWon == 1
GetQuestVariable BGM001.QuestWon == 1


ADD TOPICS
ADD TOPICS<br />
BGTopView
BGTopView


RESULT SCRIPT
RESULT SCRIPT<br />
Player.RemoveItem "BGM001HouseDeeduc" 1
Player.RemoveItem "BGM001HouseDeeduc" 1
SetStage BGM001 110
SetStage BGM001 110
Stage 110 Journal Update
Stage 110 Journal Update
 
''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]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]
We want to set up a delay of one day before we can collect the finished documents. This gives us an excellent opportunity to look at and practice timers
We want to set up a delay of one day before we can collect the finished documents. This gives us an excellent opportunity to look at and practice timers
[b]
 
Timers[/b]
'''Timers'''


Timers are another bit of scripting that gets used again and again. The game uses a number of global variables to report the progress of time.  
Timers are another bit of scripting that gets used again and again. The game uses a number of global variables to report the progress of time.  
Line 1,243: Line 1,315:
The two most used are
The two most used are


[i]GetSecondsPassed  
GetSecondsPassed  
GameDaysPassed  
GameDaysPassed  
[/i]
 
We can use the seconds passed to establish timed events. We must use a float variable to interact with the GetSecondsPassed function.  
We can use the seconds passed to establish timed events. We must use a float variable to interact with the GetSecondsPassed function.  


Line 1,254: Line 1,326:


The Remove function can be replaced with any script you want to run prior to the countdown.  
The Remove function can be replaced with any script you want to run prior to the countdown.  
The 25 controls how long the script will run for.  
The 25 controls how long the script will run for.  


The Add function can be replaced by whatever you want to happen after the event.
The Add function can be replaced by whatever you want to happen after the event.


[i]Scriptname ExampleTimerScript
<pre>Scriptname ExampleTimerScript


float Timer
float Timer
Line 1,276: Line 1,349:
EndIf
EndIf
EndIf
EndIf
end
end</pre>
[/i]


When you plan to script longer events where precision is not essential you can use the courser GameDaysPassed function.  
When you plan to script longer events where precision is not essential you can use the courser GameDaysPassed function.  


In the quest script we add some variables called StartDay, Timer, and DeedDone.
In the quest script we add some variables called StartDay, Timer, and DeedDone.
[i]
 
If(GetStage BGM001 == 110)
<pre>If(GetStage BGM001 == 110)
If(Timer == 0)
If(Timer == 0)
Set StartDay to GameDaysPassed
Set StartDay to GameDaysPassed
Line 1,296: Line 1,368:
Else
Else
EndIf
EndIf
EndIf[/i]
EndIf</pre>
The timer variable controls which bits of script work.  
The timer variable controls which bits of script work.  
The DeedDone variable is used to enable dialogue.
The DeedDone variable is used to enable dialogue.


The key pair of script lines are
The key pair of script lines are


Set StartDay to GameDaysPassed
Set StartDay to GameDaysPassed


((GameDaysPassed - StartDay) >=1)
((GameDaysPassed - StartDay) >=1)


You replace the number 1 with the number of days you want the event to last.
You replace the number 1 with the number of days you want the event to last.


When the deed has not been completed (DeedDone== 0) use
When the deed has not been completed (DeedDone== 0) use
TOPIC
 
TOPIC<br />
BGTopView (Top View Cottage?)
BGTopView (Top View Cottage?)


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


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


ADD TOPICS
ADD TOPICS
RESULT SCRIPT
 
RESULT SCRIPT
 
Once the deed is done you produce this message
Once the deed is done you produce this message
TOPIC
 
TOPIC<br />
BGTopView (Top View Cottage?)
BGTopView (Top View Cottage?)


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


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


ADD TOPICS
ADD TOPICS
 
RESULT SCRIPT
RESULT SCRIPT<br />
SetStage BGM001 120
SetStage BGM001 120
 
and add a Journal Update for Stage 120
and add a Journal Update for Stage 120
[i]
Vilanus has completed the paperwork. I should now go visit my new home.[/i]


Once again we need to add a mapmarker to the outside of the house. Call it BGTopViewMapMarker
''Vilanus has completed the paperwork. I should now go visit my new home.''
 
Once again we need to add a mapmarker to the outside of the house. Call it BGTopViewMapMarker.
 
And the following quest stage result script is then added and complied
And the following quest stage result script is then added and complied
[b]
Results Script[/b]


[i]Player.additem "BGM001HouseDeed" 1
'''Results Script'''
TopViewPlayerDoor1Ref.SetOwnership
 
TopViewPlayerDoor2Ref.SetOwnership
Player.additem "BGM001HouseDeed" 1
SetCellOwnership Bgmodtut4
TopViewPlayerDoor1Ref.SetOwnership
SetCellOwnership Bgmodtu4base
TopViewPlayerDoor2Ref.SetOwnership
ShowMap BGTopViewMapMarker
SetCellOwnership Bgmodtut4
[/i]
SetCellOwnership Bgmodtu4base
ShowMap BGTopViewMapMarker
 
This script does the ownership transfer.


This script does the ownership transfer.
It sets the ownership of the two doors, and the two interior cells to the player.  
It sets the ownership of the two doors, and the two interior cells to the player.  
It also adds the finished certified document. Note this document is not a quest item.
It also adds the finished certified document. Note this document is not a quest item.


We can also add the following as an end of quest rep;ly from Vilanus.
We can also add the following as an end of quest reply from Vilanus.


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


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


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


ADD TOPICS
ADD TOPICS
RESULT SCRIPT
 
RESULT SCRIPT
 
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  
[i]if (GetStage BGM001 == 120)
 
<pre>if (GetStage BGM001 == 120)
if (player.GetDistance BGTopViewXMarker <= 300)
if (player.GetDistance BGTopViewXMarker <= 300)
SetStage BGM001 130
SetStage BGM001 130
EndIf
EndIf
EndIf[/i]
EndIf</pre>


This gives a final journal entry. We should also mark the quest as complete using the tab. Remember this does not end the quest. To do that we must use the StopQuest function
This gives a final journal entry. We should also mark the quest as complete using the tab. Remember this does not end the quest. To do that we must use the StopQuest function


[b]
''I have reached Top View. I am now free to explore my new home.''
I have reached Top View. I am now free to explore my new home.[/b]
 
And finally we add this result script. This removes the essential status from the three essential characters so you can go ahead and kill them now. It boosts the player fame (optional), and finally stops the quest.
And finally we add this result script. This removes the essential status from the three essential characters so you can go ahead and kill them now. It boosts the player fame (optional), and finally stops the quest.
[i]
 
ModPCFame 1
ModPCFame 1
SetEssential BGVilanusVilla 0
SetEssential BGVilanusVilla 0
SetEssential BGMSmith 0
SetEssential BGMSmith 0
SetEssential BGCptHubart 0
SetEssential BGCptHubart 0
StopQuest BGM001[/i]
StopQuest BGM001
So there you have it. A complete functional quest.  
So there you have it. A complete functional quest.  
Line 1,401: Line 1,484:
However, if you really want to wow the public with our release we will need to add some AI to our NPC’s and look at our options regarding Audio and Lip Sync, and that’s is what lesson 8 will be about.
However, if you really want to wow the public with our release we will need to add some AI to our NPC’s and look at our options regarding Audio and Lip Sync, and that’s is what lesson 8 will be about.


[b]Till Then Happy Modding.[/b]
'''Till Then Happy Modding.'''
 
[[Category: A beginner's guide]]