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 02:07, 14 August 2010
, 02:07, 14 August 2010→The Final Chamber: Editing English, tables, scripts
imported>Pyrocow2 (→Imperial City Phase Two: prize house stuff. to be edited more) |
imported>Pyrocow2 (→The Final Chamber: Editing English, tables, scripts) |
||
Line 632: | Line 632: | ||
<BR> | <BR> | ||
The bearer has full ownership rights to all of the structures, flora and land within | The bearer has full ownership rights to all of the structures, flora and land within | ||
the property borders as defined in the | the property borders as defined in the Tamriel Construction Charter. The bearer is | ||
responsible for all matters pertaining to or occurring on said property.<BR> | responsible for all matters pertaining to or occurring on said property.<BR> | ||
<BR> | <BR> | ||
This document also empowers the bearer transfer rights to reassign the property as he | 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 | sees fit. The bearer may amend this document to rename the manor by submitting the | ||
proper forms and payments to the | proper forms and payments to the Tamriel Construction Charter and by filing | ||
duplicate forms with the Documents Division of the Imperial City Archives. | duplicate forms with the Documents Division of the Imperial City Archives.<BR> | ||
THIS DOCUMENT MUST BE REGISTERED IN THE IMPERIAL CITY BY A QUALIFIED NOTARY PUBLIC TO GAIN LEGAL FORCE.</pre> | THIS DOCUMENT MUST BE REGISTERED IN THE IMPERIAL CITY BY A QUALIFIED NOTARY PUBLIC TO GAIN LEGAL FORCE.<BR></pre> | ||
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 645: | Line 645: | ||
Both Blair and Brown will need special AI packages to get them to work properly. | Both Blair and Brown will need special AI packages to get them to work properly. | ||
I also want to make sure that the player, no matter how good they are at sneaking, will be forced to confront Blair. How do we do this? Easy, we script it. We will also design the quest so that you will have to kill Blair to move on to the next stage. | I also want to make sure that the player, no matter how good they are at sneaking, will be forced to confront Blair. How do we do this? Easy, we script it. We will also design the quest so that you will have to kill Blair to move on to the next stage. We can also do this through scripts. | ||
Attach this script to the Blair NPC:<br> | |||
<pre>Scriptname BGBlairScript | |||
<pre>Scriptname | |||
Short DoOnce | Short DoOnce | ||
Line 689: | Line 688: | ||
|- | |- | ||
! ADD TOPICS | ! ADD TOPICS | ||
| | | ''No add topics'' | ||
|- | |- | ||
! RESULT SCRIPT | ! RESULT SCRIPT | ||
| | | ''No result script'' | ||
|} | |} | ||
When the PC kills Blair we can | When the PC kills Blair, we can also update the journal by adding an entry for stage 95. | ||
''I have killed Blair. I should search his body for the deed and | ''I have killed Blair. I should search his body for the deed and house key. I should also see if he has a key to Brown's cell. I can then return to the Imperial City to see Vilanus.'' | ||
We | We can set up an optional reward for players who choose to free Brown from his cell. | ||
First, we set up a greeting for Brown. | |||
{| border="1" cellpadding="5" | {| border="1" cellpadding="5" | ||
!colspan=2| '''GREETING''' | |||
|- | |- | ||
! TOPIC | ! TOPIC TEXT | ||
| | | GREETING | ||
|- | |- | ||
! RESPONSE | ! RESPONSE | ||
| | | Please, please, don't kill me! I had no hand in this. Just let me go. | ||
|- | |- | ||
! CONDITIONS | ! CONDITIONS | ||
| | | | ||
* | * GetIsID 'BGBrown' == 1 | ||
* GetStage BGM001 >= 95 | * GetStage 'BGM001' >= 95 | ||
|- | |- | ||
! ADD TOPICS | ! ADD TOPICS | ||
| | | | ||
* | * BGBrownChoice1 | ||
* | * BGBrownChoice2 | ||
|- | |- | ||
! RESULT SCRIPT | ! RESULT SCRIPT | ||
| | | ''No result script'' | ||
|} | |} | ||
The positive response | |||
The positive response, ''BGBrownChoice1'', will give a stage boost. The negative response, ''BGBrownChoice2'', will not. | |||
{| border="1" cellpadding="5" | {| border="1" cellpadding="5" | ||
!colspan=2| '''BGBrownChoice1''' | |||
|- | |- | ||
! TOPIC | ! TOPIC TEXT | ||
| | | You can go. | ||
|- | |- | ||
! RESPONSE | ! RESPONSE | ||
| | | Thank you! Thank you! The code is one, four, seven. | ||
|- | |- | ||
! CONDITIONS | ! CONDITIONS | ||
| | | | ||
* | * GetIsID 'BGBrown' == 1 | ||
* GetStage BGM001 >= 95 | * GetStage 'BGM001' >= 95 | ||
|- | |- | ||
! ADD TOPICS | ! ADD TOPICS | ||
| | | ''No add topics'' | ||
|- | |- | ||
! RESULT SCRIPT | ! RESULT SCRIPT | ||
| | | <pre>SetStage BGM001 100</pre> | ||
<pre>SetStage BGM001 100</pre> | |||
|} | |} | ||
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. | ||
''Brown | ''Brown gave me the code for the combination lock on the chest. I need to enter 1-4-7 to unlock it. Once I've done that, I will need to go see Vilanus Villa in 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 stage result 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. | ||
<pre> | |||
SetQuestObject BGHideoutCELLKey 0 | |||
SetQuestObject BGHideoutKey 0 | |||
SetQuestObject BGBrownLetter 0 | |||
SetQuestObject BGPartialLetter 0 | |||
</pre> | |||
{| border="1" cellpadding="5" | {| border="1" cellpadding="5" | ||
!colspan=2| '''BGBrownChoice2''' | |||
|- | |- | ||
! TOPIC | ! TOPIC TEXT | ||
| | | No. | ||
|- | |- | ||
! RESPONSE | ! RESPONSE | ||
| | | You'll regret this! | ||
|- | |- | ||
! CONDITIONS | ! CONDITIONS | ||
| | | | ||
* | * GetIsID 'BGBrown' == 1 | ||
* GetStage BGM001 >= 95 | * GetStage 'BGM001' >= 95 | ||
|- | |- | ||
! ADD TOPICS | ! ADD TOPICS | ||
| | | ''No add topics'' | ||
|- | |- | ||
! RESULT SCRIPT | ! RESULT SCRIPT | ||
| | | ''No result script'' | ||
|} | |} | ||
We will need to look at altering | We will need to look at altering Brown's behavior for the final release. We will need to add some AI in the next lesson to get him to run away. | ||
What we | What we need to look at now is another hefty bit of scripting which will control the combination lock on the treasure chest. | ||
Here it is in its entirety. Look through it and try to work out what it is doing. | |||
It controls a chest with a three digit combination style lock. | It controls a chest with a three digit combination style lock. | ||
< | <PRE> | ||
SCN BGBlairsChestSCRIPT | |||
Short Button1 | Short Button1 | ||
Short Button2 | Short Button2 | ||
Short Button3 | Short Button3 | ||
Short | Short Frame | ||
Short | Short Unlocked | ||
Short GoldCount | Short GoldCount | ||
Begin OnActivate | Begin OnActivate | ||
If | If Unlocked == 1 | ||
Activate | Activate | ||
Else | Else | ||
;Begin combination menu | |||
Set Frame to 1 | |||
EndIf | EndIf | ||
Line 820: | Line 812: | ||
Begin GameMode | Begin GameMode | ||
If Frame != 0 | |||
;Get the first digit | |||
If Frame == 1 | |||
MessageBox "First digit" "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" | |||
Set Frame to 2 | |||
EndIf | |||
; | ;Save first digit entered, get the second digit | ||
If Frame == 2 | |||
Set Button1 to GetButtonPressed | |||
If Button1 == -1 | |||
Return | |||
EndIf | |||
MessageBox "Second digit" "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" | |||
Set Frame to 3 | |||
EndIf | |||
;Save second digit entered, get third digit | |||
If Frame == 3 | |||
Set Button2 to GetButtonPressed | |||
If Button2 == -1 | |||
Return | |||
EndIf | |||
MessageBox "Third digit" "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" | |||
Set Frame to 4 | |||
EndIf | |||
;Save third digit entered, then check combination. | |||
If Frame == 4 | |||
Set Button3 to GetButtonPressed | |||
If Button3 == -1 | |||
Return | |||
EndIf | |||
If Button1 == 1 && Button2 == 4 && Button3 == 7 | |||
;Correct combination result | |||
MessageBox "The combination pad unlocks." | |||
Set Unlocked to 1 | |||
Set Frame to 0 | |||
Else | |||
;Bad combination result | |||
MessageBox, "Suddenly your pockets feel a bit lighter." | |||
Set Frame to 0 | |||
If (Player.GetItemCount "gold001") >= 100 | |||
Player.RemoveItem "gold001" 100 | |||
AddItem "gold001" 100 | |||
Else | |||
Set GoldCount to Player.GetItemCount "gold001" | |||
Set GoldCount to GoldCount - 1 | |||
Player.RemoveItem "gold001" GoldCount | |||
AddItem "Gold001" GoldCount | |||
EndIf | |||
EndIf ;Correct combo | |||
EndIf ; Frame 4 | |||
EndIf; Frame != 0 | |||
End | |||
</PRE> | |||
; | |||
; | |||
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 |