Piyush7 Posted April 26, 2019 Share Posted April 26, 2019 I need help advancing a quest stage using OnPackageEnd. I am working on a mod in which NPC1 will travel to NPC2 using an ai package. and then NPC1 will fight with NPC2 using StartCombat command. to accomplish this task i've made a quest. and below are the stages. 00 - Pre-activation stage 10 - NPC1 travels to NPC2 20 - NPC1 Kills NPC2 - Alias_NPC1.GetActorRef().StartCombat(Alias_NPC2.GetActorRef()) Made an ai package which makes NPC1 to travel to NPC2.Attached this script to the ai package. Scriptname HAF_SCR_KillingIdolaf extends Actor Quest Property qst Auto Package Property Pkg Auto Event OnPackageEnd(Package akOldPackage) debug.MessageBox("Package Ended") qst.SetStage(20) EndEvent I have assigned the ai package to NPC1 in alias tab.i'm getting the message box saying package end, but my quest isn't advancing to stage 20. Link to comment Share on other sites More sharing options...
maxarturo Posted April 26, 2019 Share Posted April 26, 2019 (edited) I didn't compile them, but they should be working. Scriptname HAF_SCR_KillingIdolaf extends Actor Quest Property qst Auto {The quest we will be setting stages on} Int Property stageSetOnPackageEnd auto {The stage that will be set} Package Property Pkg Auto Event OnPackageEnd(Package akOldPackage) if (Pkg) debug.MessageBox("Package Ended") qst.setStage(stageSetOnPackageEnd) EndIf EndEvent Also : Scriptname HAF_SCR_KillingIdolaf extends Actor Quest Property qst Auto {The quest we will be setting stages on} Int Property stageSetOnPackageEnd auto {The stage that will be set} Actor Property ActorREF Auto {Actor that will set Stage On Death} Package Property Pkg Auto Event OnPackageEnd(Package akOldPackage) debug.MessageBox("Package Ended") If (ActorREF) ActorRef.IsDead() == TRUE qst.setStage(stageSetOnPackageEnd) EndIf EndEvent * You could also put on the NPC a "defaultSetStageOnDeath" Script. Edited April 26, 2019 by maxarturo Link to comment Share on other sites More sharing options...
Piyush7 Posted April 27, 2019 Author Share Posted April 27, 2019 I didn't compile them, but they should be working. Scriptname HAF_SCR_KillingIdolaf extends Actor Quest Property qst Auto {The quest we will be setting stages on} Int Property stageSetOnPackageEnd auto {The stage that will be set} Package Property Pkg Auto Event OnPackageEnd(Package akOldPackage) if (Pkg) debug.MessageBox("Package Ended") qst.setStage(stageSetOnPackageEnd) EndIf EndEvent Also : Scriptname HAF_SCR_KillingIdolaf extends Actor Quest Property qst Auto {The quest we will be setting stages on} Int Property stageSetOnPackageEnd auto {The stage that will be set} Actor Property ActorREF Auto {Actor that will set Stage On Death} Package Property Pkg Auto Event OnPackageEnd(Package akOldPackage) debug.MessageBox("Package Ended") If (ActorREF) ActorRef.IsDead() == TRUE qst.setStage(stageSetOnPackageEnd) EndIf EndEvent * You could also put on the NPC a "defaultSetStageOnDeath" Script.Thank you for replying. I learned a few new things from your reply.Tried putting your scripts on ai package script tab, but i'm still not able to advance quest stage on package end. I didn't compile them, but they should be working. Scriptname HAF_SCR_KillingIdolaf extends Actor Quest Property qst Auto {The quest we will be setting stages on} Int Property stageSetOnPackageEnd auto {The stage that will be set} Package Property Pkg Auto Event OnPackageEnd(Package akOldPackage) if (Pkg) debug.MessageBox("Package Ended") qst.setStage(stageSetOnPackageEnd) EndIf EndEvent Also : Scriptname HAF_SCR_KillingIdolaf extends Actor Quest Property qst Auto {The quest we will be setting stages on} Int Property stageSetOnPackageEnd auto {The stage that will be set} Actor Property ActorREF Auto {Actor that will set Stage On Death} Package Property Pkg Auto Event OnPackageEnd(Package akOldPackage) debug.MessageBox("Package Ended") If (ActorREF) ActorRef.IsDead() == TRUE qst.setStage(stageSetOnPackageEnd) EndIf EndEvent * You could also put on the NPC a "defaultSetStageOnDeath" Script.Thanks for replying. I learned few new things from your reply.Tried putting your scripts on my ai package's papyrus script portion under Begin/End/Chane tab. But i'm still not able to advance quest stage after ending an ai package. Link to comment Share on other sites More sharing options...
maxarturo Posted April 27, 2019 Share Posted April 27, 2019 (edited) You made an Ai package sequence: 1) NPC1 goes to - travel to NPC2 2) NPC1 kills NPC2 3) This is where your package sequence ends. Now the "OnPackageEnd" "SetStage" Script is added to your Quest and not to the ACTOR - PACKAGE menu. Or to the NPC1 Reference menu - add localy. An other faster and easy way to do this is to not add at all an "OnPackageEnd" Script, detach it completely from your AI package, instead add to NPC2 (add localy) a "defaultSetStageOnDeath". So when the Ai package ends and the NPC2 gets killed the "stage" will be set, this way you have better control over your sequence - scene. Hope it helps... Edited April 27, 2019 by maxarturo Link to comment Share on other sites More sharing options...
Piyush7 Posted April 27, 2019 Author Share Posted April 27, 2019 I think i didn't explained my issue very well. In simple words, I want my quest to advance from stage 10 to stage 20 after NPC1 travels to NPC2 using the default ai package Travel. That's all I'm using ai package for, not for killing NPC2. In stage 20 of my quest I've used , Alias_NPC1.GetActorRef().StartCombat(Alias_NPC2.GetActorRef())in papyrus fregment to make NPC1 start combat with NPC2. Link to comment Share on other sites More sharing options...
maxarturo Posted April 27, 2019 Share Posted April 27, 2019 (edited) There are diferent ways to achive this, and again i advise to add the script to NPC1 localy to its Reference menu.1) If (ActorRef) ActorRef.StartCombat(ActorRef02) qst.SetStage(StageSetOnPackageEnd) EndIf https://www.creationkit.com/index.php?title=StartCombat_-_Actor 2) https://www.creationkit.com/index.php?title=OnCombatStateChanged_-_Actor 3) https://www.creationkit.com/index.php?title=OnLocationChange_-_Actor 4) You can also use the "defaultSetStageActorRefScript" This script will set the specified stage on the specified quest (with optional prerequisite stage) if the proper event is called on the actor. Possible events are OnActivate, OnDeath, OnHit, OnTriggerEnter, OnEquipped, OnCombatBegin, OnCellLoad, self added to player inventory, self removed from player inventory, OnOpen, or OnRead. 5) You can also use the "defaultsetStageAliasScript" This script will set the specified stage on the specified quest (with optional prerequisite stage) if the proper event is called on the alias. Possible events are OnActivate, OnDeath, OnHit, OnTriggerEnter, OnEquipped, OnCombatBegin, OnCellLoad, self added to player inventory, self removed from player inventory, OnOpen, or OnRead. Only works for Reference Aliases. Edited April 27, 2019 by maxarturo Link to comment Share on other sites More sharing options...
Piyush7 Posted April 27, 2019 Author Share Posted April 27, 2019 Thanks for spontaneous replies. I will try these suggestions and will let you know how it goes. Link to comment Share on other sites More sharing options...
Piyush7 Posted April 27, 2019 Author Share Posted April 27, 2019 Hey It worked. Thanks a ton. I've been googling for days to make it work.This time to start combat, instead of using papyrus fregment i used ActorRef.StartCombat(ActorRef02) in the script itself. As you said, I've put my script on actor reference menu.Here is what i've done. Scriptname HAF_SCR_KillNazeem extends Actor Quest Property qst Auto {The quest we will be setting stages on} Int Property stageSetOnPackageEnd auto {The stage that will be set} Package Property Pkg Auto Actor Property Orc Auto Actor Property Nazeem Auto Event OnPackageEnd(Package akOldPackage) If (Pkg) If (Orc) Debug.Trace("We just stopped running the " + akOldPackage + " package") Orc.StartCombat(Nazeem) qst.SetStage(StageSetOnPackageEnd) EndIf EndIf EndEvent Thank you maxarturo. Link to comment Share on other sites More sharing options...
Recommended Posts