Jump to content

Recommended Posts

Hi,

 

I have a quest where the player goes to a civil war camp and kills all the soldiers there. The objective uses a copy of the system from the CW01A quest, from the Fort Hraggstad quest.

 

The objectives work and update as they're meant to, updating the markers as necessary however, once the npcs are dead the quest doesn't update it's objective.

 

The scripts are as follows:

Scriptname RSIQuestCampMasterScript extends Quest  Conditional

LocationRefType Property CWSoldier  Auto  

LocationAlias Property HaafingarCamp  Auto  

Int Property NextStage  Auto  

function checkLocRefTypeAliveCount()

	int aliveCount = HaafingarCamp.GetLocation().GetRefTypeAliveCount(CWSoldier)

	if aliveCount > 0

	Else
		
		;do nothing

			SetStage(NextStage)

	endif

EndFunction

This is the script for checking if the aliveCount is > 0, and if it is, it's meant to do nothing as there are still enemies alive. Once it equals 0 though, we're meant to set the stage to the NextStage (which I've set to 15)

;All soldiers killed

SetObjectiveCompleted(10)

SetObjectiveDisplayed(15)

Alias_COHaafingar.SetEssential(False)

This is for stage 15, so once the stage is set the previous objective is completed and the next one is shown. The commander is also set unessential as the next objective is to kill the commander.

Scriptname HaafStormcloakScript extends ReferenceAlias  

Event OnDeath(Actor akKiller)

	(GetOwningQuest() as RSICampMasterScript).checkLocRefTypeAliveCount()

EndEvent

All of the soldier alias's have this script attached to them, so when they are killed the checkLocRefTypeAliveCount() function is re-run.

 

 

 

This image shows one of the soldier alias's (the rest are the same as they're just duplicated with a name and reference change)

 

 

 

This image shows the conditions on the objective (10) for the first soldier alias.

 

 

 

Finally, this image shows the condtions on the objective (10) for the rest of the soldier alias's.

I have no idea what, out of all of this is broken or if anything is. If anyone has any ideas, I'd be grateful. :smile:

Link to comment
Share on other sites

Just a comment:

 

This is really hard on the eyes. Put your images in spoiler text to shorten the post and take out all of those white empty lines! More people may then respond.

 

I think you may have an issue in that you are trying to 'kill' NPCs that are vanilla, for a start off. That's a bit of a no-no, imo. It could have serious consequences for the vanilla game. If you add a new camp, populate it with new NPCs and get the player to slaughter them, that would be much safer. If you do this, then tracking the dead count is fairly easy and should work. I'm guessing it won't update because of what you are trying to do to vanilla NPCs who are used in a vanilla quest.

Link to comment
Share on other sites

Typo with scriptname?

(GetOwningQuest() as RSICampMasterScript).checkLocRefTypeAliveCount()

RSIQuestCampMasterScript

 

Scriptname RSIQuestCampMasterScript extends Quest Conditional
; https://forums.nexusmods.com/index.php?/topic/8738843-quest-not-updating-from-script/

  LocationRefType PROPERTY CWSoldier     auto  
  LocationAlias   PROPERTY HaafingarCamp auto  
  Location myLoc

  Int PROPERTY NextStage auto     ; [default=0]

;-----------------------------------
FUNCTION checkLocRefTypeAliveCount()
;-----------------------------------
    IF ( myLoc )
    ELSE
        myLoc = HaafingarCamp.GetLocation()
    ENDIF

    int i = myLoc.GetRefTypeAliveCount(CWSoldier)

IF ( myLoc )
ELSE
    Debug.Trace(self+" Missing location for " +HaafingarCamp)
    RETURN    ; - STOP -
ENDIF
;---------------------
IF (i > 0)
    Debug.Notification("Still " +i+ "alive..")
    RETURN    ; - STOP -
ENDIF
;---------------------
    self.setStage(NextStage)
ENDFUNCTION

 

 

 

wiki: https://www.creationkit.com/index.php?title=GetRefTypeAliveCount_-_Location

 

Hint: By using a dynamic filled quest alias you should check the "Optional" flag. Your refAlias conditions are out of the script, so they could be also a culprit.

Edited by ReDragon2013
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...