Difference between revisions of "A beginner's guide, lesson 7 - Using Scripts in Quests"
Jump to navigation
Jump to search
A beginner's guide, lesson 7 - Using Scripts in Quests (edit)
Revision as of 23:45, 16 August 2010
, 23:45, 16 August 2010→Imperial City Phase Two: Editing dialogue and script
imported>Pyrocow2 (→Setting up the resources: adding document name) |
imported>Pyrocow2 (→Imperial City Phase Two: Editing dialogue and script) |
||
Line 900: | Line 900: | ||
To set up the prize house, go to the interior cell ''BGmodtut4'', which is the interior of the house. It has three doors. One leads to the basement. The other two are linked to the exterior. Lock the exterior doors and set the ownership to our old buddy ''BGDummyOwner''. Set the interior cell ownership to ''BGDummyOwner'' as well. | To set up the prize house, go to the interior cell ''BGmodtut4'', which is the interior of the house. It has three doors. One leads to the basement. The other two are linked to the exterior. Lock the exterior doors and set the ownership to our old buddy ''BGDummyOwner''. Set the interior cell ownership to ''BGDummyOwner'' as well. | ||
We begin | ===New dialogue=== | ||
We begin by adding more dialogue for Vilanus Villa. | |||
First, set up three new topics: | |||
*BGDeedCheck | |||
*BGRecoverYes | |||
*BGRecoverNo | |||
Then add a new greeting: | |||
{| border="1" cellpadding="5" | {| border="1" cellpadding="5" | ||
Line 922: | Line 917: | ||
|- | |- | ||
! RESPONSE | ! RESPONSE | ||
| " | | "Hello, have you managed to recover the key and deed?" | ||
|- | |- | ||
! CONDITIONS | ! CONDITIONS | ||
Line 928: | Line 923: | ||
* GetIsID 'BGVilanusVilla' == 1 | * GetIsID 'BGVilanusVilla' == 1 | ||
* GetStage BGM001 >= 20 | * GetStage BGM001 >= 20 | ||
* | * GetStage BGM001 < 110 | ||
|- | |- | ||
! ADD TOPICS | ! ADD TOPICS | ||
| ''No add topics'' | | ''No add topics'' | ||
|- | |||
! CHOICES | |||
| | |||
*BGRecoverYes | |||
*BGRecoverNo | |||
|- | |- | ||
! RESULT SCRIPT | ! RESULT SCRIPT | ||
| ''No | | ''No result script'' | ||
|} | |} | ||
Then edit the choices. | |||
{| border="1" cellpadding="5" | {| border="1" cellpadding="5" | ||
!colspan=2| ''' | !colspan=2| '''BGRecoverNo''' | ||
|- | |- | ||
! TOPIC TEXT | ! TOPIC TEXT | ||
| " | | "No, not yet." | ||
|- | |- | ||
! RESPONSE | ! RESPONSE | ||
| " | | "I can't help you until you've found both the key and the deed." | ||
|- | |- | ||
! CONDITIONS | ! CONDITIONS | ||
| | | | ||
* GetIsID | * GetIsID 'BGVilanusVilla' == 1 | ||
* GetStage BGM001 | * GetStage 'BGM001' < 95 | ||
|- | |- | ||
! ADD TOPICS | ! ADD TOPICS | ||
Line 958: | Line 957: | ||
|- | |- | ||
! RESULT SCRIPT | ! RESULT SCRIPT | ||
| | | ''No result script'' | ||
|} | |} | ||
<br> | |||
{| border="1" cellpadding="5" | {| border="1" cellpadding="5" | ||
!colspan=2| ''' | !colspan=2| '''BGRecoverYes''' | ||
|- | |- | ||
! TOPIC TEXT | ! TOPIC TEXT | ||
| " | | "Yes. Here they are." | ||
|- | |- | ||
! RESPONSE | ! RESPONSE | ||
| "Excellent | | "Excellent. I will take the deed to the property registrar today. Come back tomorrow, the transfer should be complete by then." | ||
|- | |- | ||
! CONDITIONS | ! CONDITIONS | ||
| | | | ||
* GetIsID 'BGVilanusVilla' == 1 | * GetIsID 'BGVilanusVilla' == 1 | ||
* | * GetStage 'BGM001' >= 95 | ||
* GetItemCount 'BGTopViewKey' == 1 | |||
* GetItemCount 'BGTopViewUncertifiedDeed' == 1 | |||
|- | |- | ||
! ADD TOPICS | ! ADD TOPICS | ||
| | | | ||
* | *BGDeedCheck | ||
|- | |- | ||
! RESULT SCRIPT | ! RESULT SCRIPT | ||
| | | | ||
<pre> | <pre> | ||
Player.RemoveItem | Player.RemoveItem BGTopViewUncertifiedDeed 1 | ||
SetStage BGM001 110 | SetStage BGM001 110 | ||
</pre> | </pre> | ||
|} | |} | ||
Stage 110 Journal Update | Stage 110 Journal Update: | ||
'' | ''Vilanus told me that he is going to take the deed to the property registrar, and that I should check back with him tomorrow when the transfer is complete.'' | ||
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. | ||
Line 1,034: | Line 1,030: | ||
</pre> | </pre> | ||
If you're writing a script where you're only interested in the number of in-game days that have passed, you can use GameDaysPassed instead. | If you're writing a script where you're only interested in the number of in-game days that have passed, you can use GameDaysPassed instead (which is a short). | ||
In the quest script | In the quest script add three short variables called ''State'', ''StartDay'', and ''DeedFinished''. | ||
<pre> | Then add this to the GameMode block: | ||
<pre> | |||
If GetStage BGM001 == 110 | |||
If State == 0 | |||
Set StartDay to GameDaysPassed | |||
Set State to 1 | |||
ElseIf State == 1 | |||
If GameDaysPassed > StartDay | |||
Set DeedFinished to 1 | |||
Set State to 2 | |||
EndIf | |||
EndIf | |||
EndIf | |||
</pre> | |||
This piece of script goes through three states: | |||
#Stage 110 has begun. Initialize the StartDay value, and change to second state. | |||
#StartDay has been set. Check to see if the value of the current in-game date is more than StartDay (this will be true on any day after the starting day, including the first day after, which is what we want). Change to third state. | |||
#Finished. Do nothing. | |||
===More dialogue=== | |||
The ''DeedFinished'' variable will tell us when the game day is passed and the deed should be finished. We can use this variable for the next piece of dialogue. There will be two possible responses for this topic. One for when the deed is finished, and one for when it's not. | |||
{| border="1" cellpadding="5" | {| border="1" cellpadding="5" | ||
!colspan=2| '''BGDeedCheck''' | |||
|- | |- | ||
! TOPIC | ! TOPIC TEXT | ||
| | | "House Deed" | ||
|- | |- | ||
! RESPONSE | ! RESPONSE | ||
| | | "It should be finished by tomorrow. Check back with me then." | ||
|- | |- | ||
! CONDITIONS | ! CONDITIONS | ||
| | | | ||
* | * GetIsID 'BGVilanusVilla' == 1 | ||
* | * GetStage 'BGM001' == 110 | ||
* GetQuestVariable BGM001. | * GetQuestVariable 'BGM001.DeedFinished' == 0 | ||
|- | |- | ||
! ADD TOPICS | ! ADD TOPICS | ||
| | | ''No add topics'' | ||
|- | |- | ||
! RESULT SCRIPT | ! RESULT SCRIPT | ||
| | | ''No result script'' | ||
|} | |} | ||
<br> | |||
{| border="1" cellpadding="5" | {| border="1" cellpadding="5" | ||
!colspan=2| '''BGDeedCheck''' | |||
|- | |- | ||
! TOPIC | ! TOPIC TEXT | ||
| | | "House Deed" | ||
|- | |- | ||
! RESPONSE | ! RESPONSE | ||
| | | | ||
* | *"The paperwork went through and you are now the owner of the Top View cottage." | ||
* Here | *"Here's the certified deed. I'll mark the location of the house on your map." | ||
* May the | *"May the Gods be with you." | ||
|- | |- | ||
! CONDITIONS | ! CONDITIONS | ||
| | | | ||
* | * GetIsID 'BGVilanusVilla' == 1 | ||
* | * GetStage 'BGM001' == 110 | ||
* GetQuestVariable BGM001. | * GetQuestVariable 'BGM001.DeedFinished' == 1 | ||
|- | |- | ||
! ADD TOPICS | ! ADD TOPICS | ||
| | | ''No add topics'' | ||
|- | |- | ||
! RESULT SCRIPT | ! RESULT SCRIPT | ||
| | | | ||
<pre>SetStage BGM001 120</pre> | <pre> | ||
Player.AddItem BGTopViewDeed 1 | |||
SetStage BGM001 120 | |||
</pre> | |||
|} | |} | ||
<br> | |||
The new deed, ''BGTopViewDeed'', is just a copy of the old one without the very last line about needing to get it notarized. You do NOT need to make this a quest item. We don't need to force the player to keep it in their inventory. | |||
'' | Journal Update for Stage 120: | ||
''The paperwork is finished and I now have a certified deed for the Top View Cottage. I should go visit the property.'' | |||
===Finishing up=== | |||
Add a new map marker outside of the house (in Tamriel->TopViewCottage). Call it ''BGTopViewMapMarker''. Then edit the names of the two exit doors, to something like ''BGTVDoor1'' and ''BGTVDoor2''. | |||
Then add the following quest stage result script for stage 120: | |||
<pre> | |||
BGTVDoor1.SetOwnership | |||
BGTVDoor2.SetOwnership | |||
SetCellOwnership BGModTut4 | |||
SetCellOwnership BGModTu4Base | |||
ShowMap BGTopViewMapMarker | |||
</pre> | |||
This script transfers ownership of the house doors and cells to the player, and then enables the map marker. | |||
We then complete the quest script with a final block to check when the PC arrives at the house. | |||
<pre> | |||
If GetStage BGM001 == 120 | |||
If Player.GetInCell BGModTut4 || Player.GetInCell BGModTu4Base | |||
SetStage BGM001 130 | |||
EndIf | |||
EndIf | |||
</pre> | |||
| | |||
| | |||
For this stage, you can check the ''Quest Complete'' box. Remember, this does not truly end the quest. To do that we must use the [[StopQuest]] function. | |||
The final journal entry: | |||
''I have reached Top View. I am now free to explore my new home.'' | |||
Finally, we add this quest stage result script to stage 130. | |||
<pre> | |||
ModPCFame 1 | |||
SetEssential BGVilanusVilla 0 | |||
SetEssential BGMSmith 0 | |||
SetEssential BGCptHubart 0 | |||
StopQuest BGM001 | |||
</pre> | |||
The [[SetEssential]] commands remove the essential status from all of the essential characters we created earlier. [[ModPCFame]] boosts the player's fame by 1 point (optional). StopQuest stops the quest from running, and disables all of its dialogue. | |||
So there you have it. A | So there you have it. A completely functional quest. | ||
However, if | However, if we 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 what lesson 8 will be about. | ||
'''Till | '''Till then, happy modding!''' | ||
== Thanks == | == Thanks == |