Need a bit of logic help.

Post » Thu Mar 13, 2014 9:43 am

I'm trying to avoid using an Update event. One custom function I made was working as intended hours ago, but now it doesn't.

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.
User avatar
dean Cutler
 
Posts: 3411
Joined: Wed Jul 18, 2007 7:29 am

Return to V - Skyrim