Difference between revisions of "Bendu and S M Nodes"

4,034 bytes added ,  06:30, 18 February 2015
imported>Lmstearn
(Created page with "== Some ThiefLocation Aliases not Filling == Tutorial for starting the Bendu Quest via the Story Manager. This is a walkthrough of the procedures in starting the BenduQues...")
 
imported>Lmstearn
 
(47 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Some ThiefLocation Aliases not Filling ==
'''''Or, a Brief Walkthrough Hooking the Bendu Quest onto the Story Manager.'''''






Tutorial for starting the Bendu Quest via the Story Manager.
[[Image:DialogueInGame.png|900px]]


This is a walkthrough of the procedures in starting the BenduQuest through the Script Event node. Choosing the Script event as opposed to the other events on offer is preferred as it is much more versatile, and less buggy.


*Load up a working copy of the Bendu quest esp.
==Introduction==


*Navigate to the Keyword entry under Miscellaneous in the Object Browser. Right click somewhere in the RH pane, New, and type the name of a keyword, in this case: GSQ01Keyword.
This is a walkthrough of the procedures in starting the Bendu Olo Quest through the '''Script Event node'''.


*From the Character entry choose SM Event Node and double click on Script Event. Right click and create a new Branch node. It will be stacked by default. This will appear below all other entries. I gave it a name of GSQ01BranchStart.


*Right click on GSQ01BranchStart and select New Quest Node. Give this a name of something like GSQ01Start. The GSQ part will at some stage appear as lower case for some reason. I checked Num quests to run and left it at 1. Ensure the Stacked Bullet is checked and locate at the base of the page the Shared checkbox and click. On lower resolutions this requires some sorcery.
Requirements:


*Right click on the GSQ01Start Node Conditions area and implement a new condition with function GetEventData. The Function Parameters will be from top-down: GetIsId, Keyword, and GSQ01Keyword. Click Ok out.
*Completion of the "Intermediate Quest Design" series with particular focus on the [[http://www.creationkit.com/Bethesda_Tutorial_Story_Manager Story Manager]].


*Right click on the GSQ01Start node and select Add Quests. Choose GSQ01 from the list. Then select the newly created quest node, right click it, and choose Edit Quest.
*A working copy of the Bendu Quest that will either activate by the Startquest command through console or with "Start Game enabled" checked off.


*This will bring us the quest tab, which is quite a useful shortcut, actually. Select the Quest Data tab and from the event drop-down list choose Script event. Notice that the Start Game Enabled box is now greyed out.
*A brief look at the [[http://www.creationkit.com/SM_Event_Node wiki description of the topic]].
Ok out of all windows back to the main CK window and save.




Now we turn our attention to selecting the quest trigger or activator in the MixWaterMillLocation. The activating object doesn't have to be there, indeed it could be anywhere in Tamriel, but in the spirit of the previous tutorials lets stay in the Mixwater lumber mill locale.


We would also prefer to use something inside the workers house like a chest, barrel, bed, or even Bendu himself. But as Bendu is a base object, and exists outside the quest when the mod is activated, it'll be Keith Szarabajkas's voice on the infos, making an early visit an immersion breaker. (Not to mention what happens post quest completion)
Completion of the "Scripting with Papyrus" series is also strongly recommended.
 
 
{{ProTip|<nowiki>Seasoned stagers can bypass the above and transpose just the methods to their own works.</nowiki>}}
 
==The Nodes==
 
*Load up the quest and navigate to the Keyword entry under the Miscellaneous category in the Object Browser. Right click somewhere in the RH pane, New, and type the name of a keyword, in this case: ''GSQ01Keyword''.
 
 
*From the Character category in the Object Browser choose SM Event Node and double click on Script Event. Right click and create a new Branch node. It will be checked as '''stacked''' by default. The new node will appear below all other entries. I gave it a name of ''GSQ01BranchStart''.
 
 
{{ProTip|<nowiki>We choose to work with the Script event as opposed to the other events on offer as it is much more versatile, and less buggy.</nowiki>}}
 
 
*Right click on ''GSQ01BranchStart'' and select '''New Quest Node'''. Give this a name of something like ''GSQ01Start''. The GSQ part will at some stage appear as lower case for some reason. I checked '''Num quests to run''' and left it at 1. Ensure the '''Stacked''' Bullet is checked and, at the base of the page locate the '''Shared''' checkbox and click it. On lower resolutions accessing the bottom requires some sorcery.
 
 
*Right click on the '''GSQ01Start Node''' Conditions area and implement a new condition with function ''GetEventData''. The function parameters will be from top-down: ''GetIsId'', ''Keyword'', and ''GSQ01Keyword''. Click Ok out.
 
 
*Right click on the ''GSQ01Start Node'' and select '''Add Quests'''. Choose ''GSQ01'' from the list. Then select the newly created quest node, right click it, and choose '''Edit Quest'''.
 
 
This will bring up the quest tab, which serves as quite a useful shortcut to it, actually
 
 
{{WarningBox|It's important to '''remove''' an attached quest before deleting a node.}}
 


So let's look at something outside. Candidates like chopping blocks, the lever on the lumber mill or any object in Gilfre's home are great. A one-off "Bendu sweetroll" found on the crate outside Gifre's home would be ideal, but we'll use something rather obvious, Bendu's door.
*Select the '''Quest Data''' tab and from the event drop-down list choose '''Script Event'''. Notice that the '''Start Game Enabled''' box is now greyed out. Now Ok out of all windows back to the main CK window and save.




Now that the '''Node''' has been set up with the minimum amount of information required to activate the quest, let's work on our '''Script Event'''.


One drawback of opting for "well used" objects like doors as activators, is that papyrus will log those events more often.
==The Quest Script==
Also, the quest is being started unnecessarily every time we use the door during the quest. See bugs. For the sake of Papyrus logging, we can attempt to add conditions like GetStage GSQ01 == 0 on the nodes, but in practice they fail.


*Open up the Scripts tab and select QF_GSQ01_01000D62. Click the Properties button to add two new properties:  
*Open up the '''Scripts''' tab and select QF_GSQ01_01000D62. Click the '''Properties''' button to add two new properties:  
     GSQ01KeywordLocal of type Keyword filled with the GSQ01Keyword object.
     GSQ01KeywordLocal of type Keyword filled with the GSQ01Keyword object.
     MixWaterMill of type Location filled with the MixWaterMillLocation object
     MixWaterMill of type Location filled with the MixWaterMillLocation object


* Edit the script source and add this code below all of the existing code:
 
* Edit the script '''source''' and add this code below all existing code:
 
 
<source lang="papyrus">
     Function GSQ01Story()
     Function GSQ01Story()
     if (!GetStageDone(0))
     if (!GetStageDone(0))
Line 44: Line 73:
     endif
     endif
     endFunction
     endFunction
</source>
{{ProTip|Even though the quest may be stopped and/or in a disabled state, the mod is still active,


and the SendStoryEvent will transmit the data from the trigger zone to the node stack via the quest script.}}
{{InDepth|All of the parameters excepting akLoc are unused here and can be removed,
so <nowiki>GSQ01KeywordLocal.SendStoryEvent(akLoc = MixWaterMill)</nowiki> would work fine.
Including them here shows the potential capabilities of this function in more complex quest trigger scenarios.}}
*Save it and exit: let's review we have done so far. See [[Bendu_and_S_M_Nodes#Notes| notes]] regarding the extra entry in the conditions.
[[Image:S_M_Node.jpg|900px]]
==The Trigger==
Now we turn our attention to selecting the quest trigger or activator in the ''MixWaterMillLocation''. The activating object doesn't have to be there, indeed it could be anywhere in Tamriel, but in the spirit of the previous tutorials let's stay in the Mixwater lumber mill locale.
We would also prefer to use something inside the workers house like a chest, barrel, bed, or even Bendu himself. But as Bendu is a base object, and exists outside the quest when the mod is activated, it'll be  Keith Szarabajkas's voice on the infos, making an early visit an immersion breaker. (Not to mention what happens post quest completion)
So let's look at something in the exterior. Candidates like chopping blocks, the lever on the lumber mill or any object in Gilfre's home are great. A one-off "Bendu sweetroll" found on the crate outside Gifre's home would be ideal, but we'll use something rather obvious here, Bendu's door.
{{InDepth|One drawback of opting for "well used" objects like doors as activators, is that Papyrus will log those events more often.
Also, the quest is being started unnecessarily every time we use the door during the quest.
To limit Papyrus logging, conditions on Quest Stages can be employed on the Quest Node. See Notes Below.}}
*Locate and edit the '''FarmhouseDoor01''' object on the exterior of the MixwaterMill Workers House. Click the scripts tab and Add a new script. Call it ''StartingGSQ01Quest''.


*Locate and edit the FarmhouseDoor01 object on the exterior of the MixwaterMill Workers House. Click the scripts tab and Add a new script. Call it StartingGSQ01Quest.


*Add a new property to it:
*Add a new property to it:
Line 53: Line 115:




*Edit the script source of StartingGSQ01Quest and add this code below the property:
*Edit the script source of ''StartingGSQ01Quest'' and add this code below the property:




<source lang="papyrus">
     EVENT onActivate (objectReference akActionRef)
     EVENT onActivate (objectReference akActionRef)
     Send_Story()
     Send_Story()
Line 63: Line 126:
     QF_GSQ01_01000D62 tempGSQ01 = GetGSQ01 as QF_GSQ01_01000D62
     QF_GSQ01_01000D62 tempGSQ01 = GetGSQ01 as QF_GSQ01_01000D62
     tempGSQ01.GSQ01Story()
     tempGSQ01.GSQ01Story()
    tempGSQ01=None
     EndFunction
     EndFunction
</source>
{{InDepth|The long line of code beginning with ''QF_GSQ01_01000D62'' looks scary.
Here we replace the (empty) reference of ''tempGSQ01'' with the reference we ''got'' from ''GetGSQ01'',
a reference which is, in fact, directed toward our quest object, ''GSQ01''.
Consider ''QF_GSQ01_01000D62'' as a "type". It's type is that of '''script'''.}}
If the line in ''Send_Story()'' were just
<source lang="papyrus">
QF_GSQ01_01000D62 tempGSQ01 = GetGSQ01
</source>
That would be the same as:
<source lang="papyrus">
QF_GSQ01_01000D62 tempGSQ01 = GetGSQ01 as Quest
</source>
The "as" operator is called a '''cast''' and the following statement looks for something in GSQ01 to "match" the '''script''' object ''QF_GSQ01_01000D62'':
<source lang="papyrus">
QF_GSQ01_01000D62 tempGSQ01 = GetGSQ01
</source>
Unfortunately Quest doesn't match and it won't compile because there is no implicit casting of ''GetGSQ01'' to ''QF_GSQ01_01000D62''
We expect the variable ''tempGSQ01'' to be used just once, so it's good practice to clear any persistent reference to the local ''GetGSQ01'' by "nulling" ''tempGSQ01'' after ''GSQ01Story'' is called.
{{ProTip|For more detailed info on casting refer [http://www.cipscis.com/skyrim/tutorials/externalaccess.aspx here].
For a better picture of how script objects are organized in the CK, check [http://www.creationkit.com/Category:Script_Objects this] out.}}
*Save the script. Our task is done and the modifications are ready for Bendu.
== Notes ==
*We could, of course have put all the scripts in the ''StartingGSQ01Quest'' script instead of the quest script.


:The upside of our decision not to is that the properties and functions are available for re-use globally.


:The downside is that for some reason the nice message in the Papyrus Log:
    [Date - Time] [StartingGSQ01Quest < (0001656B)>]: send_story Called - starting quest [Keyword <GSQ01Keyword (2E00A9D9)>]
:only appears when the SendStory Event is generated from the trigger object.




*Given a [[http://www.creationkit.com/Talk:SM_Event_Node#Conditions problem]] experienced with conditions, the '''if''' condition in Function ''GSQ01Story''() can be replaced by adding:


Notes on Papyrus:
    GetStageDone {MyQuest 0} == 0


We could, of course have put all the scripts in the StartingGSQ01Quest.
to the '''Quest Node''' for GSQ01 in '''S M Event Nodes''' for very much the same effect.
The upside
The downside:


[02/12/2015 - 09:12:39PM] [StartingGSQ01Quest < (0001656B)>]: send_story Called - starting quest [Keyword <GSQ01Keyword (2E00A9D9)>]
[[Category:Community Tutorials]]
Anonymous user