APCrepeater Posted December 2, 2013 Share Posted December 2, 2013 One of the Quest Objectives for my mod is "Kill Jack". What I am wanting to know is how do I script this so that1.The Quest Objective marker disappears after he is dead or killed. 2.The quest will move on to the next Quest Objective after he is dead or killed. An Example of this scrip or a mod that I can use as a reference for this script would be much appreciated! Link to comment Share on other sites More sharing options...
pkleiss Posted December 2, 2013 Share Posted December 2, 2013 (edited) It's pretty simple really... Just put a a script on Jack that uses an OnDeath block and have a command within that block set the next stage for your quest. Here is an example: scn UCRustyRefScript short RustyIsDead Begin OnDeath Set RustyIsDead to 1 Setstage UCMain 4 EndIn this case, the name of my quest is UCMain and the above code block has set the stage to 4. Setting the variable, RustyIsDead to 1 is irrelevant to your question, you can ignore it. Now, in the results script of UCMain stage 4 I have more code: setobjectiveCompleted UCMain 3 1 addtopic UCRustyDead1 setobjectiveDisplayed UCMain 4 1The top and bottom commands remove the current objective (objective #3) and display the next objective (objective #4). The middle one just adds a new dialogue topic within the UCMain quest. It is not germane to your question. Edited December 2, 2013 by pkleiss Link to comment Share on other sites More sharing options...
APCrepeater Posted December 3, 2013 Author Share Posted December 3, 2013 It's pretty simple really... Just put a a script on Jack that uses an OnDeath block and have a command within that block set the next stage for your quest. Here is an example: scn UCRustyRefScript short RustyIsDead Begin OnDeath Set RustyIsDead to 1 Setstage UCMain 4 EndIn this case, the name of my quest is UCMain and the above code block has set the stage to 4. Setting the variable, RustyIsDead to 1 is irrelevant to your question, you can ignore it. Now, in the results script of UCMain stage 4 I have more code: setobjectiveCompleted UCMain 3 1 addtopic UCRustyDead1 setobjectiveDisplayed UCMain 4 1The top and bottom commands remove the current objective (objective #3) and display the next objective (objective #4). The middle one just adds a new dialogue topic within the UCMain quest. It is not germane to your question.Oh, this makes perfect sense thank you!... If i were do to this for multiple people instead of just one, I know i could just make multiple objectives easily (Kill Jack, then the next one be Kill John), but what about making a single objective (Kill Jack and John)? Link to comment Share on other sites More sharing options...
pkleiss Posted December 3, 2013 Share Posted December 3, 2013 To do both as one objective, you'll need that variable I told you to ignore on Jack's script. Instead of setting the stage in the OnDeath blocks, just set two variables and check their value from within a new script you'll place on your quest. Example quest script: Scn MyQuestScript Short JackIsDead Short JohnIsDead Short DoOnce Begin GameMode If DonOnce == 0 If JackIsDead && JohnIsDead then SetStage MyQuest 5 Set DoOnce to 1 EndIf Endif EndThe DoOnce check insures that the stage is only set once, the first time, and never again. Then you'll just need to set up the varibales in the OnDeath blocks of the two NPC scripts... scn JackRefScript Begin OnDeath Set MyQuest.JackIsDead to 1 EndPut a similar script on John, but using the JohnIsDead variable. Note that when referencing a variable in one script from another, you DO NOT use the script name, but the object the script runs on, in this case, the quest ID. That is why the variable JackIsDead (defined in the quest script) is referenced as MyQuest.JackIsDead from within jack's script and not MyQuestScript.JackIsDead. You could have just as easily defined the variables within the NPC scripts and referenced them from within the quest script by using the Ref ID of the NPCs. Example: If Jack's Ref ID was JackRef, then if the variable JackIsDead is defined within Jack's script instead of the quest script (as my above example demonstrates), you would reference that variable within the quest script as JackRef.JackIsDead. Link to comment Share on other sites More sharing options...
Recommended Posts