Jump to content

[LE] Script for oncontainerchangedto


MesaSolar

Recommended Posts

Is there a vanilla script to set a quest stage for an object changing container?

 

I found this on the CK website but couldn't find anything like it in the CK itself. I need to use this multiple times for a multiple item fetch quest. So the script needs to give an option to set a quest stage similar to a trigger box.

 

Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
if akNewContainer == Game.GetPlayer()
Debug.Trace("I just got put in the player's inventory!")
endIf
endEvent

Link to comment
Share on other sites

I'm not sure if there's a vanilla script, but you can always write your own. It would look like this:

 

Scriptname PlayerAddItemSetStageScript extends ObjectReference 

Quest Property MyQuest auto 
Int Property Stage Auto 

Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
    If akNewContainer as Actor 
        If (akNewContainer as Actor) == Game.GetPlayer()
            MyQuest.SetStage(Stage)
        Endif 
    Endif 
EndEvent

You can set the quest and stage in the CK. Name the script something more unique.

Link to comment
Share on other sites

There is the stock script called: defaultSetStageOnPlayerAcquireItem

This may do what you want. The code is as follows:

 

 

Scriptname defaultSetStageOnPlayerAcquireItem extends ObjectReference  
{Sets a quest stage when this item is put in the player's inventory.}

Quest Property myQST auto
{Quest upon which to set stage. Default is the Alias's owning quest.}
int Property preReqStage = -1 auto
{(Optional)Stage that must be set for this script to run. Default: NONE}
int Property StageToSet auto
{Set this stage when the player picks up this item.}
    
auto State waiting    
    Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
        if (Game.GetPlayer() == akNewContainer)
            if ( (preReqStage == -1) || (myQST.GetStageDone(preReqStage) == True) )
                myQST.SetStage(stageToSet)
                GoToState("inactive")
            endif
        endif
    EndEvent
EndState

State inactive
EndState

Link to comment
Share on other sites

  • Recently Browsing   0 members

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