Jump to content

I'm sure it must be very simple but I can't work it out!


Recommended Posts

Hi there :P

 

I wanted to make a make a safe unlock on the purchase of an item. Say the player buys a collectible model of a robot and after purchasing, a unique safe is permanently opened.

I want the chest to be visible and locked before the purchase, so I can't use the initially disabled function.

 

Any ideas guys? Thanks in advance!

Link to comment
Share on other sites

Make a new quest, with run once and start game enabled flags and attach following script to player alias there:

 

Objectreference propety mysaferef auto

MiscObject property robotmodel auto

 

Event oninit()

Addinventoryeventfilter(robotmodel)

Endevent

 

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

Mysaferef.unlock()

RemoveAllInventoryEventFilters()

Endevent

 

Dont forget to fill properties.

Link to comment
Share on other sites

Make a new quest, with run once and start game enabled flags and attach following script to player alias there:

 

Objectreference propety mysaferef auto

MiscObject property robotmodel auto

 

Event oninit()

Addinventoryeventfilter(robotmodel)

Endevent

 

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

Mysaferef.unlock()

RemoveAllInventoryEventFilters()

Endevent

 

Dont forget to fill properties.

 

Great! Thanks a lot for this :D I'm moving into making my first quest for the mod so hopefully after a tutorial or two, I can get this quest/script working!

 

Once again, many thanks!!! :) :)

Link to comment
Share on other sites

 

Make a new quest, with run once and start game enabled flags and attach following script to player alias there:

 

Objectreference propety mysaferef auto

MiscObject property robotmodel auto

 

Event oninit()

Addinventoryeventfilter(robotmodel)

Endevent

 

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

Mysaferef.unlock()

RemoveAllInventoryEventFilters()

Endevent

 

Dont forget to fill properties.

 

Great! Thanks a lot for this :D I'm moving into making my first quest for the mod so hopefully after a tutorial or two, I can get this quest/script working!

 

Once again, many thanks!!! :smile: :smile:

 

 

Script has a bug. If you were to transfer the item and it then removes the filter, then it triggers every time an item of any kind is transferred. It would be wise to use a state to ignore further onitemadded events.

Link to comment
Share on other sites

Its filtered for only robotmodel form. So no other added forms should fire onitemadded.

 

Correct. But in the sample code the OnItemAdded event removes the filter. Which means the next time an item (any) is added it will trigger the event. There's nothing disabling the event. If this script is on a ref alias then clearing the alias would handle that. Arguably that would be the most appropriate way to handle it. Otherwise one would need to make another state (and set it) to override the event and do nothing.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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