Jump to content

[LE] What's wrong with my script?


Recommended Posts

this quest was working fine before i added this new stage (talk stage).
which causes the quest to jump to the talk stage as soon as i load from a clean save
this could also be an 'if npc is dead' but i couldn't get that to work for the life of me, either.
Scriptname FinalNoteAlias extends ReferenceAlias
Quest Property myQuest auto
Int Property endStage Auto
Int Property noteStage Auto
Int Property talkStage Auto

Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
    if (akNewContainer == PlayerREF) && (myQuest.getstagedone(20)==true)
        myQuest.SetObjectiveCompleted(noteStage)
        myQuest.SetObjectiveDisplayed(endStage)
        myQuest.SetStage(endStage)
    else if (akNewContainer == PlayerREF) && (myQuest.getstagedone(30)==true)
        myQuest.SetObjectiveCompleted(noteStage)
        myQuest.SetObjectiveDisplayed(talkStage)
        myQuest.SetStage(talkStage)
    else
        ;do nothing
    endif
    endif
EndEvent

thanks very much in advance

Edited by javaplaza
Link to comment
Share on other sites

May not make a difference but a slight change in the IF block logic.

 

 

Scriptname FinalNoteAlias extends ReferenceAlias

Quest Property myQuest auto
Int Property endStage Auto
Int Property noteStage Auto
Int Property talkStage Auto

Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
    if (akNewContainer == PlayerREF) 
        If (myQuest.getstagedone(20)==true)
            myQuest.SetObjectiveCompleted(noteStage)
            myQuest.SetObjectiveDisplayed(endStage)
            myQuest.SetStage(endStage)
        elseif (myQuest.getstagedone(30)==true)
            myQuest.SetObjectiveCompleted(noteStage)
            myQuest.SetObjectiveDisplayed(talkStage)
            myQuest.SetStage(talkStage)
        EndIf
    endif
EndEvent

 

 

 

FYI - to make sure that changes to a quest take affect properly, always test in a clean environment. This means either COC from the main menu to an area near your quest's start or use a save that has not seen the mod in question. Quest data can get baked into a save file even if it seems that you have not started the quest yet. If the quest technically starts (such as start game enabled) prior to the 'quest starter' (i.e. reading a note) then the quest data is already baked in.

Link to comment
Share on other sites

the quest is start game enabled, also..

 

 

a very similar thing happened the last time i tried to add a stage onto the end of a quest once i had finished it... does ck just not like it when i try to do that?

Edited by javaplaza
Link to comment
Share on other sites

if player picks up this note (in stage 60)

and 30 is done (npcA is dead), i want 50 completed and 65 started (goes to a final stage)

 

if player picks up this note (in stage 60)

and 20 is done (npcB is dead), i want 40 completed and 70 started. (completes the quest)

 

 

 

if this thread isn't getting any love because my script looks fine, let me know please and ill just rebuild ^_^

Edited by javaplaza
Link to comment
Share on other sites

if player picks up this note (in stage 60)

and 30 is done (npcA is dead), i want 50 completed and 65 started (goes to a final stage)

 

if player picks up this note (in stage 60)

and 20 is done (npcB is dead), i want 40 completed and 70 started. (completes the quest)

 

 

 

if this thread isn't getting any love because my script looks fine, let me know please and ill just rebuild ^_^

Based on this information, this should do what you want. You will need to check the stages being set as they may or may not have code that is advancing the quest further than you intend.

 

 

Scriptname FinalNoteAlias extends ReferenceAlias

Quest Property myQuest auto
Int Property NextStageNPCa = 65 Auto
Int Property NextStageNPCb = 70 Auto
Int Property noteStageNPCa = 50 Auto
Int Property noteStageNPCb = 40 Auto

Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
    if (akNewContainer == PlayerREF) 
        If (myQuest.getstagedone(20) == true) ;npcA is dead
            myQuest.SetObjectiveCompleted(noteStageNPCa)
            myQuest.SetObjectiveDisplayed(NextStageNPCa)
            myQuest.SetStage(NextStageNPCa)
        elseif (myQuest.getstagedone(30) == true) ;npcB is dead
            myQuest.SetObjectiveCompleted(noteStageNPCb)
            myQuest.SetObjectiveDisplayed(NextStageNPCb)
            myQuest.SetStage(NextStageNPCb)
        EndIf
    endif
EndEvent

Only reason I assigned the values as default within the script is so that I could ensure the code followed the logic you outlined. But as properties you can overwrite the default value if necessary.

 

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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