Breezehome Potion Shelf Mod Scripts

Post » Thu Jun 21, 2012 11:45 pm

I was asked in the Steam Workshop to see if I could make my "Breezehome Potion Shelves" mod compatible with "Unlimited Bookshelves." I couldn't work out away to do that though since simply downloading another mod does not give me access to the authors scripts. Thought this might be a good place to publish my potion shelf script if anyone wants to try and make their mod compatible with mine :)

1) I extracted the NobleShelf04.nif file from the Skyrim meshes folder so I could use the model
2) I Duplicated an "activator," renamed it, and saved the Noble shelf model to it.
3) Added this script to the new activator (To call up a container.)
_________________________________________________
Scriptname AXE_PSCT_NoRef extends ObjectReference;

ObjectReference Property ShelfContainer Auto ; link this to my shelf container
EVENT OnActivate(ObjectReference TriggerRef)
;Debug.MessageBox("Calling container")
ShelfContainer.Activate(Game.GetPlayer(), FALSE)
endEVENT
_________________________________________________

4) This is the script of my blank container object which is just a primitive hidden behind a wall.
______________________________________________________________________________
Scriptname AXEPotionRackContainerScript extends ObjectReference ; Container script by AXE

ObjectReference Property PotionMarker01 Auto ; all these point to a "dummypotion" object sitting on the shelf
ObjectReference Property PotionMarker02 Auto
ObjectReference Property PotionMarker03 Auto
ObjectReference Property PotionMarker04 Auto
ObjectReference Property PotionMarker05 Auto
ObjectReference Property PotionMarker06 Auto
ObjectReference Property PotionMarker07 Auto
ObjectReference Property PotionMarker08 Auto
ObjectReference Property PotionMarker09 Auto
ObjectReference Property PotionMarker10 Auto
ObjectReference Property PotionMarker11 Auto
ObjectReference Property PotionMarker12 Auto
ObjectReference Property PotionMarker13 Auto
ObjectReference Property PotionMarker14 Auto
ObjectReference Property PotionMarker15 Auto
ObjectReference Property PotionMarker16 Auto
ObjectReference Property PotionMarker17 Auto
ObjectReference Property PotionMarker18 Auto
ObjectReference Property PotionMarker19 Auto
ObjectReference Property PotionMarker20 Auto

Form Property PotionToBePlaced Auto Hidden

Int Property PlaceCounter Auto Hidden
Int Property NumberOfItems Auto Hidden

Message Property PotionShelfInstructions Auto ; A menubox with selections from 1 to 4
Message Property PotionShelfInstructions2 Auto ; A menubox with selections from 1 to 5

Event OnActivate(ObjectReference akActionRef)
PlaceCounter = 0
Int Selection = PotionShelfInstructions.Show()
If (Selection != -1)
PlaceCounter = (Selection * 5)
Endif
Int Selection2 = PotionShelfInstructions2.Show()
If (Selection2 != -1)
PlaceCounter = (PlaceCounter + Selection2 + 1)
Endif
EndEvent


EVENT OnItemAdded (Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
NumberOfItems = aiItemCount
PotionToBePlaced = akBaseItem
Self.RemoveAllItems()

If NumberOfItems >= 11
Debug.MessageBox("Placing stacks of this size is not allowed. Please read Potion Shelf User Manual for more information")
; Imposed a stack size limitation after noting the engine crashes with a huge stack
; Removed "base item type as potion" restriction to allow nearly anything to be placed
; Did not restrict user from placing small "stacks" if desired
Game.GetPlayer().AddItem(PotionToBePlaced,NumberofItems)
Else

If PlaceCounter == 1
PotionMarker01.PlaceAtMe(PotionToBePlaced,NumberOfItems)
ElseIf PlaceCounter == 2
PotionMarker02.PlaceAtMe(PotionToBePlaced,NumberOfItems)
ElseIf PlaceCounter == 3
PotionMarker03.PlaceAtMe(PotionToBePlaced,NumberOfItems)
ElseIf PlaceCounter == 4
PotionMarker04.PlaceAtMe(PotionToBePlaced,NumberOfItems)
ElseIf PlaceCounter == 5
PotionMarker05.PlaceAtMe(PotionToBePlaced,NumberOfItems)
ElseIf PlaceCounter == 6
PotionMarker06.PlaceAtMe(PotionToBePlaced,NumberOfItems)
ElseIf PlaceCounter == 7
PotionMarker07.PlaceAtMe(PotionToBePlaced,NumberOfItems)
ElseIf PlaceCounter == 8
PotionMarker08.PlaceAtMe(PotionToBePlaced,NumberOfItems)
ElseIf PlaceCounter == 9
PotionMarker09.PlaceAtMe(PotionToBePlaced,NumberOfItems)
ElseIf PlaceCounter == 10
PotionMarker10.PlaceAtMe(PotionToBePlaced,NumberOfItems)
ElseIf PlaceCounter == 11
PotionMarker11.PlaceAtMe(PotionToBePlaced,NumberOfItems)
ElseIf PlaceCounter == 12
PotionMarker12.PlaceAtMe(PotionToBePlaced,NumberOfItems)
ElseIf PlaceCounter == 13
PotionMarker13.PlaceAtMe(PotionToBePlaced,NumberOfItems)
ElseIf PlaceCounter == 14
PotionMarker14.PlaceAtMe(PotionToBePlaced,NumberOfItems)
ElseIf PlaceCounter == 15
PotionMarker15.PlaceAtMe(PotionToBePlaced,NumberOfItems)
ElseIf PlaceCounter == 16
PotionMarker16.PlaceAtMe(PotionToBePlaced,NumberOfItems)
ElseIf PlaceCounter == 17
PotionMarker17.PlaceAtMe(PotionToBePlaced,NumberOfItems)
ElseIf PlaceCounter == 18
PotionMarker18.PlaceAtMe(PotionToBePlaced,NumberOfItems)
ElseIf PlaceCounter == 19
PotionMarker19.PlaceAtMe(PotionToBePlaced,NumberOfItems)
ElseIf PlaceCounter == 20
PotionMarker20.PlaceAtMe(PotionToBePlaced,NumberOfItems)

Endif
PlaceCounter = PlaceCounter + 1
If PlaceCounter == 21
PlaceCounter = 1
EndIF
EndIf
ENDEVENT
User avatar
TRIsha FEnnesse
 
Posts: 3369
Joined: Sun Feb 04, 2007 5:59 am

Return to V - Skyrim