Brudy Posted March 26, 2015 Share Posted March 26, 2015 I'm working on a mod where a boss and his henchmen fight the player. I want to advance the quest when they are all dead, but I'd rather not put explicit references for the henchmen. One this is common with these NPCs: They are all in the same unique faction. So, is there any way to get something like an OnDying event for a faction? Thanks for your help. Link to comment Share on other sites More sharing options...
Brudy Posted March 31, 2015 Author Share Posted March 31, 2015 Any help? I'm still messing around with factions. Link to comment Share on other sites More sharing options...
Aragorn58 Posted March 31, 2015 Share Posted March 31, 2015 (edited) I'm working on a mod where a boss and his henchmen fight the player. I want to advance the quest when they are all dead, but I'd rather not put explicit references for the henchmen. One this is common with these NPCs: They are all in the same unique faction. So, is there any way to get something like an OnDying event for a faction? Thanks for your help.You need to make all your NPCs quest aliases first and attach this script to each one. Scriptname HenchmenScript extends ReferenceAlias FI1Script myQuestScript Event OnDeath(Actor akKiller) ; increment dead count myQuestScript = GetOwningQuest() as FI1Script ;change this to what ever you want to name your script here and in the second line myQuestScript.IncrementDeadHenchmen() endEvent Then add this script to your quest Scriptname FI1Script extends Quest Conditional ; make sure the script name is the same as the one you gave to in first script int Property DeadHenchmen Auto Conditional {tracks how many henchmen are killed} int Property TotalHenchmen = 5 Auto Conditional ; change the 5 to your number of npcs {how many henchmen do you need to kill?} function IncrementDeadHenchmen() DeadHenchmen = DeadHenchmen + 1 if DeadHenchmen >= TotalHenchmen setStage(65) ;set this to whatever stage you want to set after henchmen are killed endif endFunction Make sure you place the second script on your quest first. Also when compiling the scripts I believe you have to compile the second first or the first script won't compile. ( might be vice versa) Then in any quest stage before the one you set, add the script by using the kmyQuest drop down menu. Good Luck Edited April 1, 2015 by Aragorn58 Link to comment Share on other sites More sharing options...
Brudy Posted April 2, 2015 Author Share Posted April 2, 2015 Thanks, I'll try this. I thought there would be some way to use the faction membership tests to look at people nearby. Like asking "who is my closest enemy" Link to comment Share on other sites More sharing options...
Aragorn58 Posted April 2, 2015 Share Posted April 2, 2015 Thanks, I'll try this. I thought there would be some way to use the faction membership tests to look at people nearby. Like asking "who is my closest enemy" This does work. I'm using it right now in a mod I'm finishing up. You don't have to mess with factions or anything else. Link to comment Share on other sites More sharing options...
Brudy Posted April 2, 2015 Author Share Posted April 2, 2015 I wasn't saying that it didn't work. And it may be the best solution, for which I am grateful. But it does require that I change the script if I add/remove NPCs from the encounter.So my ideal solution would be one that checks to see if anyone nearby is in that faction. When the faction is gone, then all NPCs are dead. Whether we started with 1 or 30. But for practical purposes I will use a counter as you suggest. This is because I want to move on to other things. I'd like to make a talking sword, for example. :smile: Link to comment Share on other sites More sharing options...
Aragorn58 Posted April 2, 2015 Share Posted April 2, 2015 I wasn't saying that it didn't work. And it may be the best solution, for which I am grateful. But it does require that I change the script if I add/remove NPCs from the encounter. So my ideal solution would be one that checks to see if anyone nearby is in that faction. When the faction is gone, then all NPCs are dead. Whether we started with 1 or 30. But for practical purposes I will use a counter as you suggest. This is because I want to move on to other things. I'd like to make a talking sword, for example. :smile: That's ok didn't mean anything negative. If it doesn't serve your purpose all is good. A talking sword would be pretty cool though. Good Luck, John Link to comment Share on other sites More sharing options...
Recommended Posts