2023-12-04 15:02:58 +00:00
|
|
|
Scriptname PlayerPotionRackTriggerScript extends ObjectReference
|
|
|
|
|
|
|
|
import debug
|
|
|
|
import utility
|
|
|
|
|
|
|
|
ObjectReference Property ShelfContainer auto hidden
|
|
|
|
|
|
|
|
Bool Property AlreadyLoaded = FALSE Auto Hidden
|
|
|
|
|
|
|
|
|
|
|
|
EVENT OnCellLoad()
|
|
|
|
if AlreadyLoaded == FALSE
|
|
|
|
ShelfContainer = GetLinkedRef()
|
|
|
|
AlreadyLoaded = TRUE
|
|
|
|
endif
|
|
|
|
endEVENT
|
|
|
|
|
|
|
|
|
|
|
|
STATE WaitForBooks
|
|
|
|
|
|
|
|
EVENT OnBeginState()
|
2023-12-06 15:31:10 +00:00
|
|
|
;trace(self + " BOOKTRIGGER - Waiting For Books!")
|
2023-12-04 15:02:58 +00:00
|
|
|
endEVENT
|
|
|
|
|
|
|
|
EVENT OnTriggerEnter(ObjectReference TriggerRef)
|
2023-12-06 15:31:10 +00:00
|
|
|
;Trace("DARYL - " + self + " Reference " + TriggerRef + " has ENTERED")
|
2023-12-04 15:02:58 +00:00
|
|
|
|
|
|
|
endEvent
|
|
|
|
|
|
|
|
EVENT OnTriggerLeave(ObjectReference TriggerRef)
|
2023-12-06 15:31:10 +00:00
|
|
|
;Trace("DARYL - " + self + " Reference " + TriggerRef + " has EXITED")
|
2023-12-04 15:02:58 +00:00
|
|
|
Shelfcontainer.RemoveItem(TriggerRef.GetBaseObject(), 1)
|
|
|
|
(Shelfcontainer as PlayerBookShelfContainerScript).CurrentBookAmount = (Shelfcontainer as PlayerBookShelfContainerScript).CurrentBookAmount - 1
|
|
|
|
(ShelfContainer as PlayerBookShelfContainerScript).RemoveBooks((TriggerRef.GetBaseObject()), 1)
|
|
|
|
endEvent
|
|
|
|
|
|
|
|
|
|
|
|
endSTATE
|
|
|
|
|
|
|
|
|
|
|
|
auto STATE IgnoreBooks
|
|
|
|
Event OnBeginState()
|
2023-12-06 15:31:10 +00:00
|
|
|
;trace(self + " BOOKTRIGGER - Ignoring Books!")
|
2023-12-04 15:02:58 +00:00
|
|
|
endEVENT
|
|
|
|
endSTATE
|
|
|
|
|
|
|
|
|