saintgrimm92 Posted December 19, 2020 Share Posted December 19, 2020 So in the past, I did a quest that had 2 NPCs to be killed in a quest.I setup 2 stages for completion. When one was killed, the script checked ondeath, if the other NPC was dead. If it was, it moved it to the complete stage. If the other NPC was still alive, it moved it to a stage that targeted only that NPC (removing the compass arrows from the dead NPC).Now I'm trying to do this on a much larger scale. I need the player to completely clear out a dungeon, and that's just too many variables. The only way I know how to remove the arrow pointing toward an NPC in a quest to move to another stage, as I explained I did in the past above. So, if I were to do it that way, Every NPC in the dungeon would have their own stage to set, and I'd have to do combos. If this NPC + this NPC is dead, set stage to #, BUT if this NPC and THAT NPC is dead, but THIS NPC is still alive, then set stage to diff#. So instead of doing ALL THAT, I'm wondering if someone could walk me through how numbered NPC's are done in quests? For example, every time one of the NPC's is killed, the objective updates with "1/15 snakes killed", "2/15 snakes killed", "3/15 snakes killed", etc etc. I'm already assuming I'll need this, this is just generic babble so I don't need to actually think right now.Event OnDeath (blah blah blah) if killer = playerref Int +1EndEventBut I'm not sure how to plug that into the quest.... If int == 1 setstage 20 end if, if int ==2 setstage 30, is that all I really need? How do I remove the compass arrow from pointing at the dead NPC since I have no way of knowing which alias is killed to set the stage up one, since it could be any of them? Link to comment Share on other sites More sharing options...
saintgrimm92 Posted December 19, 2020 Author Share Posted December 19, 2020 I actually had an idea right after sending this question over PM to a friend. Would this maybe be easier to do with an item? Off the top of my head, say a skull. All 15 of the NPCs would have a skull in their inventory and instead of death triggering the int+1, taking the item would trigger it so instead of "1/15 killed" it'd be "1/15 skulls gathered" or whatever; and taking the item should correctly remove the quest compass from pointing to the snake's corpse, allowing me to keep all 15 skulls alias' set as objectives for all 15 stages of #/15 gathered.Or am I off here? I'll be working on tht specific quest shortly, so I guess I'll find if I don't hear anything back here before then! Link to comment Share on other sites More sharing options...
dylbill Posted December 20, 2020 Share Posted December 20, 2020 Both of those methods would work fine. For the Skull method, you can use an alias that points to the player. Then use a script on the alias with the OnItemAdded event. You also don't need to setStage every time. You can just use SetObjectiveDisplayed or you can use a message form to display a message notification. Example script: Scriptname SomeScriptName extends ReferenceAlias ;Put this on a ReferenceAlias pointing to the player and check the Optional box. MiscObject Property Skull Auto Actor Property PlayerRef auto Message Property SkullCountMsg Auto Int Property NextStage Auto ;Message text in the ck: %.0f of 15 Skulls Gathered. Event OnInit() AddInventoryEventFilter(Skull) EndEvent Event OnItemAdded(Form akBaseItem, Int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) Int SkullsGathered = PlayerRef.GetItemCount(Skull) SkullCountMsg.Show(SkullsGathered) If SkullsGathered >= 15 Self.GetOwningQuest().SetStage(NextStage) Self.Clear() Endif EndEventIf you want to use the OnDeath method, you can use a global variable to count the deaths. Put each of your NPC's in a reference alias and put this script on each alias: Scriptname SomeScriptName extends ReferenceAlias ;Put this on each ReferenceAlias pointing to one of your npc's GlobalVariable Property MyNPCDeathCount Auto Actor Property PlayerRef auto Message Property SkullCountMsg Auto Int Property NextStage Auto ;Message text in the ck: %.0f of 15 Skulls Gathered. Event OnDeath(Actor akKiller) MyNPCDeathCount.Mod(1) Float DeathCount = MyNPCDeathCount.GetValue() SkullCountMsg.Show(DeathCount) If DeathCount >= 15 Self.GetOwningQuest().SetStage(NextStage) Endif EndEventAlso, in your objective display you can use <Global=GlobalName> to display how many deaths / skulls are collected. In your script you would use Self.GetOwningQuest().updateCurrentInstanceGlobal(MyNPCDeathCount) after moding the global variable. You can read more about that here: https://www.creationkit.com/index.php?title=Text_Replacement. Hope that helps! Link to comment Share on other sites More sharing options...
saintgrimm92 Posted December 20, 2020 Author Share Posted December 20, 2020 Both of those methods would work fine. For the Skull method, you can use an alias that points to the player. Then use a script on the alias with the OnItemAdded event. You also don't need to setStage every time. You can just use SetObjectiveDisplayed or you can use a message form to display a message notification. Example script: Scriptname SomeScriptName extends ReferenceAlias ;Put this on a ReferenceAlias pointing to the player and check the Optional box. MiscObject Property Skull Auto Actor Property PlayerRef auto Message Property SkullCountMsg Auto Int Property NextStage Auto ;Message text in the ck: %.0f of 15 Skulls Gathered. Event OnInit() AddInventoryEventFilter(Skull) EndEvent Event OnItemAdded(Form akBaseItem, Int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) Int SkullsGathered = PlayerRef.GetItemCount(Skull) SkullCountMsg.Show(SkullsGathered) If SkullsGathered >= 15 Self.GetOwningQuest().SetStage(NextStage) Self.Clear() Endif EndEventIf you want to use the OnDeath method, you can use a global variable to count the deaths. Put each of your NPC's in a reference alias and put this script on each alias: Scriptname SomeScriptName extends ReferenceAlias ;Put this on each ReferenceAlias pointing to one of your npc's GlobalVariable Property MyNPCDeathCount Auto Actor Property PlayerRef auto Message Property SkullCountMsg Auto Int Property NextStage Auto ;Message text in the ck: %.0f of 15 Skulls Gathered. Event OnDeath(Actor akKiller) MyNPCDeathCount.Mod(1) Float DeathCount = MyNPCDeathCount.GetValue() SkullCountMsg.Show(DeathCount) If DeathCount >= 15 Self.GetOwningQuest().SetStage(NextStage) Endif EndEventAlso, in your objective display you can use <Global=GlobalName> to display how many deaths / skulls are collected. In your script you would use Self.GetOwningQuest().updateCurrentInstanceGlobal(MyNPCDeathCount) after moding the global variable. You can read more about that here: https://www.creationkit.com/index.php?title=Text_Replacement. Hope that helps! Wow thank you! Makes it much easier! :) Link to comment Share on other sites More sharing options...
dylbill Posted December 21, 2020 Share Posted December 21, 2020 No problem :) Happy Modding! Link to comment Share on other sites More sharing options...
Recommended Posts