Jump to content

How to just run in “OpenInventory�


pxd2050

Recommended Posts

I want "State Inventory" only do work when "akSpeaker.OpenInventory", how to do?

 

.....................................................

Scriptname outfit__020012C9 Extends TopicInfo Hidden

 

akSpeaker.OpenInventory(true)

......................................

 

.................................

Scriptname outfit__script extends ReferenceAlias

 

State Inventory

Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)

if (akBaseItem as Armor)

AddToArmorSlot(akBaseItem)

self.GetActorRef().EquipItem(akBaseItem)

elseif (akBaseItem as Weapon)

AddToWeaponSlot(akBaseItem)

self.GetActorRef().EquipItem(akBaseItem)

endif

endEvent

 

Event OnObjectUnequipped(Form akBaseObject, ObjectReference akReference)

if (akBaseObject as Armor)

RemoveFromArmorSlot(akBaseObject)

elseif (akBaseObject as Weapon)

RemoveFromWeaponSlot(akBaseObject)

endif

endEvent

endState

Edited by pxd2050
Link to comment
Share on other sites

When OnCellLoad(),Event OnItemAdded and Event OnObjectUnequipped is called,but I want this two Event only be called when akSpeaker.OpenInventory(true).

Can you help me?

 

my poor English.

Edited by pxd2050
Link to comment
Share on other sites

Try this, but use OnCellAttach because it's more reliable than OnCellLoad

AUTO STATE CellLoading
    Event OnCellAttach()
        GoToState("ExampleState")
        AddInventoryEventFilter(...)
       akSpeaker.OpenInventory(true)
    EndEvent
ENDSTATE
 
STATE ExampleState
    Event OnItemAdded(..params..)
        ....whatever you want to put here...
    EndEvent
 
    Event OnObjectUnequipped(...params..)
        ....whatever you want to put here...
    EndEvent
ENDSTATE

I was being lazy not adding the parameters for the events lol.

 

This is a 1 shot script, meaning the cell check will only happen once, unless you want the state to keep reverting back to auto.

Edited by Rasikko
Link to comment
Share on other sites

  • Recently Browsing   0 members

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