Jump to content

Need some help understanding quest functions


Recommended Posts

Hey there! I'm currently working on my first mod within the CK and having a bit of trouble with getting the quest setup properly. I currently have an NPC to handle an affinity value for the quest, i've edited MB missions to give or take away from this value (and confirmed it works and sticks), I have that NPC assigned to an Alias within the quest, and I have the stages + objectives set up (and they are able to be cycled through in game with the setstage command with no issues, displaying their respective objectives, running, starting, resetting, etc).


Now here comes the part I'm struggling with: i don't know how to check the affinity amount in order to compare, mark it as complete if the affinity value is equal/higher than the predetermined one, and then move the quest forward.

Here's what I currently have set up: stage 0 starts the chain, displays a welcome objective, waits for 30 seconds, and sets stage 1 (this works perfectly). Stage 1 displays objective 1 of getting 100 affinity (this works perfectly). Stage 2 is a placeholder that has the current fragments of marking objective 1 as completed and displaying the placeholder objective 2. // what I'm struggling with: how to make the game check affinity values and that the player fulfilled objective 1, then how to move to stage 2, and make it so stage 2 doesn't start until 100 affinity/stage 1 is complete. For gating, I was thinking of using a condition on the Quest Stages, and that just might work; for objectives, I've tried using the conditions in the objectives to check the affinity amount (run on quest alias of NPC, GetValue - COM_Affinity - Compare: >= - 100 (in this case)), but that seemingly doesn't do anything once the condition is theoretically met. I believe i might be missing some scripting, but no combination of actor id, alias, GetValue(), or any of that has yielded more than an (unsolvable with my skillset) error.


Just to recap: I'm a little lost on how to set this up objective wise, and then how to make it so the quest only moves forward once they're done. I have configured this several times that it would just skip right to the end with no care in the world for objectives. I've tried looking at other quests for clues, but there is seemingly no quest that even does this or anything like this, even the companions/conditions, unless it's tucked away out of sight.

Link to comment
Share on other sites

Have you registered for the Event? OnActorValueChanged is probably what you need, once thats done you can call setstage in that event block

Event OnActorValueChanged(ObjectReference akObjRef, ActorValue akActorValue)
  ; Empty function
EndEvent

 

Link to comment
Share on other sites

Attach a script to your quest (just name it "YourQuestScript"), then paste this code in it:

Scriptname YourQuestScript extends Quest Const

Actor Property theNPC Auto Const				; fill out the Script Properties in the editor
ActorValue Property theActorValue Auto Const


Event OnStageSet(int auiStageID, int auiItemID)

	If auiStageID == 100		; if Stage 100 is set

		If theNPC.GetValue(theActorValue) >= 100 && Self.GetStageDone(50) == true		; if theActorValue is >= 100 on theNPC AND Stage 50 is set, then

			SetStage(300)		; advance the quest to Stage 300

		EndIf

	EndIf

EndEvent

 

Edit it however you want then press Ctrl+S to compile it.

Note: what's written after the semicolon in a line is commented out, it won't be compiled.

Link to comment
Share on other sites

Posted (edited)

You two have been a massive help. Starting to see how it all fits together. Larann, are you actually able to select an actor under properties? Not only does my property tab have two Actor types, but neither one lets me select an Actor to call.

Fixed up that bit by switching to ReferenceAlias and doing theNPC.GetActorRef().xxx (thanks DJLegends if you stumble upon this!)

Closing notes: Aha! THANK YOU BOTH! I've nailed it down.

Edited by Vydry
Added information, closing notes.
Link to comment
Share on other sites

  • Recently Browsing   0 members

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