The custom function:
Spoiler
Function RegisterRefDeathWithKeyword(ReferenceAlias DeadRef) if (DeadRef.GetReference() as Actor).HasKeyword(isEnemy) debug.notification("Actor is an enemy.") EnemyPool -= 1 ShowEnemyPool() elseif (DeadRef.GetReference() as Actor).HasKeyword(isAlly) debug.notification("Actor is an ally.") AllyPool -= 1 ShowAllyPool() endifEndFunction
The Ref script:
Spoiler
Event OnDeath(Actor akKiller)(GetOwningQuest() as CampaignRiverwoodScript).RegisterRefDeathWithKeyword(self)EndEvent
The custom functions that is called inside the RegisterRefDeathWithKeyword() function:
Spoiler
Function ShowAllyPool()(SkyrimCampaignControllerQuest as SkyrimCampaignQuestScript).AllyCount.SetValue((AllyPool) as int)UpdateCurrentInstanceGlobal((SkyrimCampaignControllerQuest as SkyrimCampaignQuestScript).AllyCount) if (SkyrimCampaignControllerQuest as SkyrimCampaignQuestScript).AllyCount.GetValue() > 0 self.SetObjectiveDisplayed(10, true, true) ; if EnemyPool == 0 ; debug.notification("Running failsafe on ShowAllyPool") ; SetObjectiveCompleted(5) ; SetStage(10) ; endif else self.SetObjectiveDisplayed(10) self.SetObjectiveCompleted(10) endif EndFunctionFunction ShowEnemyPool()(SkyrimCampaignControllerQuest as SkyrimCampaignQuestScript).EnemyCount.SetValue((EnemyPool) as int)UpdateCurrentInstanceGlobal((SkyrimCampaignControllerQuest as SkyrimCampaignQuestScript).EnemyCount) if (SkyrimCampaignControllerQuest as SkyrimCampaignQuestScript).EnemyCount.GetValue() > 0 self.SetObjectiveDisplayed(20, true, true) ; if EnemyPool == 0 ; debug.notification("Running failsafe on ShowEnemyPool.") ; SetObjectiveCompleted(5) ; SetStage(10) ; endif else self.SetObjectiveDisplayed(20) self.SetObjectiveCompleted(20) endif EndFunction
The problem: EnemyPool is not updated when the bandits are killed. It only updates when I kill them with the kill console command. If I kill them as the player, it doesn't update. So when EnemyPool is filled with the value 3 from quest start, it stays at 3. I need this at 0 so I can close the quest. This quest is intended to be reset later.