Sign in to follow this  
Followers 0

Potion Shelves Display


Description

Modders tool to add potions to a shelf for decorations. The shelves are usable as well.

Potion Rack Creation

This tutorial is for making a Potion Shelf. It is BEST VIEWED by TESA Dark Pro THEME

The example will be for the market display shelves seen at any vendor stand or store.

I have managed to manipulate scripts to make 5, 15, 20,40,50 potion racks. So for this example I will use the 15 potion option.

Every potion rack size from 1,2, 5, to 50 is posted in downloads:

http://steamcommunity.com/profiles/76561198017160534/myworkshopfiles/

:cavalier:OR

http://tesalliance.org/forums/index.php?/files/file/1780-warehousecontainersash-potionracks/

What it looks like:

gallery_32134_424_180607.jpg

gallery_32134_424_10127.jpg

*Notice:

You will not be able to drag and drop what you created into any other mod.

The idea is to make the first shelf the hard way and drag and drop it anywhere else INSIDE the same mod you have created.

SETUP:

Remember that any reference to MODN means that you substitute it for the name of the mod or abbreviation of the mod. This includes inside the script.

If you don't need much hand holding then click on this spoiler:

 

1. Create a DefaultPotionRackPotionMarker

 

Find the dummy potion and duplicate it.

Rename your duplicate to DefaultPotionShelfPotionMarker

If it already exists then we will use it.

 

2. Create PotionShelfContainer (orange)

 

Find PlayerBookShelfContainer & duplicate it.

Rename it: PotionShelfContainer50+ModN

  It is not using 15 since I already have a script that can hold fifty.  You can name it the exact count if you need to call it PotionShelfContainer15+modn

This container is what holds the potions.

For any new qty of potions, you will follow this procedure. If you have 5 shelves, with each holding a different amount, then you will have 5 orange containers referring to the same qty of fifty.  You DON'T have to name the 5 shelves for how much they hold because the script has a property that allows you to specifiy how many potions will be held for EACH orange box you place. 
 

3. Create Keyword PotionShelfContainer

 

Create new keyword

Color is purple. R=128 G=0 B=128

Name the ID: PotionShelfContainer

 

4. Create Keyword PotionShelfPotxx

 

Create new keyword

Color is lime green. R=116 G=186 B=69

Name the ID: PotionShelfPot01

Repeat the process above 14 more times.

Each time increment the Id by 1

There will be PotionShelfPot01 through PotionShelfPot15 when finished.

*NOTE* if you want more shelves to handle up to 50 potions, then continue making keywords so the reange will be PotionShelfPot01 through PotionShelfPot50 when finished.

 

5. Create Shelf to put the potions on.

 

Find MarketDisplayShelf03

Copy 1 to your cell.

 

6: Create Messages for script.

 

Create a new message

A. Make your first message

In the ID field, type: PotionShelfFirstActivateMessage

In the Message Text box, type: Potions put here will be placed on the rack.

 

B. Now make another NEW message:

ID: PotionShelfNoMoreRoomMessage

TEXT: You can't place that many potions on this rack.


C. Make another NEW message:

ID: PotionShelfNotAPotionMessage

TEXT: You can only place potions on this rack

 

D. Make another NEW message:

ID: PotionShelfRoomLeftMessage

TEXT: You can place %.0f more potions on this shelf.

 

7. Create GLOBAL TAR

 

Create new global variable

ID: PotionShelfGlobal

 

8. Create your PotionShelfContainerScript50x+Modn

 

Create a new script called PotionShelfContainerScript50x+ModN

Extends : ObjectReference

It has 50x in its name to represent 1 – 50 potions can be used.  You can specify the exact amount in the PROPERTIES tab once the script is compiled.

PASTE the following into your script editor.

 

;Scriptname PotionShelfContainerScript50xWHCA extends ObjectReference

{Holds 1 to 50 potions}

import debug

import utility

Form Property LItemPotionClutter Auto

{Clutter item list to fill the shelf with}

Keyword Property PotionShelfPot01 Auto

Keyword Property PotionShelfPot02 Auto

Keyword Property PotionShelfPot03 Auto

Keyword Property PotionShelfPot04 Auto

Keyword Property PotionShelfPot05 Auto

Keyword Property PotionShelfPot06 Auto

Keyword Property PotionShelfPot07 Auto

Keyword Property PotionShelfPot08 Auto

Keyword Property PotionShelfPot09 Auto

Keyword Property PotionShelfPot10 Auto

Keyword Property PotionShelfPot11 Auto

Keyword Property PotionShelfPot12 Auto

Keyword Property PotionShelfPot13 Auto

Keyword Property PotionShelfPot14 Auto

Keyword Property PotionShelfPot15 Auto

Keyword Property PotionShelfPot16 Auto

Keyword Property PotionShelfPot17 Auto

Keyword Property PotionShelfPot18 Auto

Keyword Property PotionShelfPot19 Auto

Keyword Property PotionShelfPot20 Auto

Keyword Property PotionShelfPot21 Auto

Keyword Property PotionShelfPot22 Auto

Keyword Property PotionShelfPot23 Auto

Keyword Property PotionShelfPot24 Auto

Keyword Property PotionShelfPot25 Auto

Keyword Property PotionShelfPot26 Auto

Keyword Property PotionShelfPot27 Auto

Keyword Property PotionShelfPot28 Auto

Keyword Property PotionShelfPot29 Auto

Keyword Property PotionShelfPot30 Auto

Keyword Property PotionShelfPot31 Auto

Keyword Property PotionShelfPot32 Auto

Keyword Property PotionShelfPot33 Auto

Keyword Property PotionShelfPot34 Auto

Keyword Property PotionShelfPot35 Auto

Keyword Property PotionShelfPot36 Auto

Keyword Property PotionShelfPot37 Auto

Keyword Property PotionShelfPot38 Auto

Keyword Property PotionShelfPot39 Auto

Keyword Property PotionShelfPot40 Auto

Keyword Property PotionShelfPot41 Auto

Keyword Property PotionShelfPot42 Auto

Keyword Property PotionShelfPot43 Auto

Keyword Property PotionShelfPot44 Auto

Keyword Property PotionShelfPot45 Auto

Keyword Property PotionShelfPot46 Auto

Keyword Property PotionShelfPot47 Auto

Keyword Property PotionShelfPot48 Auto

Keyword Property PotionShelfPot49 Auto

Keyword Property PotionShelfPot50 Auto

Keyword Property PotionShelfTrigger01 Auto

Keyword Property PotionShelfTrigger02 Auto

Keyword Property PotionShelfTrigger03 Auto

Keyword Property PotionShelfTrigger04 Auto

{List of required Keywords}

ObjectReference Property PotionMarker01 Auto Hidden

ObjectReference Property PotionMarker02 Auto Hidden

ObjectReference Property PotionMarker03 Auto Hidden

ObjectReference Property PotionMarker04 Auto Hidden

ObjectReference Property PotionMarker05 Auto Hidden

ObjectReference Property PotionMarker06 Auto Hidden

ObjectReference Property PotionMarker07 Auto Hidden

ObjectReference Property PotionMarker08 Auto Hidden

ObjectReference Property PotionMarker09 Auto Hidden

ObjectReference Property PotionMarker10 Auto Hidden

ObjectReference Property PotionMarker11 Auto Hidden

ObjectReference Property PotionMarker12 Auto Hidden

ObjectReference Property PotionMarker13 Auto Hidden

ObjectReference Property PotionMarker14 Auto Hidden

ObjectReference Property PotionMarker15 Auto Hidden

ObjectReference Property PotionMarker16 Auto Hidden

ObjectReference Property PotionMarker17 Auto Hidden

ObjectReference Property PotionMarker18 Auto Hidden

ObjectReference Property PotionMarker19 Auto Hidden

ObjectReference Property PotionMarker20 Auto Hidden

ObjectReference Property PotionMarker21 Auto Hidden

ObjectReference Property PotionMarker22 Auto Hidden

ObjectReference Property PotionMarker23 Auto Hidden

ObjectReference Property PotionMarker24 Auto Hidden

ObjectReference Property PotionMarker25 Auto Hidden

ObjectReference Property PotionMarker26 Auto Hidden

ObjectReference Property PotionMarker27 Auto Hidden

ObjectReference Property PotionMarker28 Auto Hidden

ObjectReference Property PotionMarker29 Auto Hidden

ObjectReference Property PotionMarker30 Auto Hidden

ObjectReference Property PotionMarker31 Auto Hidden

ObjectReference Property PotionMarker32 Auto Hidden

ObjectReference Property PotionMarker33 Auto Hidden

ObjectReference Property PotionMarker34 Auto Hidden

ObjectReference Property PotionMarker35 Auto Hidden

ObjectReference Property PotionMarker36 Auto Hidden

ObjectReference Property PotionMarker37 Auto Hidden

ObjectReference Property PotionMarker38 Auto Hidden

ObjectReference Property PotionMarker39 Auto Hidden

ObjectReference Property PotionMarker40 Auto Hidden

ObjectReference Property PotionMarker41 Auto Hidden

ObjectReference Property PotionMarker42 Auto Hidden

ObjectReference Property PotionMarker43 Auto Hidden

ObjectReference Property PotionMarker44 Auto Hidden

ObjectReference Property PotionMarker45 Auto Hidden

ObjectReference Property PotionMarker46 Auto Hidden

ObjectReference Property PotionMarker47 Auto Hidden

ObjectReference Property PotionMarker48 Auto Hidden

ObjectReference Property PotionMarker49 Auto Hidden

ObjectReference Property PotionMarker50 Auto Hidden

ObjectReference Property potionshelfTrigger01Ref Auto Hidden

ObjectReference Property potionshelfTrigger02Ref Auto Hidden

ObjectReference Property potionshelfTrigger03Ref Auto Hidden

ObjectReference Property potionshelfTrigger04Ref Auto Hidden

Int Property MaxPotionsAllowed Auto Hidden

{Max Potions allowed on this partciular shelf}

Int Property CurrentPotionsAmount Auto Hidden

{The current amount of potions placed on the shelf}

Form Property EmptyForm Auto Hidden

{Null Form}

ObjectReference Property EmptyRef Auto Hidden

{Null Ref}

Form Property CurrentPotionsForm Auto Hidden

{Potion Form we are working with at any one time}

ObjectReference Property CurrentPotionsRef Auto Hidden

{Potion Ref we are working with at any one time}

Form Property PlacedPotion01 Auto Hidden

Form Property PlacedPotion02 Auto Hidden

Form Property PlacedPotion03 Auto Hidden

Form Property PlacedPotion04 Auto Hidden

Form Property PlacedPotion05 Auto Hidden

Form Property PlacedPotion06 Auto Hidden

Form Property PlacedPotion07 Auto Hidden

Form Property PlacedPotion08 Auto Hidden

Form Property PlacedPotion09 Auto Hidden

Form Property PlacedPotion10 Auto Hidden

Form Property PlacedPotion11 Auto Hidden

Form Property PlacedPotion12 Auto Hidden

Form Property PlacedPotion13 Auto Hidden

Form Property PlacedPotion14 Auto Hidden

Form Property PlacedPotion15 Auto Hidden

Form Property PlacedPotion16 Auto Hidden

Form Property PlacedPotion17 Auto Hidden

Form Property PlacedPotion18 Auto Hidden

Form Property PlacedPotion19 Auto Hidden

Form Property PlacedPotion20 Auto Hidden

Form Property PlacedPotion21 Auto Hidden

Form Property PlacedPotion22 Auto Hidden

Form Property PlacedPotion23 Auto Hidden

Form Property PlacedPotion24 Auto Hidden

Form Property PlacedPotion25 Auto Hidden

Form Property PlacedPotion26 Auto Hidden

Form Property PlacedPotion27 Auto Hidden

Form Property PlacedPotion28 Auto Hidden

Form Property PlacedPotion29 Auto Hidden

Form Property PlacedPotion30 Auto Hidden

Form Property PlacedPotion31 Auto Hidden

Form Property PlacedPotion32 Auto Hidden

Form Property PlacedPotion33 Auto Hidden

Form Property PlacedPotion34 Auto Hidden

Form Property PlacedPotion35 Auto Hidden

Form Property PlacedPotion36 Auto Hidden

Form Property PlacedPotion37 Auto Hidden

Form Property PlacedPotion38 Auto Hidden

Form Property PlacedPotion39 Auto Hidden

Form Property PlacedPotion40 Auto Hidden

Form Property PlacedPotion41 Auto Hidden

Form Property PlacedPotion42 Auto Hidden

Form Property PlacedPotion43 Auto Hidden

Form Property PlacedPotion44 Auto Hidden

Form Property PlacedPotion45 Auto Hidden

Form Property PlacedPotion46 Auto Hidden

Form Property PlacedPotion47 Auto Hidden

Form Property PlacedPotion48 Auto Hidden

Form Property PlacedPotion49 Auto Hidden

Form Property PlacedPotion50 Auto Hidden

{List of Placed Potions Forms}

ObjectReference Property PlacedPotion01Ref Auto Hidden

ObjectReference Property PlacedPotion02Ref Auto Hidden

ObjectReference Property PlacedPotion03Ref Auto Hidden

ObjectReference Property PlacedPotion04Ref Auto Hidden

ObjectReference Property PlacedPotion05Ref Auto Hidden

ObjectReference Property PlacedPotion06Ref Auto Hidden

ObjectReference Property PlacedPotion07Ref Auto Hidden

ObjectReference Property PlacedPotion08Ref Auto Hidden

ObjectReference Property PlacedPotion09Ref Auto Hidden

ObjectReference Property PlacedPotion10Ref Auto Hidden

ObjectReference Property PlacedPotion11Ref Auto Hidden

ObjectReference Property PlacedPotion12Ref Auto Hidden

ObjectReference Property PlacedPotion13Ref Auto Hidden

ObjectReference Property PlacedPotion14Ref Auto Hidden

ObjectReference Property PlacedPotion15Ref Auto Hidden

ObjectReference Property PlacedPotion16Ref Auto Hidden

ObjectReference Property PlacedPotion17Ref Auto Hidden

ObjectReference Property PlacedPotion18Ref Auto Hidden

ObjectReference Property PlacedPotion19Ref Auto Hidden

ObjectReference Property PlacedPotion20Ref Auto Hidden

ObjectReference Property PlacedPotion21Ref Auto Hidden

ObjectReference Property PlacedPotion22Ref Auto Hidden

ObjectReference Property PlacedPotion23Ref Auto Hidden

ObjectReference Property PlacedPotion24Ref Auto Hidden

ObjectReference Property PlacedPotion25Ref Auto Hidden

ObjectReference Property PlacedPotion26Ref Auto Hidden

ObjectReference Property PlacedPotion27Ref Auto Hidden

ObjectReference Property PlacedPotion28Ref Auto Hidden

ObjectReference Property PlacedPotion29Ref Auto Hidden

ObjectReference Property PlacedPotion30Ref Auto Hidden

ObjectReference Property PlacedPotion31Ref Auto Hidden

ObjectReference Property PlacedPotion32Ref Auto Hidden

ObjectReference Property PlacedPotion33Ref Auto Hidden

ObjectReference Property PlacedPotion34Ref Auto Hidden

ObjectReference Property PlacedPotion35Ref Auto Hidden

ObjectReference Property PlacedPotion36Ref Auto Hidden

ObjectReference Property PlacedPotion37Ref Auto Hidden

ObjectReference Property PlacedPotion38Ref Auto Hidden

ObjectReference Property PlacedPotion39Ref Auto Hidden

ObjectReference Property PlacedPotion40Ref Auto Hidden

ObjectReference Property PlacedPotion41Ref Auto Hidden

ObjectReference Property PlacedPotion42Ref Auto Hidden

ObjectReference Property PlacedPotion43Ref Auto Hidden

ObjectReference Property PlacedPotion44Ref Auto Hidden

ObjectReference Property PlacedPotion45Ref Auto Hidden

ObjectReference Property PlacedPotion46Ref Auto Hidden

ObjectReference Property PlacedPotion47Ref Auto Hidden

ObjectReference Property PlacedPotion48Ref Auto Hidden

ObjectReference Property PlacedPotion49Ref Auto Hidden

ObjectReference Property PlacedPotion50Ref Auto Hidden

{List of Placed Potion Refs}

Bool Property AlreadyLoaded = FALSE Auto Hidden

{Whether this script has already went through it's OnCellLoad() Event}

Bool Property BlockPotions = FALSE Auto Hidden

{Used for when you can't place any more potions}

Message Property potionshelfFirstActivateMESSAGE Auto

{Display message when the player activates a potionshelf for the first time. Only displays once.}

Message Property potionshelfNoMoreRoomMESSAGE Auto

{Displayed message for when the amount of potions the player is placing excedes the shelf limit.}

Message Property potionshelfNotApotionMESSAGE Auto

{Message displayed when the player places a non potion form in the container.}

Message Property potionshelfRoomLeftMESSAGE Auto

{Notification that tells the player how much room is left on the shelf upon first activating it.}

GlobalVariable Property potionshelfGlobal Auto

{Global showing whether or not the player has ever activated a potionshelf}


 

EVENT OnCellLoad()

if AlreadyLoaded == FALSE


 

; Get all the potion markers

PotionMarker01 = GetLinkedRef(PotionShelfPot01)

PotionMarker02 = GetLinkedRef(PotionShelfPot02)

PotionMarker03 = GetLinkedRef(PotionShelfPot03)

PotionMarker04 = GetLinkedRef(PotionShelfPot04)

PotionMarker05 = GetLinkedRef(PotionShelfPot05)

PotionMarker06 = GetLinkedRef(PotionShelfPot06)

PotionMarker07 = GetLinkedRef(PotionShelfPot07)

PotionMarker08 = GetLinkedRef(PotionShelfPot08)

PotionMarker09 = GetLinkedRef(PotionShelfPot09)

PotionMarker10 = GetLinkedRef(PotionShelfPot10)

PotionMarker11 = GetLinkedRef(PotionShelfPot11)

PotionMarker12 = GetLinkedRef(PotionShelfPot12)

PotionMarker13 = GetLinkedRef(PotionShelfPot13)

PotionMarker14 = GetLinkedRef(PotionShelfPot14)

PotionMarker15 = GetLinkedRef(PotionShelfPot15)

PotionMarker16 = GetLinkedRef(PotionShelfPot16)

PotionMarker17 = GetLinkedRef(PotionShelfPot17)

PotionMarker18 = GetLinkedRef(PotionShelfPot18)

PotionMarker19 = GetLinkedRef(PotionShelfPot19)

PotionMarker20 = GetLinkedRef(PotionShelfPot20)

PotionMarker21 = GetLinkedRef(PotionShelfPot21)

PotionMarker22 = GetLinkedRef(PotionShelfPot22)

PotionMarker23 = GetLinkedRef(PotionShelfPot23)

PotionMarker24 = GetLinkedRef(PotionShelfPot24)

PotionMarker25 = GetLinkedRef(PotionShelfPot25)

PotionMarker26 = GetLinkedRef(PotionShelfPot26)

PotionMarker27 = GetLinkedRef(PotionShelfPot27)

PotionMarker28 = GetLinkedRef(PotionShelfPot28)

PotionMarker29 = GetLinkedRef(PotionShelfPot29)

PotionMarker30 = GetLinkedRef(PotionShelfPot30)

PotionMarker31 = GetLinkedRef(PotionShelfPot31)

PotionMarker32 = GetLinkedRef(PotionShelfPot32)

PotionMarker33 = GetLinkedRef(PotionShelfPot33)

PotionMarker34 = GetLinkedRef(PotionShelfPot34)

PotionMarker35 = GetLinkedRef(PotionShelfPot35)

PotionMarker36 = GetLinkedRef(PotionShelfPot36)

PotionMarker37 = GetLinkedRef(PotionShelfPot37)

PotionMarker38 = GetLinkedRef(PotionShelfPot38)

PotionMarker39 = GetLinkedRef(PotionShelfPot39)

PotionMarker40 = GetLinkedRef(PotionShelfPot40)

PotionMarker41 = GetLinkedRef(PotionShelfPot41)

PotionMarker42 = GetLinkedRef(PotionShelfPot42)

PotionMarker43 = GetLinkedRef(PotionShelfPot43)

PotionMarker44 = GetLinkedRef(PotionShelfPot44)

PotionMarker45 = GetLinkedRef(PotionShelfPot45)

PotionMarker46 = GetLinkedRef(PotionShelfPot46)

PotionMarker47 = GetLinkedRef(PotionShelfPot47)

PotionMarker48 = GetLinkedRef(PotionShelfPot48)

PotionMarker49 = GetLinkedRef(PotionShelfPot49)

PotionMarker50 = GetLinkedRef(PotionShelfPot50)

potionshelfTrigger01Ref = (GetLinkedRef(potionshelfTrigger01) as PotionShelfTriggerScriptWHCA)

potionshelfTrigger02Ref = (GetLinkedRef(potionshelfTrigger02) as PotionShelfTriggerScriptWHCA)

potionshelfTrigger03Ref = (GetLinkedRef(potionshelfTrigger03) as PotionShelfTriggerScriptWHCA)

potionshelfTrigger04Ref = (GetLinkedRef(potionshelfTrigger04) as PotionShelfTriggerScriptWHCA)

; Count how many can be placed on this shelf

CountMaxPotions()

AlreadyLoaded = TRUE

endif

endEVENT

EVENT OnActivate(ObjectReference akActionRef)

BlockActivate()


 

potionshelfRoomLeftMESSAGE.Show((MaxPotionsAllowed - CurrentPotionsAmount))

if (potionshelfGlobal.GetValue() == 0)

potionshelfFirstActivateMESSAGE.Show()

potionshelfGlobal.SetValue(1)

endif

if potionshelfTrigger01Ref

potionshelfTrigger01Ref.GoToState("IgnorePotions")

endif

if potionshelfTrigger02Ref

potionshelfTrigger02Ref.GoToState("IgnorePotions")

endif

if potionshelfTrigger03Ref

potionshelfTrigger03Ref.GoToState("IgnorePotions")

endif

if potionshelfTrigger04Ref

potionshelfTrigger04Ref.GoToState("IgnorePotions")

endif

Wait(0.25)

; The following will fire when the player leaves inventory

UpdatePotions()

if potionshelfTrigger01Ref

potionshelfTrigger01Ref.GoToState("WaitForPotions")

endif

if potionshelfTrigger02Ref

potionshelfTrigger02Ref.GoToState("WaitForPotions")

endif

if potionshelfTrigger03Ref

potionshelfTrigger03Ref.GoToState("WaitForPotions")

endif

if potionshelfTrigger04Ref

potionshelfTrigger04Ref.GoToState("WaitForPotions")

endif

endEVENT

Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)

if (akBaseItem as Potion)

if BlockPotions == FALSE

; If the item is a potion find the corresponding potion reference and remove it.

RemovePotions(akBaseItem, aiItemCount)

CurrentPotionsAmount = CurrentPotionsAmount - aiItemCount

else

BlockPotions = FALSE

endif

endif

endEvent

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


 

if (akBaseItem as Potion)

; If the item being added is a potion then check to see if there is room in on the shelf.


 

if ((aiItemCount + CurrentPotionsAmount) <= MaxPotionsAllowed)

; There's room on the shelf, manage the potion placement

AddPotions(akBaseItem, aiItemCount)

CurrentPotionsAmount = CurrentPotionsAmount + aiItemCount

else

; There is no room on the shelf. Tell the player this and give the potion back.

utility.waitMenuMode(0)

;MessageBox("You can't place that many potions on this shelf")

potionshelfNoMoreRoomMESSAGE.Show()

BlockPotions = TRUE

self.RemoveItem(akBaseItem, aiItemCount, true, Game.GetPlayer())


 

endif

else

; The item placed in the container isn't a potion, so give the player back and tell her only potions are allowed.


 

self.RemoveItem(akBaseItem, aiItemCount, true, Game.GetPlayer())

utility.WaitMenuMode(0)

potionshelfNotApotionMESSAGE.Show()

endif


 

endEvent

Function BlockActivate()

if PlacedPotion01Ref

PlacedPotion01Ref.BlockActivation(TRUE)

endif

if PlacedPotion02Ref

PlacedPotion02Ref.BlockActivation(TRUE)

endif

if PlacedPotion03Ref

PlacedPotion03Ref.BlockActivation(TRUE)

endif

if PlacedPotion04Ref

PlacedPotion04Ref.BlockActivation(TRUE)

endif

if PlacedPotion05Ref

PlacedPotion05Ref.BlockActivation(TRUE)

endif

if PlacedPotion06Ref

PlacedPotion06Ref.BlockActivation(TRUE)

endif

if PlacedPotion07Ref

PlacedPotion07Ref.BlockActivation(TRUE)

endif

if PlacedPotion08Ref

PlacedPotion08Ref.BlockActivation(TRUE)

endif

if PlacedPotion09Ref

PlacedPotion09Ref.BlockActivation(TRUE)

endif

if PlacedPotion10Ref

PlacedPotion10Ref.BlockActivation(TRUE)

endif

endFunction

Function UnBlockActivate()

if PlacedPotion01Ref

PlacedPotion01Ref.BlockActivation(FALSE)

endif

if PlacedPotion02Ref

PlacedPotion02Ref.BlockActivation(FALSE)

endif

if PlacedPotion03Ref

PlacedPotion03Ref.BlockActivation(FALSE)

endif

if PlacedPotion04Ref

PlacedPotion04Ref.BlockActivation(FALSE)

endif

if PlacedPotion05Ref

PlacedPotion05Ref.BlockActivation(FALSE)

endif

if PlacedPotion06Ref

PlacedPotion06Ref.BlockActivation(FALSE)

endif

if PlacedPotion07Ref

PlacedPotion07Ref.BlockActivation(FALSE)

endif

if PlacedPotion08Ref

PlacedPotion08Ref.BlockActivation(FALSE)

endif

if PlacedPotion09Ref

PlacedPotion09Ref.BlockActivation(FALSE)

endif

if PlacedPotion10Ref

PlacedPotion10Ref.BlockActivation(FALSE)

endif

if PlacedPotion11Ref

PlacedPotion11Ref.BlockActivation(FALSE)

endif

if PlacedPotion12Ref

PlacedPotion12Ref.BlockActivation(FALSE)

endif

if PlacedPotion13Ref

PlacedPotion13Ref.BlockActivation(FALSE)

endif

if PlacedPotion14Ref

PlacedPotion14Ref.BlockActivation(FALSE)

endif

if PlacedPotion15Ref

PlacedPotion15Ref.BlockActivation(FALSE)

endif

endFunction

Function RemovePotions(Form PotionBase, Int PotsAmount)

; Find an empty potion form and place the new potion there

While PotsAmount > 0

if PlacedPotion01 == PotionBase

PlacedPotion01 = EmptyForm

elseif PlacedPotion02 == PotionBase

PlacedPotion02 = EmptyForm

elseif PlacedPotion03 == PotionBase

PlacedPotion03 = EmptyForm

elseif PlacedPotion04 == PotionBase

PlacedPotion04 = EmptyForm

elseif PlacedPotion05 == PotionBase

PlacedPotion05 = EmptyForm

elseif PlacedPotion06 == PotionBase

PlacedPotion06 = EmptyForm

elseif PlacedPotion07 == PotionBase

PlacedPotion07 = EmptyForm

elseif PlacedPotion08 == PotionBase

PlacedPotion08 = EmptyForm

elseif PlacedPotion09 == PotionBase

PlacedPotion09 = EmptyForm

elseif PlacedPotion10 == PotionBase

PlacedPotion10 = EmptyForm

elseif PlacedPotion11 == PotionBase

PlacedPotion11 = EmptyForm

elseif PlacedPotion12 == PotionBase

PlacedPotion12 = EmptyForm

elseif PlacedPotion13 == PotionBase

PlacedPotion13 = EmptyForm

elseif PlacedPotion14 == PotionBase

PlacedPotion14 = EmptyForm

elseif PlacedPotion15 == PotionBase

PlacedPotion15 = EmptyForm

elseif PlacedPotion16 == PotionBase

PlacedPotion16 = EmptyForm

elseif PlacedPotion17 == PotionBase

PlacedPotion17 = EmptyForm

elseif PlacedPotion18 == PotionBase

PlacedPotion18 = EmptyForm

elseif PlacedPotion19 == PotionBase

PlacedPotion19 = EmptyForm

elseif PlacedPotion20 == PotionBase

PlacedPotion20 = EmptyForm

elseif PlacedPotion21 == PotionBase

PlacedPotion21 = EmptyForm

elseif PlacedPotion22 == PotionBase

PlacedPotion22 = EmptyForm

elseif PlacedPotion23 == PotionBase

PlacedPotion23 = EmptyForm

elseif PlacedPotion24 == PotionBase

PlacedPotion24 = EmptyForm

elseif PlacedPotion25 == PotionBase

PlacedPotion25= EmptyForm

elseif PlacedPotion26 == PotionBase

PlacedPotion26 = EmptyForm

elseif PlacedPotion27 == PotionBase

PlacedPotion27 = EmptyForm

elseif PlacedPotion28 == PotionBase

PlacedPotion28 = EmptyForm

elseif PlacedPotion29 == PotionBase

PlacedPotion29 = EmptyForm

elseif PlacedPotion30 == PotionBase

PlacedPotion30 = EmptyForm

elseif PlacedPotion31 == PotionBase

PlacedPotion31 = EmptyForm

elseif PlacedPotion32 == PotionBase

PlacedPotion32 = EmptyForm

elseif PlacedPotion33 == PotionBase

PlacedPotion33 = EmptyForm

elseif PlacedPotion34 == PotionBase

PlacedPotion34 = EmptyForm

elseif PlacedPotion35 == PotionBase

PlacedPotion35 = EmptyForm

elseif PlacedPotion36 == PotionBase

PlacedPotion36 = EmptyForm

elseif PlacedPotion37 == PotionBase

PlacedPotion37 = EmptyForm

elseif PlacedPotion38 == PotionBase

PlacedPotion38 = EmptyForm

elseif PlacedPotion39 == PotionBase

PlacedPotion39 = EmptyForm

elseif PlacedPotion40 == PotionBase

PlacedPotion40 = EmptyForm

elseif PlacedPotion41 == PotionBase

PlacedPotion41 = EmptyForm

elseif PlacedPotion42 == PotionBase

PlacedPotion42 = EmptyForm

elseif PlacedPotion43 == PotionBase

PlacedPotion43 = EmptyForm

elseif PlacedPotion44 == PotionBase

PlacedPotion44 = EmptyForm

elseif PlacedPotion45 == PotionBase

PlacedPotion45 = EmptyForm

elseif PlacedPotion46 == PotionBase

PlacedPotion46 = EmptyForm

elseif PlacedPotion47 == PotionBase

PlacedPotion47 = EmptyForm

elseif PlacedPotion48 == PotionBase

PlacedPotion48 = EmptyForm

elseif PlacedPotion49 == PotionBase

PlacedPotion49 = EmptyForm

elseif PlacedPotion50 == PotionBase

PlacedPotion50 = EmptyForm

endif

PotsAmount = PotsAmount - 1

endWhile

endFunction

Function AddPotions(Form PotionBase, Int PotionsSAmount)

; Find an empty potions form and place the new potion there

While PotionsSAmount > 0

if PlacedPotion01 == EmptyForm

PlacedPotion01 = PotionBase

elseif PlacedPotion02 == EmptyForm

PlacedPotion02 = PotionBase

elseif PlacedPotion03 == EmptyForm

PlacedPotion03 = PotionBase

elseif PlacedPotion04 == EmptyForm

PlacedPotion04 = PotionBase

elseif PlacedPotion05 == EmptyForm

PlacedPotion05 = PotionBase

elseif PlacedPotion06 == EmptyForm

PlacedPotion06 = PotionBase

elseif PlacedPotion07 == EmptyForm

PlacedPotion07 = PotionBase

elseif PlacedPotion08 == EmptyForm

PlacedPotion08 = PotionBase

elseif PlacedPotion09 == EmptyForm

PlacedPotion09 = PotionBase

elseif PlacedPotion10 == EmptyForm

PlacedPotion10 = PotionBase

elseif PlacedPotion11 == EmptyForm

PlacedPotion11 = PotionBase

elseif PlacedPotion12 == EmptyForm

PlacedPotion12 = PotionBase

elseif PlacedPotion13 == EmptyForm

PlacedPotion13 = PotionBase

elseif PlacedPotion14 == EmptyForm

PlacedPotion14 = PotionBase

elseif PlacedPotion15 == EmptyForm

PlacedPotion15 = PotionBase

elseif PlacedPotion16 == EmptyForm

PlacedPotion16 = PotionBase

elseif PlacedPotion17 == EmptyForm

PlacedPotion17 = PotionBase

elseif PlacedPotion18 == EmptyForm

PlacedPotion18 = PotionBase

elseif PlacedPotion19 == EmptyForm

PlacedPotion19 = PotionBase

elseif PlacedPotion20 == EmptyForm

PlacedPotion20= PotionBase

elseif PlacedPotion21 == EmptyForm

PlacedPotion21 = PotionBase

elseif PlacedPotion22== EmptyForm

PlacedPotion22= PotionBase

elseif PlacedPotion23 == EmptyForm

PlacedPotion23 = PotionBase

elseif PlacedPotion24 == EmptyForm

PlacedPotion24 = PotionBase

elseif PlacedPotion25 == EmptyForm

PlacedPotion25 = PotionBase

elseif PlacedPotion26 == EmptyForm

PlacedPotion26 = PotionBase

elseif PlacedPotion27 == EmptyForm

PlacedPotion27 = PotionBase

elseif PlacedPotion28 == EmptyForm

PlacedPotion28 = PotionBase

elseif PlacedPotion29 == EmptyForm

PlacedPotion29 = PotionBase

elseif PlacedPotion30 == EmptyForm

PlacedPotion30 = PotionBase

elseif PlacedPotion31 == EmptyForm

PlacedPotion31 = PotionBase

elseif PlacedPotion32 == EmptyForm

PlacedPotion32 = PotionBase

elseif PlacedPotion33 == EmptyForm

PlacedPotion33 = PotionBase

elseif PlacedPotion34 == EmptyForm

PlacedPotion34 = PotionBase

elseif PlacedPotion35 == EmptyForm

PlacedPotion35 = PotionBase

elseif PlacedPotion36 == EmptyForm

PlacedPotion36 = PotionBase

elseif PlacedPotion37 == EmptyForm

PlacedPotion37 = PotionBase

elseif PlacedPotion38 == EmptyForm

PlacedPotion38 = PotionBase

elseif PlacedPotion39 == EmptyForm

PlacedPotion40 = PotionBase

elseif PlacedPotion40 == EmptyForm

PlacedPotion40 = PotionBase

elseif PlacedPotion41 == EmptyForm

PlacedPotion41 = PotionBase

elseif PlacedPotion42 == EmptyForm

PlacedPotion42 = PotionBase

elseif PlacedPotion43 == EmptyForm

PlacedPotion43 = PotionBase

elseif PlacedPotion44 == EmptyForm

PlacedPotion44 = PotionBase

elseif PlacedPotion45 == EmptyForm

PlacedPotion45 = PotionBase

elseif PlacedPotion46 == EmptyForm

PlacedPotion46 = PotionBase

elseif PlacedPotion47 == EmptyForm

PlacedPotion47 = PotionBase

elseif PlacedPotion48 == EmptyForm

PlacedPotion48 = PotionBase

elseif PlacedPotion49 == EmptyForm

PlacedPotion49 = PotionBase

elseif PlacedPotion50 == EmptyForm

PlacedPotion50 = PotionBase

EndIF

PotionsSAmount = PotionsSAmount - 1

endWhile

endFunction

Function CountMaxPotions()

; Checks how many potions can be placed on this shelf

if PotionMarker01 == EmptyRef

MaxPotionsAllowed = 0

;else

; MaxpotionsAllowed=50

endif

 

endFunction

ObjectReference Function UpdateSinglePotion(Form TargetPotion, ObjectReference PlacedPotionRef, ObjectReference PotionMarker)

ObjectReference retVal ; We return the potion we placed (or None)

; Note - it would be more efficient to move the potion to its home position if the desired

; potion matches the placed potion, but MoveTo doesn't work correctly with multi-part dynamic

; objects. So we sidestep the issue by always deleting and placing

if PlacedPotionRef

PlacedPotionRef.Disable()

PlacedPotionRef.Delete()

endIf

if TargetPotion

retVal = PotionMarker.PlaceAtMe(TargetPotion)

retVal.BlockActivation()

endIf

return retVal

EndFunction

Function UpdatePotions()

GoToState("PlacingPotions") ; Future calls should not mess with this stuff

PlacedPotion01Ref = UpdateSinglePotion(PlacedPotion01, PlacedPotion01Ref, PotionMarker01)

PlacedPotion02Ref = UpdateSinglePotion(PlacedPotion02, PlacedPotion02Ref, PotionMarker02)

PlacedPotion03Ref = UpdateSinglePotion(PlacedPotion03, PlacedPotion03Ref, PotionMarker03)

PlacedPotion04Ref = UpdateSinglePotion(PlacedPotion04, PlacedPotion04Ref, PotionMarker04)

PlacedPotion05Ref = UpdateSinglePotion(PlacedPotion05, PlacedPotion05Ref, PotionMarker05)

PlacedPotion06Ref = UpdateSinglePotion(PlacedPotion06, PlacedPotion06Ref, PotionMarker06)

PlacedPotion07Ref = UpdateSinglePotion(PlacedPotion07, PlacedPotion07Ref, PotionMarker07)

PlacedPotion08Ref = UpdateSinglePotion(PlacedPotion08, PlacedPotion08Ref, PotionMarker08)

PlacedPotion09Ref = UpdateSinglePotion(PlacedPotion09, PlacedPotion09Ref, PotionMarker09)

PlacedPotion10Ref = UpdateSinglePotion(PlacedPotion10, PlacedPotion10Ref, PotionMarker10)

PlacedPotion11Ref = UpdateSinglePotion(PlacedPotion11, PlacedPotion11Ref, PotionMarker11)

PlacedPotion12Ref = UpdateSinglePotion(PlacedPotion12, PlacedPotion12Ref, PotionMarker12)

PlacedPotion13Ref = UpdateSinglePotion(PlacedPotion13, PlacedPotion13Ref, PotionMarker13)

PlacedPotion14Ref = UpdateSinglePotion(PlacedPotion14, PlacedPotion14Ref, PotionMarker14)

PlacedPotion15Ref = UpdateSinglePotion(PlacedPotion15, PlacedPotion15Ref, PotionMarker15)

PlacedPotion16Ref = UpdateSinglePotion(PlacedPotion16, PlacedPotion16Ref, PotionMarker16)

PlacedPotion17Ref = UpdateSinglePotion(PlacedPotion17, PlacedPotion17Ref, PotionMarker17)

PlacedPotion18Ref = UpdateSinglePotion(PlacedPotion18, PlacedPotion18Ref, PotionMarker18)

PlacedPotion19Ref = UpdateSinglePotion(PlacedPotion19, PlacedPotion19Ref, PotionMarker19)

PlacedPotion20Ref = UpdateSinglePotion(PlacedPotion20, PlacedPotion20Ref, PotionMarker20)

PlacedPotion21Ref = UpdateSinglePotion(PlacedPotion21, PlacedPotion21Ref, PotionMarker21)

PlacedPotion22Ref = UpdateSinglePotion(PlacedPotion22, PlacedPotion22Ref, PotionMarker22)

PlacedPotion23Ref = UpdateSinglePotion(PlacedPotion23, PlacedPotion23Ref, PotionMarker23)

PlacedPotion24Ref = UpdateSinglePotion(PlacedPotion24, PlacedPotion24Ref, PotionMarker24)

PlacedPotion25Ref = UpdateSinglePotion(PlacedPotion25, PlacedPotion25Ref, PotionMarker25)

PlacedPotion26Ref = UpdateSinglePotion(PlacedPotion26, PlacedPotion26Ref, PotionMarker26)

PlacedPotion27Ref = UpdateSinglePotion(PlacedPotion27, PlacedPotion27Ref, PotionMarker27)

PlacedPotion28Ref = UpdateSinglePotion(PlacedPotion28, PlacedPotion28Ref, PotionMarker28)

PlacedPotion29Ref = UpdateSinglePotion(PlacedPotion29, PlacedPotion29Ref, PotionMarker29)

PlacedPotion30Ref = UpdateSinglePotion(PlacedPotion30, PlacedPotion30Ref, PotionMarker30)

PlacedPotion31Ref = UpdateSinglePotion(PlacedPotion31, PlacedPotion31Ref, PotionMarker31)

PlacedPotion32Ref = UpdateSinglePotion(PlacedPotion32, PlacedPotion32Ref, PotionMarker32)

PlacedPotion33Ref = UpdateSinglePotion(PlacedPotion33, PlacedPotion32Ref, PotionMarker33)

PlacedPotion34Ref = UpdateSinglePotion(PlacedPotion34, PlacedPotion33Ref, PotionMarker34)

PlacedPotion35Ref = UpdateSinglePotion(PlacedPotion35, PlacedPotion34Ref, PotionMarker35)

PlacedPotion36Ref = UpdateSinglePotion(PlacedPotion36, PlacedPotion36Ref, PotionMarker36)

PlacedPotion37Ref = UpdateSinglePotion(PlacedPotion37, PlacedPotion36Ref, PotionMarker37)

PlacedPotion38Ref = UpdateSinglePotion(PlacedPotion38, PlacedPotion38Ref, PotionMarker38)

PlacedPotion39Ref = UpdateSinglePotion(PlacedPotion39, PlacedPotion39Ref, PotionMarker39)

PlacedPotion40Ref = UpdateSinglePotion(PlacedPotion40, PlacedPotion40Ref, PotionMarker40)

PlacedPotion41Ref = UpdateSinglePotion(PlacedPotion41, PlacedPotion41Ref, PotionMarker41)

PlacedPotion42Ref = UpdateSinglePotion(PlacedPotion42, PlacedPotion42Ref, PotionMarker42)

PlacedPotion43Ref = UpdateSinglePotion(PlacedPotion43, PlacedPotion43Ref, PotionMarker43)

PlacedPotion44Ref = UpdateSinglePotion(PlacedPotion44, PlacedPotion44Ref, PotionMarker44)

PlacedPotion45Ref = UpdateSinglePotion(PlacedPotion45, PlacedPotion45Ref, PotionMarker45)

PlacedPotion46Ref = UpdateSinglePotion(PlacedPotion46, PlacedPotion46Ref, PotionMarker46)

PlacedPotion47Ref = UpdateSinglePotion(PlacedPotion47, PlacedPotion47Ref, PotionMarker47)

PlacedPotion48Ref = UpdateSinglePotion(PlacedPotion48, PlacedPotion48Ref, PotionMarker48)

PlacedPotion49Ref = UpdateSinglePotion(PlacedPotion49, PlacedPotion49Ref, PotionMarker49)

PlacedPotion50Ref = UpdateSinglePotion(PlacedPotion50, PlacedPotion50Ref, PotionMarker50)

UnBlockActivate() ; Allow the player to mess with them

GoToState("") ; Now allow potions to be updated again

EndFunction

State PlacingPotions

Function UpdatePotions()

; Already updating

EndFunction

EndState

 

:please: Remember

Any reference to ModN must be replaced by the name of your mod or the

abbreviation of your mod name. They must all be the exact same.

Example, if you replace ModN with the letters Jane then all instances of ModN must

be replaced with 'Jane'.


9. COMPILE your SCRIPTS


10. Place your items into your cell.

 

I. Placing the trigger first.

A. Trigger 3 -

This is the orange container trigger that holds the potions.

Find PotionShelfContainer50ModN in the object window

*where ModN is your mod name or your name. ModN can only be ONE name

consistant through out all of this tutorial.

Drag it over to the render window and place it high and flush in front of the shelf.

II. Placing potions.

You will place your created dummy potions on the shelf.

Find DefaultPotionShelfPotionMarker.

Drag and drop DefaultPotionShelfPotionMarker to the shelf 5 times.

Repeat until 15 potions, 5 per shelf are copied.

III. Connecting The Trigger.

A. Inside render window.

Open (PotionShelfContainer15ModN)

Click on SCRIPT tab

ADD your new script POTIONSHELFCONTAINERSCRIPT50x+MODN (this should be the only script here, remove other scripts if applicable).

Click on the Linkreference tab.

You will link ref a total of 15 times.

Linkref to each potion and use keyword PotionShelfPot01 through 15

Click on properties and auto fill all the variables. Ignore the item clutter

MaxPotionsAllowed should be set to 15.

It looks like this: (ignore potionshelftrigger01)

gallery_32134_424_19356.jpggallery_32134_424_23068.jpg

IV. Collision Markers

Add Collision Markers to stop run away potions.

Put each of the 5 collision markers around the shelf. 4 sides, 1 on top.

 

11. Test your potion rack in the cell you dropped it in.

If you need step by step instructions then click on this spoiler.

  1. Click 'M' on keyboard to make invisible markers appear in the render window.

  2. Click on Object Window:

  3. Click on *ALL

1. DefaultPotionRackPotionMarker

 

  1. Type the word 'Potion' into the filter box.

  2. Right click on DummyPotion.

  3. Click on Duplicate.

  4. Rename your duplicate to DefaultPotionShelfPotionMarker . If it already exists then we will use it.

 

2. PotionShelfContainer (orange).

 

  1. Filter: BookShelf

  2. Right Click on PlayerBookShelfContainer

  3. Duplicate PlayerBookShelfContainer.

  4. Rename PlayerBookShelfContainerDuplicate0x to PotionShelfContainer50ModN

     

     

    3. Keyword PotionShelfContainer

     

    In the Object Window:

    1. Click on Miscellaneous Branch.

    2. Click on Keyword Branch.

    3. Right click on Editor Id area and choose 'NEW'

    4. Color is purple. R=128 G=0 B=128

    5. Name the ID: PotionShelfContainer

    6. Press 'OK'

     


    4. Keyword PotionShelfPotxx

    In the Object Window:

     

    1. Click on Miscellaneous Branch.

    2. Click on Keyword Branch

    3. Right Click on Editor Id area and choose 'NEW'

    4. Color is lime green. R=116 G=186 B=69

    5. Name the ID: PotionShelfPot01

    6. Duplicate PotionShelfPot01 14 more times.

    Rename the duplicates PotionShelfPot02, PotionShelfPot03...etc.
    There will be PotionShelfPot01 through PotionShelfPot15 when finished.

     

    5.. Keyword PotionShelfTrigger

    In the Object Window:

     

    1. Click on Miscellaneous Branch.

    2. Click on Keyword Branch.

    3. Right Click on Editor Id area and choose 'NEW'

    4. Color is Black R.G.B are all zero.

    5. Name the ID: PotionShelfTrigger01

    Repeat this 3 more times for a total of four.
    PotionShelfTrigger01 through PotionShelfTrigger04

     

    6. Shelf to put the potions on.

     

    1. Click on *All in the Object Window

    2. Search: MarketDisplayShelf03

    3. Copy 1 to your cell.

     

    7: Messages for script.

     

    Find the MESSAGE area

    Object Window:

    1. Click on Miscellanous

    2. Click on Message

    3. Right Click on any message on the right and click on NEW.

    You can now edit the message box.

    A. Make your first message ID field, type: PotionShelfFirstActivateMessage

    1. In the Message Text box, type: Potions put here will be placed on the rack.

    2. Click OK

    B. Now make another NEW message: ID: PotionShelfNoMoreRoomMessage

    1. TEXT: You can't place that many potions on this rack.

    2. Click OK

    C. Make another NEW message:   ID: PotionShelfNotAPotionMessage

    1. TEXT: You can only place potions on this rack

    2. Click OK

    D. Make another NEW message: ID: PotionShelfRoomLeftMessage

    1. Text: You can place % of more potions on this shelf.

    2. Click OK

     

    8. GLOBAL TAR

     

    1. Click on Miscellaneous in the object window.

    2. Click on Global

    3. Right click on right side and click 'NEW'

    4. ID: PotionShelfGlobal

    5. Click OK

     

    9. Script Creation

    15 Potion Shelf Script.

     

    1. Click on 'GamePlay' at the top.

    2. Click on 'Papyrus Script Manager'

    3. Right click script name area and choose 'NEW'

    4. Name will be: PotionShelfContainerScript15+ModN(Modn is name of your mod)

    5. Extends : ObjectReference

    6. Press Enter

     

    Script to paste (click on spoiler)

    PASTE the following into your script editor.

    Scriptname PotionShelfContainerScript50xWHCA extends ObjectReference

    {Holds 1 to 50 potions}

     

    import debug

    import utility

     

    Form Property LItemPotionClutter Auto

    {Clutter item list to fill the shelf with}

     

    Keyword Property PotionShelfPot01 Auto

    Keyword Property PotionShelfPot02 Auto

    Keyword Property PotionShelfPot03 Auto

    Keyword Property PotionShelfPot04 Auto

    Keyword Property PotionShelfPot05 Auto

    Keyword Property PotionShelfPot06 Auto

    Keyword Property PotionShelfPot07 Auto

    Keyword Property PotionShelfPot08 Auto

    Keyword Property PotionShelfPot09 Auto

    Keyword Property PotionShelfPot10 Auto

    Keyword Property PotionShelfPot11 Auto

    Keyword Property PotionShelfPot12 Auto

    Keyword Property PotionShelfPot13 Auto

    Keyword Property PotionShelfPot14 Auto

    Keyword Property PotionShelfPot15 Auto

    Keyword Property PotionShelfPot16 Auto

    Keyword Property PotionShelfPot17 Auto

    Keyword Property PotionShelfPot18 Auto

    Keyword Property PotionShelfPot19 Auto

    Keyword Property PotionShelfPot20 Auto

    Keyword Property PotionShelfPot21 Auto

    Keyword Property PotionShelfPot22 Auto

    Keyword Property PotionShelfPot23 Auto

    Keyword Property PotionShelfPot24 Auto

    Keyword Property PotionShelfPot25 Auto

    Keyword Property PotionShelfPot26 Auto

    Keyword Property PotionShelfPot27 Auto

    Keyword Property PotionShelfPot28 Auto

    Keyword Property PotionShelfPot29 Auto

    Keyword Property PotionShelfPot30 Auto

    Keyword Property PotionShelfPot31 Auto

    Keyword Property PotionShelfPot32 Auto

    Keyword Property PotionShelfPot33 Auto

    Keyword Property PotionShelfPot34 Auto

    Keyword Property PotionShelfPot35 Auto

    Keyword Property PotionShelfPot36 Auto

    Keyword Property PotionShelfPot37 Auto

    Keyword Property PotionShelfPot38 Auto

    Keyword Property PotionShelfPot39 Auto

    Keyword Property PotionShelfPot40 Auto

    Keyword Property PotionShelfPot41 Auto

    Keyword Property PotionShelfPot42 Auto

    Keyword Property PotionShelfPot43 Auto

    Keyword Property PotionShelfPot44 Auto

    Keyword Property PotionShelfPot45 Auto

    Keyword Property PotionShelfPot46 Auto

    Keyword Property PotionShelfPot47 Auto

    Keyword Property PotionShelfPot48 Auto

    Keyword Property PotionShelfPot49 Auto

    Keyword Property PotionShelfPot50 Auto

    Keyword Property PotionShelfTrigger01 Auto

    Keyword Property PotionShelfTrigger02 Auto

    Keyword Property PotionShelfTrigger03 Auto

    Keyword Property PotionShelfTrigger04 Auto

     

    {List of required Keywords}

    ObjectReference Property PotionMarker01 Auto Hidden

    ObjectReference Property PotionMarker02 Auto Hidden

    ObjectReference Property PotionMarker03 Auto Hidden

    ObjectReference Property PotionMarker04 Auto Hidden

    ObjectReference Property PotionMarker05 Auto Hidden

    ObjectReference Property PotionMarker06 Auto Hidden

    ObjectReference Property PotionMarker07 Auto Hidden

    ObjectReference Property PotionMarker08 Auto Hidden

    ObjectReference Property PotionMarker09 Auto Hidden

    ObjectReference Property PotionMarker10 Auto Hidden

    ObjectReference Property PotionMarker11 Auto Hidden

    ObjectReference Property PotionMarker12 Auto Hidden

    ObjectReference Property PotionMarker13 Auto Hidden

    ObjectReference Property PotionMarker14 Auto Hidden

    ObjectReference Property PotionMarker15 Auto Hidden

    ObjectReference Property PotionMarker16 Auto Hidden

    ObjectReference Property PotionMarker17 Auto Hidden

    ObjectReference Property PotionMarker18 Auto Hidden

    ObjectReference Property PotionMarker19 Auto Hidden

    ObjectReference Property PotionMarker20 Auto Hidden

    ObjectReference Property PotionMarker21 Auto Hidden

    ObjectReference Property PotionMarker22 Auto Hidden

    ObjectReference Property PotionMarker23 Auto Hidden

    ObjectReference Property PotionMarker24 Auto Hidden

    ObjectReference Property PotionMarker25 Auto Hidden

    ObjectReference Property PotionMarker26 Auto Hidden

    ObjectReference Property PotionMarker27 Auto Hidden

    ObjectReference Property PotionMarker28 Auto Hidden

    ObjectReference Property PotionMarker29 Auto Hidden

    ObjectReference Property PotionMarker30 Auto Hidden

    ObjectReference Property PotionMarker31 Auto Hidden

    ObjectReference Property PotionMarker32 Auto Hidden

    ObjectReference Property PotionMarker33 Auto Hidden

    ObjectReference Property PotionMarker34 Auto Hidden

    ObjectReference Property PotionMarker35 Auto Hidden

    ObjectReference Property PotionMarker36 Auto Hidden

    ObjectReference Property PotionMarker37 Auto Hidden

    ObjectReference Property PotionMarker38 Auto Hidden

    ObjectReference Property PotionMarker39 Auto Hidden

    ObjectReference Property PotionMarker40 Auto Hidden

    ObjectReference Property PotionMarker41 Auto Hidden

    ObjectReference Property PotionMarker42 Auto Hidden

    ObjectReference Property PotionMarker43 Auto Hidden

    ObjectReference Property PotionMarker44 Auto Hidden

    ObjectReference Property PotionMarker45 Auto Hidden

    ObjectReference Property PotionMarker46 Auto Hidden

    ObjectReference Property PotionMarker47 Auto Hidden

    ObjectReference Property PotionMarker48 Auto Hidden

    ObjectReference Property PotionMarker49 Auto Hidden

    ObjectReference Property PotionMarker50 Auto Hidden

    ObjectReference Property potionshelfTrigger01Ref Auto Hidden

    ObjectReference Property potionshelfTrigger02Ref Auto Hidden

    ObjectReference Property potionshelfTrigger03Ref Auto Hidden

    ObjectReference Property potionshelfTrigger04Ref Auto Hidden

     

    Int Property MaxPotionsAllowed Auto Hidden

    {Max Potions allowed on this partciular shelf}

     

    Int Property CurrentPotionsAmount Auto Hidden

    {The current amount of potions placed on the shelf}

     

    Form Property EmptyForm Auto Hidden

    {Null Form}

     

    ObjectReference Property EmptyRef Auto Hidden

    {Null Ref}

     

    Form Property CurrentPotionsForm Auto Hidden

    {Potion Form we are working with at any one time}

     

    ObjectReference Property CurrentPotionsRef Auto Hidden

    {Potion Ref we are working with at any one time}

     

    Form Property PlacedPotion01 Auto Hidden

    Form Property PlacedPotion02 Auto Hidden

    Form Property PlacedPotion03 Auto Hidden

    Form Property PlacedPotion04 Auto Hidden

    Form Property PlacedPotion05 Auto Hidden

    Form Property PlacedPotion06 Auto Hidden

    Form Property PlacedPotion07 Auto Hidden

    Form Property PlacedPotion08 Auto Hidden

    Form Property PlacedPotion09 Auto Hidden

    Form Property PlacedPotion10 Auto Hidden

    Form Property PlacedPotion11 Auto Hidden

    Form Property PlacedPotion12 Auto Hidden

    Form Property PlacedPotion13 Auto Hidden

    Form Property PlacedPotion14 Auto Hidden

    Form Property PlacedPotion15 Auto Hidden

    Form Property PlacedPotion16 Auto Hidden

    Form Property PlacedPotion17 Auto Hidden

    Form Property PlacedPotion18 Auto Hidden

    Form Property PlacedPotion19 Auto Hidden

    Form Property PlacedPotion20 Auto Hidden

    Form Property PlacedPotion21 Auto Hidden

    Form Property PlacedPotion22 Auto Hidden

    Form Property PlacedPotion23 Auto Hidden

    Form Property PlacedPotion24 Auto Hidden

    Form Property PlacedPotion25 Auto Hidden

    Form Property PlacedPotion26 Auto Hidden

    Form Property PlacedPotion27 Auto Hidden

    Form Property PlacedPotion28 Auto Hidden

    Form Property PlacedPotion29 Auto Hidden

    Form Property PlacedPotion30 Auto Hidden

    Form Property PlacedPotion31 Auto Hidden

    Form Property PlacedPotion32 Auto Hidden

    Form Property PlacedPotion33 Auto Hidden

    Form Property PlacedPotion34 Auto Hidden

    Form Property PlacedPotion35 Auto Hidden

    Form Property PlacedPotion36 Auto Hidden

    Form Property PlacedPotion37 Auto Hidden

    Form Property PlacedPotion38 Auto Hidden

    Form Property PlacedPotion39 Auto Hidden

    Form Property PlacedPotion40 Auto Hidden

    Form Property PlacedPotion41 Auto Hidden

    Form Property PlacedPotion42 Auto Hidden

    Form Property PlacedPotion43 Auto Hidden

    Form Property PlacedPotion44 Auto Hidden

    Form Property PlacedPotion45 Auto Hidden

    Form Property PlacedPotion46 Auto Hidden

    Form Property PlacedPotion47 Auto Hidden

    Form Property PlacedPotion48 Auto Hidden

    Form Property PlacedPotion49 Auto Hidden

    Form Property PlacedPotion50 Auto Hidden

     

    {List of Placed Potions Forms}

     

    ObjectReference Property PlacedPotion01Ref Auto Hidden

    ObjectReference Property PlacedPotion02Ref Auto Hidden

    ObjectReference Property PlacedPotion03Ref Auto Hidden

    ObjectReference Property PlacedPotion04Ref Auto Hidden

    ObjectReference Property PlacedPotion05Ref Auto Hidden

    ObjectReference Property PlacedPotion06Ref Auto Hidden

    ObjectReference Property PlacedPotion07Ref Auto Hidden

    ObjectReference Property PlacedPotion08Ref Auto Hidden

    ObjectReference Property PlacedPotion09Ref Auto Hidden

    ObjectReference Property PlacedPotion10Ref Auto Hidden

    ObjectReference Property PlacedPotion11Ref Auto Hidden

    ObjectReference Property PlacedPotion12Ref Auto Hidden

    ObjectReference Property PlacedPotion13Ref Auto Hidden

    ObjectReference Property PlacedPotion14Ref Auto Hidden

    ObjectReference Property PlacedPotion15Ref Auto Hidden

    ObjectReference Property PlacedPotion16Ref Auto Hidden

    ObjectReference Property PlacedPotion17Ref Auto Hidden

    ObjectReference Property PlacedPotion18Ref Auto Hidden

    ObjectReference Property PlacedPotion19Ref Auto Hidden

    ObjectReference Property PlacedPotion20Ref Auto Hidden

    ObjectReference Property PlacedPotion21Ref Auto Hidden

    ObjectReference Property PlacedPotion22Ref Auto Hidden

    ObjectReference Property PlacedPotion23Ref Auto Hidden

    ObjectReference Property PlacedPotion24Ref Auto Hidden

    ObjectReference Property PlacedPotion25Ref Auto Hidden

    ObjectReference Property PlacedPotion26Ref Auto Hidden

    ObjectReference Property PlacedPotion27Ref Auto Hidden

    ObjectReference Property PlacedPotion28Ref Auto Hidden

    ObjectReference Property PlacedPotion29Ref Auto Hidden

    ObjectReference Property PlacedPotion30Ref Auto Hidden

    ObjectReference Property PlacedPotion31Ref Auto Hidden

    ObjectReference Property PlacedPotion32Ref Auto Hidden

    ObjectReference Property PlacedPotion33Ref Auto Hidden

    ObjectReference Property PlacedPotion34Ref Auto Hidden

    ObjectReference Property PlacedPotion35Ref Auto Hidden

    ObjectReference Property PlacedPotion36Ref Auto Hidden

    ObjectReference Property PlacedPotion37Ref Auto Hidden

    ObjectReference Property PlacedPotion38Ref Auto Hidden

    ObjectReference Property PlacedPotion39Ref Auto Hidden

    ObjectReference Property PlacedPotion40Ref Auto Hidden

    ObjectReference Property PlacedPotion41Ref Auto Hidden

    ObjectReference Property PlacedPotion42Ref Auto Hidden

    ObjectReference Property PlacedPotion43Ref Auto Hidden

    ObjectReference Property PlacedPotion44Ref Auto Hidden

    ObjectReference Property PlacedPotion45Ref Auto Hidden

    ObjectReference Property PlacedPotion46Ref Auto Hidden

    ObjectReference Property PlacedPotion47Ref Auto Hidden

    ObjectReference Property PlacedPotion48Ref Auto Hidden

    ObjectReference Property PlacedPotion49Ref Auto Hidden

    ObjectReference Property PlacedPotion50Ref Auto Hidden

     

    {List of Placed Potion Refs}

     

    Bool Property AlreadyLoaded = FALSE Auto Hidden

    {Whether this script has already went through it's OnCellLoad() Event}

     

    Bool Property BlockPotions = FALSE Auto Hidden

    {Used for when you can't place any more potions}

     

    Message Property potionshelfFirstActivateMESSAGE Auto

    {Display message when the player activates a potionshelf for the first time. Only displays once.}

     

    Message Property potionshelfNoMoreRoomMESSAGE Auto

    {Displayed message for when the amount of potions the player is placing excedes the shelf limit.}

     

    Message Property potionshelfNotApotionMESSAGE Auto

    {Message displayed when the player places a non potion form in the container.}

     

    Message Property potionshelfRoomLeftMESSAGE Auto

    {Notification that tells the player how much room is left on the shelf upon first activating it.}

     

    GlobalVariable Property potionshelfGlobal Auto

    {Global showing whether or not the player has ever activated a potionshelf}

     

     

    EVENT OnCellLoad()

    if AlreadyLoaded == FALSE

     

    ; Get all the potion markers

    PotionMarker01 = GetLinkedRef(PotionShelfPot01)

    PotionMarker02 = GetLinkedRef(PotionShelfPot02)

    PotionMarker03 = GetLinkedRef(PotionShelfPot03)

    PotionMarker04 = GetLinkedRef(PotionShelfPot04)

    PotionMarker05 = GetLinkedRef(PotionShelfPot05)

    PotionMarker06 = GetLinkedRef(PotionShelfPot06)

    PotionMarker07 = GetLinkedRef(PotionShelfPot07)

    PotionMarker08 = GetLinkedRef(PotionShelfPot08)

    PotionMarker09 = GetLinkedRef(PotionShelfPot09)

    PotionMarker10 = GetLinkedRef(PotionShelfPot10)

    PotionMarker11 = GetLinkedRef(PotionShelfPot11)

    PotionMarker12 = GetLinkedRef(PotionShelfPot12)

    PotionMarker13 = GetLinkedRef(PotionShelfPot13)

    PotionMarker14 = GetLinkedRef(PotionShelfPot14)

    PotionMarker15 = GetLinkedRef(PotionShelfPot15)

    PotionMarker16 = GetLinkedRef(PotionShelfPot16)

    PotionMarker17 = GetLinkedRef(PotionShelfPot17)

    PotionMarker18 = GetLinkedRef(PotionShelfPot18)

    PotionMarker19 = GetLinkedRef(PotionShelfPot19)

    PotionMarker20 = GetLinkedRef(PotionShelfPot20)

    PotionMarker21 = GetLinkedRef(PotionShelfPot21)

    PotionMarker22 = GetLinkedRef(PotionShelfPot22)

    PotionMarker23 = GetLinkedRef(PotionShelfPot23)

    PotionMarker24 = GetLinkedRef(PotionShelfPot24)

    PotionMarker25 = GetLinkedRef(PotionShelfPot25)

    PotionMarker26 = GetLinkedRef(PotionShelfPot26)

    PotionMarker27 = GetLinkedRef(PotionShelfPot27)

    PotionMarker28 = GetLinkedRef(PotionShelfPot28)

    PotionMarker29 = GetLinkedRef(PotionShelfPot29)

    PotionMarker30 = GetLinkedRef(PotionShelfPot30)

    PotionMarker31 = GetLinkedRef(PotionShelfPot31)

    PotionMarker32 = GetLinkedRef(PotionShelfPot32)

    PotionMarker33 = GetLinkedRef(PotionShelfPot33)

    PotionMarker34 = GetLinkedRef(PotionShelfPot34)

    PotionMarker35 = GetLinkedRef(PotionShelfPot35)

    PotionMarker36 = GetLinkedRef(PotionShelfPot36)

    PotionMarker37 = GetLinkedRef(PotionShelfPot37)

    PotionMarker38 = GetLinkedRef(PotionShelfPot38)

    PotionMarker39 = GetLinkedRef(PotionShelfPot39)

    PotionMarker40 = GetLinkedRef(PotionShelfPot40)

    PotionMarker41 = GetLinkedRef(PotionShelfPot41)

    PotionMarker42 = GetLinkedRef(PotionShelfPot42)

    PotionMarker43 = GetLinkedRef(PotionShelfPot43)

    PotionMarker44 = GetLinkedRef(PotionShelfPot44)

    PotionMarker45 = GetLinkedRef(PotionShelfPot45)

    PotionMarker46 = GetLinkedRef(PotionShelfPot46)

    PotionMarker47 = GetLinkedRef(PotionShelfPot47)

    PotionMarker48 = GetLinkedRef(PotionShelfPot48)

    PotionMarker49 = GetLinkedRef(PotionShelfPot49)

    PotionMarker50 = GetLinkedRef(PotionShelfPot50)

    potionshelfTrigger01Ref = (GetLinkedRef(potionshelfTrigger01) as PotionShelfTriggerScriptWHCA)

    potionshelfTrigger02Ref = (GetLinkedRef(potionshelfTrigger02) as PotionShelfTriggerScriptWHCA)

    potionshelfTrigger03Ref = (GetLinkedRef(potionshelfTrigger03) as PotionShelfTriggerScriptWHCA)

    potionshelfTrigger04Ref = (GetLinkedRef(potionshelfTrigger04) as PotionShelfTriggerScriptWHCA)

     

    ; Count how many can be placed on this shelf

    CountMaxPotions()

     

    AlreadyLoaded = TRUE

    endif

    endEVENT

     

    EVENT OnActivate(ObjectReference akActionRef)

    BlockActivate()

     

    potionshelfRoomLeftMESSAGE.Show((MaxPotionsAllowed - CurrentPotionsAmount))

     

    if (potionshelfGlobal.GetValue() == 0)

    potionshelfFirstActivateMESSAGE.Show()

    potionshelfGlobal.SetValue(1)

    endif

     

    if potionshelfTrigger01Ref

    potionshelfTrigger01Ref.GoToState("IgnorePotions")

    endif

    if potionshelfTrigger02Ref

    potionshelfTrigger02Ref.GoToState("IgnorePotions")

    endif

    if potionshelfTrigger03Ref

    potionshelfTrigger03Ref.GoToState("IgnorePotions")

    endif

    if potionshelfTrigger04Ref

    potionshelfTrigger04Ref.GoToState("IgnorePotions")

    endif

     

    Wait(0.25)

    ; The following will fire when the player leaves inventory

     

    UpdatePotions()

     

    if potionshelfTrigger01Ref

    potionshelfTrigger01Ref.GoToState("WaitForPotions")

    endif

    if potionshelfTrigger02Ref

    potionshelfTrigger02Ref.GoToState("WaitForPotions")

    endif

    if potionshelfTrigger03Ref

    potionshelfTrigger03Ref.GoToState("WaitForPotions")

    endif

    if potionshelfTrigger04Ref

    potionshelfTrigger04Ref.GoToState("WaitForPotions")

    endif

    endEVENT

     

    Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)

    if (akBaseItem as Potion)

    if BlockPotions == FALSE

    ; If the item is a potion find the corresponding potion reference and remove it.

    RemovePotions(akBaseItem, aiItemCount)

    CurrentPotionsAmount = CurrentPotionsAmount - aiItemCount

    else

    BlockPotions = FALSE

    endif

    endif

    endEvent

     

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

     

    if (akBaseItem as Potion)

    ; If the item being added is a potion then check to see if there is room in on the shelf.

     

    if ((aiItemCount + CurrentPotionsAmount) <= MaxPotionsAllowed)

    ; There's room on the shelf, manage the potion placement

     

    AddPotions(akBaseItem, aiItemCount)

    CurrentPotionsAmount = CurrentPotionsAmount + aiItemCount

    else

    ; There is no room on the shelf. Tell the player this and give the potion back.

    utility.waitMenuMode(0)

    ;MessageBox("You can't place that many potions on this shelf")

    potionshelfNoMoreRoomMESSAGE.Show()

    BlockPotions = TRUE

    self.RemoveItem(akBaseItem, aiItemCount, true, Game.GetPlayer())

     

    endif

    else

    ; The item placed in the container isn't a potion, so give the player back and tell her only potions are allowed.

     

    self.RemoveItem(akBaseItem, aiItemCount, true, Game.GetPlayer())

    utility.WaitMenuMode(0)

    potionshelfNotApotionMESSAGE.Show()

    endif

     

    endEvent

     

    Function BlockActivate()

    if PlacedPotion01Ref

    PlacedPotion01Ref.BlockActivation(TRUE)

    endif

    if PlacedPotion02Ref

    PlacedPotion02Ref.BlockActivation(TRUE)

    endif

    if PlacedPotion03Ref

    PlacedPotion03Ref.BlockActivation(TRUE)

    endif

    if PlacedPotion04Ref

    PlacedPotion04Ref.BlockActivation(TRUE)

    endif

    if PlacedPotion05Ref

    PlacedPotion05Ref.BlockActivation(TRUE)

    endif

    if PlacedPotion06Ref

    PlacedPotion06Ref.BlockActivation(TRUE)

    endif

    if PlacedPotion07Ref

    PlacedPotion07Ref.BlockActivation(TRUE)

    endif

    if PlacedPotion08Ref

    PlacedPotion08Ref.BlockActivation(TRUE)

    endif

    if PlacedPotion09Ref

    PlacedPotion09Ref.BlockActivation(TRUE)

    endif

    if PlacedPotion10Ref

    PlacedPotion10Ref.BlockActivation(TRUE)

    endif

    endFunction

     

    Function UnBlockActivate()

    if PlacedPotion01Ref

    PlacedPotion01Ref.BlockActivation(FALSE)

    endif

    if PlacedPotion02Ref

    PlacedPotion02Ref.BlockActivation(FALSE)

    endif

    if PlacedPotion03Ref

    PlacedPotion03Ref.BlockActivation(FALSE)

    endif

    if PlacedPotion04Ref

    PlacedPotion04Ref.BlockActivation(FALSE)

    endif

    if PlacedPotion05Ref

    PlacedPotion05Ref.BlockActivation(FALSE)

    endif

    if PlacedPotion06Ref

    PlacedPotion06Ref.BlockActivation(FALSE)

    endif

    if PlacedPotion07Ref

    PlacedPotion07Ref.BlockActivation(FALSE)

    endif

    if PlacedPotion08Ref

    PlacedPotion08Ref.BlockActivation(FALSE)

    endif

    if PlacedPotion09Ref

    PlacedPotion09Ref.BlockActivation(FALSE)

    endif

    if PlacedPotion10Ref

    PlacedPotion10Ref.BlockActivation(FALSE)

    endif

    if PlacedPotion11Ref

    PlacedPotion11Ref.BlockActivation(FALSE)

    endif

    if PlacedPotion12Ref

    PlacedPotion12Ref.BlockActivation(FALSE)

    endif

    if PlacedPotion13Ref

    PlacedPotion13Ref.BlockActivation(FALSE)

    endif

    if PlacedPotion14Ref

    PlacedPotion14Ref.BlockActivation(FALSE)

    endif

    if PlacedPotion15Ref

    PlacedPotion15Ref.BlockActivation(FALSE)

    endif

    endFunction

     

    Function RemovePotions(Form PotionBase, Int PotsAmount)

    ; Find an empty potion form and place the new potion there

    While PotsAmount > 0

    if PlacedPotion01 == PotionBase

    PlacedPotion01 = EmptyForm

    elseif PlacedPotion02 == PotionBase

    PlacedPotion02 = EmptyForm

    elseif PlacedPotion03 == PotionBase

    PlacedPotion03 = EmptyForm

    elseif PlacedPotion04 == PotionBase

    PlacedPotion04 = EmptyForm

    elseif PlacedPotion05 == PotionBase

    PlacedPotion05 = EmptyForm

    elseif PlacedPotion06 == PotionBase

    PlacedPotion06 = EmptyForm

    elseif PlacedPotion07 == PotionBase

    PlacedPotion07 = EmptyForm

    elseif PlacedPotion08 == PotionBase

    PlacedPotion08 = EmptyForm

    elseif PlacedPotion09 == PotionBase

    PlacedPotion09 = EmptyForm

    elseif PlacedPotion10 == PotionBase

    PlacedPotion10 = EmptyForm

    elseif PlacedPotion11 == PotionBase

    PlacedPotion11 = EmptyForm

    elseif PlacedPotion12 == PotionBase

    PlacedPotion12 = EmptyForm

    elseif PlacedPotion13 == PotionBase

    PlacedPotion13 = EmptyForm

    elseif PlacedPotion14 == PotionBase

    PlacedPotion14 = EmptyForm

    elseif PlacedPotion15 == PotionBase

    PlacedPotion15 = EmptyForm

    elseif PlacedPotion16 == PotionBase

    PlacedPotion16 = EmptyForm

    elseif PlacedPotion17 == PotionBase

    PlacedPotion17 = EmptyForm

    elseif PlacedPotion18 == PotionBase

    PlacedPotion18 = EmptyForm

    elseif PlacedPotion19 == PotionBase

    PlacedPotion19 = EmptyForm

    elseif PlacedPotion20 == PotionBase

    PlacedPotion20 = EmptyForm

    elseif PlacedPotion21 == PotionBase

    PlacedPotion21 = EmptyForm

    elseif PlacedPotion22 == PotionBase

    PlacedPotion22 = EmptyForm

    elseif PlacedPotion23 == PotionBase

    PlacedPotion23 = EmptyForm

    elseif PlacedPotion24 == PotionBase

    PlacedPotion24 = EmptyForm

    elseif PlacedPotion25 == PotionBase

    PlacedPotion25= EmptyForm

    elseif PlacedPotion26 == PotionBase

    PlacedPotion26 = EmptyForm

    elseif PlacedPotion27 == PotionBase

    PlacedPotion27 = EmptyForm

    elseif PlacedPotion28 == PotionBase

    PlacedPotion28 = EmptyForm

    elseif PlacedPotion29 == PotionBase

    PlacedPotion29 = EmptyForm

    elseif PlacedPotion30 == PotionBase

    PlacedPotion30 = EmptyForm

    elseif PlacedPotion31 == PotionBase

    PlacedPotion31 = EmptyForm

    elseif PlacedPotion32 == PotionBase

    PlacedPotion32 = EmptyForm

    elseif PlacedPotion33 == PotionBase

    PlacedPotion33 = EmptyForm

    elseif PlacedPotion34 == PotionBase

    PlacedPotion34 = EmptyForm

    elseif PlacedPotion35 == PotionBase

    PlacedPotion35 = EmptyForm

    elseif PlacedPotion36 == PotionBase

    PlacedPotion36 = EmptyForm

    elseif PlacedPotion37 == PotionBase

    PlacedPotion37 = EmptyForm

    elseif PlacedPotion38 == PotionBase

    PlacedPotion38 = EmptyForm

    elseif PlacedPotion39 == PotionBase

    PlacedPotion39 = EmptyForm

    elseif PlacedPotion40 == PotionBase

    PlacedPotion40 = EmptyForm

    elseif PlacedPotion41 == PotionBase

    PlacedPotion41 = EmptyForm

    elseif PlacedPotion42 == PotionBase

    PlacedPotion42 = EmptyForm

    elseif PlacedPotion43 == PotionBase

    PlacedPotion43 = EmptyForm

    elseif PlacedPotion44 == PotionBase

    PlacedPotion44 = EmptyForm

    elseif PlacedPotion45 == PotionBase

    PlacedPotion45 = EmptyForm

    elseif PlacedPotion46 == PotionBase

    PlacedPotion46 = EmptyForm

    elseif PlacedPotion47 == PotionBase

    PlacedPotion47 = EmptyForm

    elseif PlacedPotion48 == PotionBase

    PlacedPotion48 = EmptyForm

    elseif PlacedPotion49 == PotionBase

    PlacedPotion49 = EmptyForm

    elseif PlacedPotion50 == PotionBase

    PlacedPotion50 = EmptyForm

    endif

    PotsAmount = PotsAmount - 1

    endWhile

    endFunction

     

    Function AddPotions(Form PotionBase, Int PotionsSAmount)

    ; Find an empty potions form and place the new potion there

    While PotionsSAmount > 0

    if PlacedPotion01 == EmptyForm

    PlacedPotion01 = PotionBase

    elseif PlacedPotion02 == EmptyForm

    PlacedPotion02 = PotionBase

    elseif PlacedPotion03 == EmptyForm

    PlacedPotion03 = PotionBase

    elseif PlacedPotion04 == EmptyForm

    PlacedPotion04 = PotionBase

    elseif PlacedPotion05 == EmptyForm

    PlacedPotion05 = PotionBase

    elseif PlacedPotion06 == EmptyForm

    PlacedPotion06 = PotionBase

    elseif PlacedPotion07 == EmptyForm

    PlacedPotion07 = PotionBase

    elseif PlacedPotion08 == EmptyForm

    PlacedPotion08 = PotionBase

    elseif PlacedPotion09 == EmptyForm

    PlacedPotion09 = PotionBase

    elseif PlacedPotion10 == EmptyForm

    PlacedPotion10 = PotionBase

    elseif PlacedPotion11 == EmptyForm

    PlacedPotion11 = PotionBase

    elseif PlacedPotion12 == EmptyForm

    PlacedPotion12 = PotionBase

    elseif PlacedPotion13 == EmptyForm

    PlacedPotion13 = PotionBase

    elseif PlacedPotion14 == EmptyForm

    PlacedPotion14 = PotionBase

    elseif PlacedPotion15 == EmptyForm

    PlacedPotion15 = PotionBase

    elseif PlacedPotion16 == EmptyForm

    PlacedPotion16 = PotionBase

    elseif PlacedPotion17 == EmptyForm

    PlacedPotion17 = PotionBase

    elseif PlacedPotion18 == EmptyForm

    PlacedPotion18 = PotionBase

    elseif PlacedPotion19 == EmptyForm

    PlacedPotion19 = PotionBase

    elseif PlacedPotion20 == EmptyForm

    PlacedPotion20= PotionBase

    elseif PlacedPotion21 == EmptyForm

    PlacedPotion21 = PotionBase

    elseif PlacedPotion22== EmptyForm

    PlacedPotion22= PotionBase

    elseif PlacedPotion23 == EmptyForm

    PlacedPotion23 = PotionBase

    elseif PlacedPotion24 == EmptyForm

    PlacedPotion24 = PotionBase

    elseif PlacedPotion25 == EmptyForm

    PlacedPotion25 = PotionBase

    elseif PlacedPotion26 == EmptyForm

    PlacedPotion26 = PotionBase

    elseif PlacedPotion27 == EmptyForm

    PlacedPotion27 = PotionBase

    elseif PlacedPotion28 == EmptyForm

    PlacedPotion28 = PotionBase

    elseif PlacedPotion29 == EmptyForm

    PlacedPotion29 = PotionBase

    elseif PlacedPotion30 == EmptyForm

    PlacedPotion30 = PotionBase

    elseif PlacedPotion31 == EmptyForm

    PlacedPotion31 = PotionBase

    elseif PlacedPotion32 == EmptyForm

    PlacedPotion32 = PotionBase

    elseif PlacedPotion33 == EmptyForm

    PlacedPotion33 = PotionBase

    elseif PlacedPotion34 == EmptyForm

    PlacedPotion34 = PotionBase

    elseif PlacedPotion35 == EmptyForm

    PlacedPotion35 = PotionBase

    elseif PlacedPotion36 == EmptyForm

    PlacedPotion36 = PotionBase

    elseif PlacedPotion37 == EmptyForm

    PlacedPotion37 = PotionBase

    elseif PlacedPotion38 == EmptyForm

    PlacedPotion38 = PotionBase

    elseif PlacedPotion39 == EmptyForm

    PlacedPotion40 = PotionBase

    elseif PlacedPotion40 == EmptyForm

    PlacedPotion40 = PotionBase

    elseif PlacedPotion41 == EmptyForm

    PlacedPotion41 = PotionBase

    elseif PlacedPotion42 == EmptyForm

    PlacedPotion42 = PotionBase

    elseif PlacedPotion43 == EmptyForm

    PlacedPotion43 = PotionBase

    elseif PlacedPotion44 == EmptyForm

    PlacedPotion44 = PotionBase

    elseif PlacedPotion45 == EmptyForm

    PlacedPotion45 = PotionBase

    elseif PlacedPotion46 == EmptyForm

    PlacedPotion46 = PotionBase

    elseif PlacedPotion47 == EmptyForm

    PlacedPotion47 = PotionBase

    elseif PlacedPotion48 == EmptyForm

    PlacedPotion48 = PotionBase

    elseif PlacedPotion49 == EmptyForm

    PlacedPotion49 = PotionBase

    elseif PlacedPotion50 == EmptyForm

    PlacedPotion50 = PotionBase

    EndIF

    PotionsSAmount = PotionsSAmount - 1

    endWhile

    endFunction

     

    Function CountMaxPotions()

    ; Checks how many potions can be placed on this shelf

    if PotionMarker01 == EmptyRef

    MaxPotionsAllowed = 0

    ;else

    ; MaxpotionsAllowed=50

    endif

     

    endFunction

     

     

    ObjectReference Function UpdateSinglePotion(Form TargetPotion, ObjectReference PlacedPotionRef, ObjectReference PotionMarker)

    ObjectReference retVal ; We return the potion we placed (or None)

    ; Note - it would be more efficient to move the potion to its home position if the desired

    ; potion matches the placed potion, but MoveTo doesn't work correctly with multi-part dynamic

    ; objects. So we sidestep the issue by always deleting and placing

    if PlacedPotionRef

    PlacedPotionRef.Disable()

    PlacedPotionRef.Delete()

    endIf

    if TargetPotion

    retVal = PotionMarker.PlaceAtMe(TargetPotion)

    retVal.BlockActivation()

    endIf

    return retVal

    EndFunction

    Function UpdatePotions()

    GoToState("PlacingPotions") ; Future calls should not mess with this stuff

    PlacedPotion01Ref = UpdateSinglePotion(PlacedPotion01, PlacedPotion01Ref, PotionMarker01)

    PlacedPotion02Ref = UpdateSinglePotion(PlacedPotion02, PlacedPotion02Ref, PotionMarker02)

    PlacedPotion03Ref = UpdateSinglePotion(PlacedPotion03, PlacedPotion03Ref, PotionMarker03)

    PlacedPotion04Ref = UpdateSinglePotion(PlacedPotion04, PlacedPotion04Ref, PotionMarker04)

    PlacedPotion05Ref = UpdateSinglePotion(PlacedPotion05, PlacedPotion05Ref, PotionMarker05)

    PlacedPotion06Ref = UpdateSinglePotion(PlacedPotion06, PlacedPotion06Ref, PotionMarker06)

    PlacedPotion07Ref = UpdateSinglePotion(PlacedPotion07, PlacedPotion07Ref, PotionMarker07)

    PlacedPotion08Ref = UpdateSinglePotion(PlacedPotion08, PlacedPotion08Ref, PotionMarker08)

    PlacedPotion09Ref = UpdateSinglePotion(PlacedPotion09, PlacedPotion09Ref, PotionMarker09)

    PlacedPotion10Ref = UpdateSinglePotion(PlacedPotion10, PlacedPotion10Ref, PotionMarker10)

    PlacedPotion11Ref = UpdateSinglePotion(PlacedPotion11, PlacedPotion11Ref, PotionMarker11)

    PlacedPotion12Ref = UpdateSinglePotion(PlacedPotion12, PlacedPotion12Ref, PotionMarker12)

    PlacedPotion13Ref = UpdateSinglePotion(PlacedPotion13, PlacedPotion13Ref, PotionMarker13)

    PlacedPotion14Ref = UpdateSinglePotion(PlacedPotion14, PlacedPotion14Ref, PotionMarker14)

    PlacedPotion15Ref = UpdateSinglePotion(PlacedPotion15, PlacedPotion15Ref, PotionMarker15)

    PlacedPotion16Ref = UpdateSinglePotion(PlacedPotion16, PlacedPotion16Ref, PotionMarker16)

    PlacedPotion17Ref = UpdateSinglePotion(PlacedPotion17, PlacedPotion17Ref, PotionMarker17)

    PlacedPotion18Ref = UpdateSinglePotion(PlacedPotion18, PlacedPotion18Ref, PotionMarker18)

    PlacedPotion19Ref = UpdateSinglePotion(PlacedPotion19, PlacedPotion19Ref, PotionMarker19)

    PlacedPotion20Ref = UpdateSinglePotion(PlacedPotion20, PlacedPotion20Ref, PotionMarker20)

    PlacedPotion21Ref = UpdateSinglePotion(PlacedPotion21, PlacedPotion21Ref, PotionMarker21)

    PlacedPotion22Ref = UpdateSinglePotion(PlacedPotion22, PlacedPotion22Ref, PotionMarker22)

    PlacedPotion23Ref = UpdateSinglePotion(PlacedPotion23, PlacedPotion23Ref, PotionMarker23)

    PlacedPotion24Ref = UpdateSinglePotion(PlacedPotion24, PlacedPotion24Ref, PotionMarker24)

    PlacedPotion25Ref = UpdateSinglePotion(PlacedPotion25, PlacedPotion25Ref, PotionMarker25)

    PlacedPotion26Ref = UpdateSinglePotion(PlacedPotion26, PlacedPotion26Ref, PotionMarker26)

    PlacedPotion27Ref = UpdateSinglePotion(PlacedPotion27, PlacedPotion27Ref, PotionMarker27)

    PlacedPotion28Ref = UpdateSinglePotion(PlacedPotion28, PlacedPotion28Ref, PotionMarker28)

    PlacedPotion29Ref = UpdateSinglePotion(PlacedPotion29, PlacedPotion29Ref, PotionMarker29)

    PlacedPotion30Ref = UpdateSinglePotion(PlacedPotion30, PlacedPotion30Ref, PotionMarker30)

    PlacedPotion31Ref = UpdateSinglePotion(PlacedPotion31, PlacedPotion31Ref, PotionMarker31)

    PlacedPotion32Ref = UpdateSinglePotion(PlacedPotion32, PlacedPotion32Ref, PotionMarker32)

    PlacedPotion33Ref = UpdateSinglePotion(PlacedPotion33, PlacedPotion32Ref, PotionMarker33)

    PlacedPotion34Ref = UpdateSinglePotion(PlacedPotion34, PlacedPotion33Ref, PotionMarker34)

    PlacedPotion35Ref = UpdateSinglePotion(PlacedPotion35, PlacedPotion34Ref, PotionMarker35)

    PlacedPotion36Ref = UpdateSinglePotion(PlacedPotion36, PlacedPotion36Ref, PotionMarker36)

    PlacedPotion37Ref = UpdateSinglePotion(PlacedPotion37, PlacedPotion36Ref, PotionMarker37)

    PlacedPotion38Ref = UpdateSinglePotion(PlacedPotion38, PlacedPotion38Ref, PotionMarker38)

    PlacedPotion39Ref = UpdateSinglePotion(PlacedPotion39, PlacedPotion39Ref, PotionMarker39)

    PlacedPotion40Ref = UpdateSinglePotion(PlacedPotion40, PlacedPotion40Ref, PotionMarker40)

    PlacedPotion41Ref = UpdateSinglePotion(PlacedPotion41, PlacedPotion41Ref, PotionMarker41)

    PlacedPotion42Ref = UpdateSinglePotion(PlacedPotion42, PlacedPotion42Ref, PotionMarker42)

    PlacedPotion43Ref = UpdateSinglePotion(PlacedPotion43, PlacedPotion43Ref, PotionMarker43)

    PlacedPotion44Ref = UpdateSinglePotion(PlacedPotion44, PlacedPotion44Ref, PotionMarker44)

    PlacedPotion45Ref = UpdateSinglePotion(PlacedPotion45, PlacedPotion45Ref, PotionMarker45)

    PlacedPotion46Ref = UpdateSinglePotion(PlacedPotion46, PlacedPotion46Ref, PotionMarker46)

    PlacedPotion47Ref = UpdateSinglePotion(PlacedPotion47, PlacedPotion47Ref, PotionMarker47)

    PlacedPotion48Ref = UpdateSinglePotion(PlacedPotion48, PlacedPotion48Ref, PotionMarker48)

    PlacedPotion49Ref = UpdateSinglePotion(PlacedPotion49, PlacedPotion49Ref, PotionMarker49)

    PlacedPotion50Ref = UpdateSinglePotion(PlacedPotion50, PlacedPotion50Ref, PotionMarker50)

     

    UnBlockActivate() ; Allow the player to mess with them

    GoToState("") ; Now allow potions to be updated again

    EndFunction

     

     

    State PlacingPotions

    Function UpdatePotions()

    ; Already updating

    EndFunction

    EndState


    Very important Please press Ctrl+F to find ModN and replace it with your Mod Name or
    abbreviation of your mod name. They must all be the exact same. Example, if you
    replace ModN with the letters Jane then all instances of ModN must be replaced with 'Jane'.

    10. COMPILE your SCRIPT

     

    1. Click on gameplay

    2. click on Papyrus script manager

    3. search for “potionshelf'

    4. right click on each script and click on compile.

    If it is successful, it will say 'complete' then close the window by itself.

    If it fails, the window stays open and you have to click on the name and

    look at the errors.

     

    11. Place Your Items

     

    I. Placing the trigger first.


    A. Trigger 3. Orange container trigger that holds the potions.

    1. Click on the Object Window

    2. Click on *All

    Filter: Potionshelf
    You should see the potion container that you created in SETUP called: PotionShelfContainer15ModN
    *where ModN is your mod name or your name. ModN can only be ONE name consistant through out all of this tutorial.
    Drag it over to the render window and place it high and flush in front of the shelf.


    II. Placing potions.

    You will place your created dummy potions on the shelf. 5 potions per shelf.

    1. click on *ALL in the Object Window

    2. Filter DefaultPotionShelf

    3. Find DefaultPotionShelfPotionMarker.

    4. Drag and drop DefaultPotionShelfPotionMarker to the shelf 5 times.

    5. Line them up on the SAME shelf, in a row.

    6. Press 'ctrl' key and click on each dummy potion.

    7. Make sure all 5 are selected.

    8. Right click any of the dummy potions and select 'duplicate'.

    9. Press 'e' to bring up the move arrows and click on the arrow that will slide all 5 potions to the 2nd shelf.
      You should now have 10 potions.

    10. Repeat the duplicate process to put 5 more potions on the 3rd shelf.
      3 boards on this shelf is 5 potions per shelf = 15 potions.

    TIP* If they go over edge then delete them all. Place a new dummy potion but this time click on it, press '2' then resize it to make it smaller.

    Duplicate the resized bottle.
    They will be linkref'ed later.

    III. Connecting The Trigger.

    A. Linkref and change properties.

    1. Click on Trigger 1 inside render window. (PotionShelfContainer15ModN)

    2. Edit PotionShelfContainerModN.

    3. Click on the Linkreference tab.
      You will link ref a total of 15 times-. One linkref to each of the DefaultPotionRackPotionMarkers that are placed on the shelf.

    4. Right click white area, click 'new'

    5. Click 'select reference in render window'

    6. Select your first dummy potion and double click.

    7. Click on the keyword drop down menu and type PO to make it skip the PO section.
      If you don't see PotionShelfPot01 right away then press PageDown one time.

    8. Click on PotionShelfPot01 for your keyword.
      Do this in order from left to right so the top left corner is PotionShelfPot01 and lower right corner on 3rd shelf board is PotionShelfPot15.

    9. Repeat the above process and make sure there are 15 keywords, one for each orange dummy potion.

    10. Click on Script tab.

    11. Click on properties and auto fill all the variables. Ignore the item clutter

    12. Change MaxPotionsAllowed to 15.

    13. Close your orange trigger/press OK.

      It looks like this: (ignore playerpotionrackclick)

    B. Put each of the 5 collision markers around the shelf. 4 sides, 1 on top.

    C. Making other racks of different quantity.

    For any new quantity, just duplicate PotionShelfContainer15Modn.

    Rename your duplicate to the name the refers to the new quantity.

              Example: PotionShelfContainer5xWHCA

    This will hold from 1 to 5 potions, you decide!

     

    12. Test your potion rack in the cell you dropped it in.

    Thats it!


    * Remember that you can press 'm' to make invisible markers appear.
    When your potion rack is showing the invisible orange dummy potions, collision planes,
    and triggers; you can drag your mouse around all of them and right click on the shelf and
    select 'COPY'.

    You can then go anywhere you want to, in Skyrim, and PASTE the shelf. It only works in the active mod where you created the keywords, dummy potions, shelf, and triggers.

    Copying from one mod to another will not work.

    I have re done scripts to handle more than 15 potions. This is only one example.


    Enjoy!
    AshenFire

    : PotionShelfContainer50ModN

Remember to replace 'ModN' with name of your mod, or abbreviation of your mod!  This holds your potions.

 

 

Keyword PotionShelfContainer

 

In the Object Window:

  1. Click on Miscellaneous Branch.

  2. Click on Keyword Branch.

  3. Right click on Editor Id area and choose 'NEW'

  4. Color is purple. R=128 G=0 B=128

  5. Name the ID: PotionShelfContainer

  6. Press 'OK'

 


4. Keyword PotionShelfPotxx

In the Object Window:

 

  1. Click on Miscellaneous Branch.

  2. Click on Keyword Branch

  3. Right Click on Editor Id area and choose 'NEW'

  4. Color is lime green. R=116 G=186 B=69

  5. Name the ID: PotionShelfPot01

  6. Duplicate PotionShelfPot01 14 more times.

Rename the duplicates PotionShelfPot02, PotionShelfPot03...etc.  There will be PotionShelfPot01 through PotionShelfPot15 when finished.

*NOTE* If you want to hold up to 50 potions then continue making keywords so the range is PotionShelfP01 through PotionShelfPot50.

 

5. Keyword PotionShelfTrigger

In the Object Window:

 

  1. Click on Miscellaneous Branch.

  2. Click on Keyword Branch.

  3. Right Click on Editor Id area and choose 'NEW'

  4. Color is Black R.G.B are all zero.

  5. Name the ID: PotionShelfTrigger01

Repeat this 3 more times for a total of four.
PotionShelfTrigger01 through PotionShelfTrigger04

 

Shelf to put the potions on.

 

  1. Click on *All in the Object Window

  2. Search: MarketDisplayShelf03

  3. Copy 1 to your cell.

 

7: Messages for script.

 

Find the MESSAGE area

Object Window:

  1. Click on Miscellanous

  2. Click on Message

  3. Right Click on any message on the right and click on NEW.

You can now edit the message box.

A. Make your first message ID field, type: PotionShelfFirstActivateMessage

  1. In the Message Text box, type: Potions put here will be placed on the rack.

  2. Click OK

B. Now make another NEW message: ID: PotionShelfNoMoreRoomMessage

  1. TEXT: You can't place that many potions on this rack.

  2. Click OK

C. Make another NEW message:   ID: PotionShelfNotAPotionMessage

  1. TEXT: You can only place potions on this rack

  2. Click OK

D. Make another NEW message: ID: PotionShelfRoomLeftMessage

  1. Text: You can place % of more potions on this shelf.

  2. Click OK

 

8. GLOBAL TAR

 

  1. Click on Miscellaneous in the object window.

  2. Click on Global

  3. Right click on right side and click 'NEW'

  4. ID: PotionShelfGlobal

  5. Click OK

 

9. Script Creation

15 Potion Shelf Script.

 

  1. Click on 'GamePlay' at the top.

  2. Click on 'Papyrus Script Manager'

  3. Right click script name area and choose 'NEW'

  4. Name will be: PotionShelfContainerScript15+ModN(Modn is name of your mod)

  5. Extends : ObjectReference

  6. Press Enter

 

Script to paste (click on spoiler)

PASTE the following into your script editor.

Scriptname PotionShelfContainerScript50xWHCA extends ObjectReference

{Holds 1 to 50 potions}

 

import debug

import utility

 

Form Property LItemPotionClutter Auto

{Clutter item list to fill the shelf with}

 

Keyword Property PotionShelfPot01 Auto

Keyword Property PotionShelfPot02 Auto

Keyword Property PotionShelfPot03 Auto

Keyword Property PotionShelfPot04 Auto

Keyword Property PotionShelfPot05 Auto

Keyword Property PotionShelfPot06 Auto

Keyword Property PotionShelfPot07 Auto

Keyword Property PotionShelfPot08 Auto

Keyword Property PotionShelfPot09 Auto

Keyword Property PotionShelfPot10 Auto

Keyword Property PotionShelfPot11 Auto

Keyword Property PotionShelfPot12 Auto

Keyword Property PotionShelfPot13 Auto

Keyword Property PotionShelfPot14 Auto

Keyword Property PotionShelfPot15 Auto

Keyword Property PotionShelfPot16 Auto

Keyword Property PotionShelfPot17 Auto

Keyword Property PotionShelfPot18 Auto

Keyword Property PotionShelfPot19 Auto

Keyword Property PotionShelfPot20 Auto

Keyword Property PotionShelfPot21 Auto

Keyword Property PotionShelfPot22 Auto

Keyword Property PotionShelfPot23 Auto

Keyword Property PotionShelfPot24 Auto

Keyword Property PotionShelfPot25 Auto

Keyword Property PotionShelfPot26 Auto

Keyword Property PotionShelfPot27 Auto

Keyword Property PotionShelfPot28 Auto

Keyword Property PotionShelfPot29 Auto

Keyword Property PotionShelfPot30 Auto

Keyword Property PotionShelfPot31 Auto

Keyword Property PotionShelfPot32 Auto

Keyword Property PotionShelfPot33 Auto

Keyword Property PotionShelfPot34 Auto

Keyword Property PotionShelfPot35 Auto

Keyword Property PotionShelfPot36 Auto

Keyword Property PotionShelfPot37 Auto

Keyword Property PotionShelfPot38 Auto

Keyword Property PotionShelfPot39 Auto

Keyword Property PotionShelfPot40 Auto

Keyword Property PotionShelfPot41 Auto

Keyword Property PotionShelfPot42 Auto

Keyword Property PotionShelfPot43 Auto

Keyword Property PotionShelfPot44 Auto

Keyword Property PotionShelfPot45 Auto

Keyword Property PotionShelfPot46 Auto

Keyword Property PotionShelfPot47 Auto

Keyword Property PotionShelfPot48 Auto

Keyword Property PotionShelfPot49 Auto

Keyword Property PotionShelfPot50 Auto

Keyword Property PotionShelfTrigger01 Auto

Keyword Property PotionShelfTrigger02 Auto

Keyword Property PotionShelfTrigger03 Auto

Keyword Property PotionShelfTrigger04 Auto

 

{List of required Keywords}

ObjectReference Property PotionMarker01 Auto Hidden

ObjectReference Property PotionMarker02 Auto Hidden

ObjectReference Property PotionMarker03 Auto Hidden

ObjectReference Property PotionMarker04 Auto Hidden

ObjectReference Property PotionMarker05 Auto Hidden

ObjectReference Property PotionMarker06 Auto Hidden

ObjectReference Property PotionMarker07 Auto Hidden

ObjectReference Property PotionMarker08 Auto Hidden

ObjectReference Property PotionMarker09 Auto Hidden

ObjectReference Property PotionMarker10 Auto Hidden

ObjectReference Property PotionMarker11 Auto Hidden

ObjectReference Property PotionMarker12 Auto Hidden

ObjectReference Property PotionMarker13 Auto Hidden

ObjectReference Property PotionMarker14 Auto Hidden

ObjectReference Property PotionMarker15 Auto Hidden

ObjectReference Property PotionMarker16 Auto Hidden

ObjectReference Property PotionMarker17 Auto Hidden

ObjectReference Property PotionMarker18 Auto Hidden

ObjectReference Property PotionMarker19 Auto Hidden

ObjectReference Property PotionMarker20 Auto Hidden

ObjectReference Property PotionMarker21 Auto Hidden

ObjectReference Property PotionMarker22 Auto Hidden

ObjectReference Property PotionMarker23 Auto Hidden

ObjectReference Property PotionMarker24 Auto Hidden

ObjectReference Property PotionMarker25 Auto Hidden

ObjectReference Property PotionMarker26 Auto Hidden

ObjectReference Property PotionMarker27 Auto Hidden

ObjectReference Property PotionMarker28 Auto Hidden

ObjectReference Property PotionMarker29 Auto Hidden

ObjectReference Property PotionMarker30 Auto Hidden

ObjectReference Property PotionMarker31 Auto Hidden

ObjectReference Property PotionMarker32 Auto Hidden

ObjectReference Property PotionMarker33 Auto Hidden

ObjectReference Property PotionMarker34 Auto Hidden

ObjectReference Property PotionMarker35 Auto Hidden

ObjectReference Property PotionMarker36 Auto Hidden

ObjectReference Property PotionMarker37 Auto Hidden

ObjectReference Property PotionMarker38 Auto Hidden

ObjectReference Property PotionMarker39 Auto Hidden

ObjectReference Property PotionMarker40 Auto Hidden

ObjectReference Property PotionMarker41 Auto Hidden

ObjectReference Property PotionMarker42 Auto Hidden

ObjectReference Property PotionMarker43 Auto Hidden

ObjectReference Property PotionMarker44 Auto Hidden

ObjectReference Property PotionMarker45 Auto Hidden

ObjectReference Property PotionMarker46 Auto Hidden

ObjectReference Property PotionMarker47 Auto Hidden

ObjectReference Property PotionMarker48 Auto Hidden

ObjectReference Property PotionMarker49 Auto Hidden

ObjectReference Property PotionMarker50 Auto Hidden

ObjectReference Property potionshelfTrigger01Ref Auto Hidden

ObjectReference Property potionshelfTrigger02Ref Auto Hidden

ObjectReference Property potionshelfTrigger03Ref Auto Hidden

ObjectReference Property potionshelfTrigger04Ref Auto Hidden

 

Int Property MaxPotionsAllowed Auto Hidden

{Max Potions allowed on this partciular shelf}

 

Int Property CurrentPotionsAmount Auto Hidden

{The current amount of potions placed on the shelf}

 

Form Property EmptyForm Auto Hidden

{Null Form}

 

ObjectReference Property EmptyRef Auto Hidden

{Null Ref}

 

Form Property CurrentPotionsForm Auto Hidden

{Potion Form we are working with at any one time}

 

ObjectReference Property CurrentPotionsRef Auto Hidden

{Potion Ref we are working with at any one time}

 

Form Property PlacedPotion01 Auto Hidden

Form Property PlacedPotion02 Auto Hidden

Form Property PlacedPotion03 Auto Hidden

Form Property PlacedPotion04 Auto Hidden

Form Property PlacedPotion05 Auto Hidden

Form Property PlacedPotion06 Auto Hidden

Form Property PlacedPotion07 Auto Hidden

Form Property PlacedPotion08 Auto Hidden

Form Property PlacedPotion09 Auto Hidden

Form Property PlacedPotion10 Auto Hidden

Form Property PlacedPotion11 Auto Hidden

Form Property PlacedPotion12 Auto Hidden

Form Property PlacedPotion13 Auto Hidden

Form Property PlacedPotion14 Auto Hidden

Form Property PlacedPotion15 Auto Hidden

Form Property PlacedPotion16 Auto Hidden

Form Property PlacedPotion17 Auto Hidden

Form Property PlacedPotion18 Auto Hidden

Form Property PlacedPotion19 Auto Hidden

Form Property PlacedPotion20 Auto Hidden

Form Property PlacedPotion21 Auto Hidden

Form Property PlacedPotion22 Auto Hidden

Form Property PlacedPotion23 Auto Hidden

Form Property PlacedPotion24 Auto Hidden

Form Property PlacedPotion25 Auto Hidden

Form Property PlacedPotion26 Auto Hidden

Form Property PlacedPotion27 Auto Hidden

Form Property PlacedPotion28 Auto Hidden

Form Property PlacedPotion29 Auto Hidden

Form Property PlacedPotion30 Auto Hidden

Form Property PlacedPotion31 Auto Hidden

Form Property PlacedPotion32 Auto Hidden

Form Property PlacedPotion33 Auto Hidden

Form Property PlacedPotion34 Auto Hidden

Form Property PlacedPotion35 Auto Hidden

Form Property PlacedPotion36 Auto Hidden

Form Property PlacedPotion37 Auto Hidden

Form Property PlacedPotion38 Auto Hidden

Form Property PlacedPotion39 Auto Hidden

Form Property PlacedPotion40 Auto Hidden

Form Property PlacedPotion41 Auto Hidden

Form Property PlacedPotion42 Auto Hidden

Form Property PlacedPotion43 Auto Hidden

Form Property PlacedPotion44 Auto Hidden

Form Property PlacedPotion45 Auto Hidden

Form Property PlacedPotion46 Auto Hidden

Form Property PlacedPotion47 Auto Hidden

Form Property PlacedPotion48 Auto Hidden

Form Property PlacedPotion49 Auto Hidden

Form Property PlacedPotion50 Auto Hidden

 

{List of Placed Potions Forms}

 

ObjectReference Property PlacedPotion01Ref Auto Hidden

ObjectReference Property PlacedPotion02Ref Auto Hidden

ObjectReference Property PlacedPotion03Ref Auto Hidden

ObjectReference Property PlacedPotion04Ref Auto Hidden

ObjectReference Property PlacedPotion05Ref Auto Hidden

ObjectReference Property PlacedPotion06Ref Auto Hidden

ObjectReference Property PlacedPotion07Ref Auto Hidden

ObjectReference Property PlacedPotion08Ref Auto Hidden

ObjectReference Property PlacedPotion09Ref Auto Hidden

ObjectReference Property PlacedPotion10Ref Auto Hidden

ObjectReference Property PlacedPotion11Ref Auto Hidden

ObjectReference Property PlacedPotion12Ref Auto Hidden

ObjectReference Property PlacedPotion13Ref Auto Hidden

ObjectReference Property PlacedPotion14Ref Auto Hidden

ObjectReference Property PlacedPotion15Ref Auto Hidden

ObjectReference Property PlacedPotion16Ref Auto Hidden

ObjectReference Property PlacedPotion17Ref Auto Hidden

ObjectReference Property PlacedPotion18Ref Auto Hidden

ObjectReference Property PlacedPotion19Ref Auto Hidden

ObjectReference Property PlacedPotion20Ref Auto Hidden

ObjectReference Property PlacedPotion21Ref Auto Hidden

ObjectReference Property PlacedPotion22Ref Auto Hidden

ObjectReference Property PlacedPotion23Ref Auto Hidden

ObjectReference Property PlacedPotion24Ref Auto Hidden

ObjectReference Property PlacedPotion25Ref Auto Hidden

ObjectReference Property PlacedPotion26Ref Auto Hidden

ObjectReference Property PlacedPotion27Ref Auto Hidden

ObjectReference Property PlacedPotion28Ref Auto Hidden

ObjectReference Property PlacedPotion29Ref Auto Hidden

ObjectReference Property PlacedPotion30Ref Auto Hidden

ObjectReference Property PlacedPotion31Ref Auto Hidden

ObjectReference Property PlacedPotion32Ref Auto Hidden

ObjectReference Property PlacedPotion33Ref Auto Hidden

ObjectReference Property PlacedPotion34Ref Auto Hidden

ObjectReference Property PlacedPotion35Ref Auto Hidden

ObjectReference Property PlacedPotion36Ref Auto Hidden

ObjectReference Property PlacedPotion37Ref Auto Hidden

ObjectReference Property PlacedPotion38Ref Auto Hidden

ObjectReference Property PlacedPotion39Ref Auto Hidden

ObjectReference Property PlacedPotion40Ref Auto Hidden

ObjectReference Property PlacedPotion41Ref Auto Hidden

ObjectReference Property PlacedPotion42Ref Auto Hidden

ObjectReference Property PlacedPotion43Ref Auto Hidden

ObjectReference Property PlacedPotion44Ref Auto Hidden

ObjectReference Property PlacedPotion45Ref Auto Hidden

ObjectReference Property PlacedPotion46Ref Auto Hidden

ObjectReference Property PlacedPotion47Ref Auto Hidden

ObjectReference Property PlacedPotion48Ref Auto Hidden

ObjectReference Property PlacedPotion49Ref Auto Hidden

ObjectReference Property PlacedPotion50Ref Auto Hidden

 

{List of Placed Potion Refs}

 

Bool Property AlreadyLoaded = FALSE Auto Hidden

{Whether this script has already went through it's OnCellLoad() Event}

 

Bool Property BlockPotions = FALSE Auto Hidden

{Used for when you can't place any more potions}

 

Message Property potionshelfFirstActivateMESSAGE Auto

{Display message when the player activates a potionshelf for the first time. Only displays once.}

 

Message Property potionshelfNoMoreRoomMESSAGE Auto

{Displayed message for when the amount of potions the player is placing excedes the shelf limit.}

 

Message Property potionshelfNotApotionMESSAGE Auto

{Message displayed when the player places a non potion form in the container.}

 

Message Property potionshelfRoomLeftMESSAGE Auto

{Notification that tells the player how much room is left on the shelf upon first activating it.}

 

GlobalVariable Property potionshelfGlobal Auto

{Global showing whether or not the player has ever activated a potionshelf}

 

 

EVENT OnCellLoad()

if AlreadyLoaded == FALSE

 

; Get all the potion markers

PotionMarker01 = GetLinkedRef(PotionShelfPot01)

PotionMarker02 = GetLinkedRef(PotionShelfPot02)

PotionMarker03 = GetLinkedRef(PotionShelfPot03)

PotionMarker04 = GetLinkedRef(PotionShelfPot04)

PotionMarker05 = GetLinkedRef(PotionShelfPot05)

PotionMarker06 = GetLinkedRef(PotionShelfPot06)

PotionMarker07 = GetLinkedRef(PotionShelfPot07)

PotionMarker08 = GetLinkedRef(PotionShelfPot08)

PotionMarker09 = GetLinkedRef(PotionShelfPot09)

PotionMarker10 = GetLinkedRef(PotionShelfPot10)

PotionMarker11 = GetLinkedRef(PotionShelfPot11)

PotionMarker12 = GetLinkedRef(PotionShelfPot12)

PotionMarker13 = GetLinkedRef(PotionShelfPot13)

PotionMarker14 = GetLinkedRef(PotionShelfPot14)

PotionMarker15 = GetLinkedRef(PotionShelfPot15)

PotionMarker16 = GetLinkedRef(PotionShelfPot16)

PotionMarker17 = GetLinkedRef(PotionShelfPot17)

PotionMarker18 = GetLinkedRef(PotionShelfPot18)

PotionMarker19 = GetLinkedRef(PotionShelfPot19)

PotionMarker20 = GetLinkedRef(PotionShelfPot20)

PotionMarker21 = GetLinkedRef(PotionShelfPot21)

PotionMarker22 = GetLinkedRef(PotionShelfPot22)

PotionMarker23 = GetLinkedRef(PotionShelfPot23)

PotionMarker24 = GetLinkedRef(PotionShelfPot24)

PotionMarker25 = GetLinkedRef(PotionShelfPot25)

PotionMarker26 = GetLinkedRef(PotionShelfPot26)

PotionMarker27 = GetLinkedRef(PotionShelfPot27)

PotionMarker28 = GetLinkedRef(PotionShelfPot28)

PotionMarker29 = GetLinkedRef(PotionShelfPot29)

PotionMarker30 = GetLinkedRef(PotionShelfPot30)

PotionMarker31 = GetLinkedRef(PotionShelfPot31)

PotionMarker32 = GetLinkedRef(PotionShelfPot32)

PotionMarker33 = GetLinkedRef(PotionShelfPot33)

PotionMarker34 = GetLinkedRef(PotionShelfPot34)

PotionMarker35 = GetLinkedRef(PotionShelfPot35)

PotionMarker36 = GetLinkedRef(PotionShelfPot36)

PotionMarker37 = GetLinkedRef(PotionShelfPot37)

PotionMarker38 = GetLinkedRef(PotionShelfPot38)

PotionMarker39 = GetLinkedRef(PotionShelfPot39)

PotionMarker40 = GetLinkedRef(PotionShelfPot40)

PotionMarker41 = GetLinkedRef(PotionShelfPot41)

PotionMarker42 = GetLinkedRef(PotionShelfPot42)

PotionMarker43 = GetLinkedRef(PotionShelfPot43)

PotionMarker44 = GetLinkedRef(PotionShelfPot44)

PotionMarker45 = GetLinkedRef(PotionShelfPot45)

PotionMarker46 = GetLinkedRef(PotionShelfPot46)

PotionMarker47 = GetLinkedRef(PotionShelfPot47)

PotionMarker48 = GetLinkedRef(PotionShelfPot48)

PotionMarker49 = GetLinkedRef(PotionShelfPot49)

PotionMarker50 = GetLinkedRef(PotionShelfPot50)

potionshelfTrigger01Ref = (GetLinkedRef(potionshelfTrigger01) as PotionShelfTriggerScriptWHCA)

potionshelfTrigger02Ref = (GetLinkedRef(potionshelfTrigger02) as PotionShelfTriggerScriptWHCA)

potionshelfTrigger03Ref = (GetLinkedRef(potionshelfTrigger03) as PotionShelfTriggerScriptWHCA)

potionshelfTrigger04Ref = (GetLinkedRef(potionshelfTrigger04) as PotionShelfTriggerScriptWHCA)

 

; Count how many can be placed on this shelf

CountMaxPotions()

 

AlreadyLoaded = TRUE

endif

endEVENT

 

EVENT OnActivate(ObjectReference akActionRef)

BlockActivate()

 

potionshelfRoomLeftMESSAGE.Show((MaxPotionsAllowed - CurrentPotionsAmount))

 

if (potionshelfGlobal.GetValue() == 0)

potionshelfFirstActivateMESSAGE.Show()

potionshelfGlobal.SetValue(1)

endif

 

if potionshelfTrigger01Ref

potionshelfTrigger01Ref.GoToState("IgnorePotions")

endif

if potionshelfTrigger02Ref

potionshelfTrigger02Ref.GoToState("IgnorePotions")

endif

if potionshelfTrigger03Ref

potionshelfTrigger03Ref.GoToState("IgnorePotions")

endif

if potionshelfTrigger04Ref

potionshelfTrigger04Ref.GoToState("IgnorePotions")

endif

 

Wait(0.25)

; The following will fire when the player leaves inventory

 

UpdatePotions()

 

if potionshelfTrigger01Ref

potionshelfTrigger01Ref.GoToState("WaitForPotions")

endif

if potionshelfTrigger02Ref

potionshelfTrigger02Ref.GoToState("WaitForPotions")

endif

if potionshelfTrigger03Ref

potionshelfTrigger03Ref.GoToState("WaitForPotions")

endif

if potionshelfTrigger04Ref

potionshelfTrigger04Ref.GoToState("WaitForPotions")

endif

endEVENT

 

Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)

if (akBaseItem as Potion)

if BlockPotions == FALSE

; If the item is a potion find the corresponding potion reference and remove it.

RemovePotions(akBaseItem, aiItemCount)

CurrentPotionsAmount = CurrentPotionsAmount - aiItemCount

else

BlockPotions = FALSE

endif

endif

endEvent

 

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

 

if (akBaseItem as Potion)

; If the item being added is a potion then check to see if there is room in on the shelf.

 

if ((aiItemCount + CurrentPotionsAmount) <= MaxPotionsAllowed)

; There's room on the shelf, manage the potion placement

 

AddPotions(akBaseItem, aiItemCount)

CurrentPotionsAmount = CurrentPotionsAmount + aiItemCount

else

; There is no room on the shelf. Tell the player this and give the potion back.

utility.waitMenuMode(0)

;MessageBox("You can't place that many potions on this shelf")

potionshelfNoMoreRoomMESSAGE.Show()

BlockPotions = TRUE

self.RemoveItem(akBaseItem, aiItemCount, true, Game.GetPlayer())

 

endif

else

; The item placed in the container isn't a potion, so give the player back and tell her only potions are allowed.

 

self.RemoveItem(akBaseItem, aiItemCount, true, Game.GetPlayer())

utility.WaitMenuMode(0)

potionshelfNotApotionMESSAGE.Show()

endif

 

endEvent

 

Function BlockActivate()

if PlacedPotion01Ref

PlacedPotion01Ref.BlockActivation(TRUE)

endif

if PlacedPotion02Ref

PlacedPotion02Ref.BlockActivation(TRUE)

endif

if PlacedPotion03Ref

PlacedPotion03Ref.BlockActivation(TRUE)

endif

if PlacedPotion04Ref

PlacedPotion04Ref.BlockActivation(TRUE)

endif

if PlacedPotion05Ref

PlacedPotion05Ref.BlockActivation(TRUE)

endif

if PlacedPotion06Ref

PlacedPotion06Ref.BlockActivation(TRUE)

endif

if PlacedPotion07Ref

PlacedPotion07Ref.BlockActivation(TRUE)

endif

if PlacedPotion08Ref

PlacedPotion08Ref.BlockActivation(TRUE)

endif

if PlacedPotion09Ref

PlacedPotion09Ref.BlockActivation(TRUE)

endif

if PlacedPotion10Ref

PlacedPotion10Ref.BlockActivation(TRUE)

endif

endFunction

 

Function UnBlockActivate()

if PlacedPotion01Ref

PlacedPotion01Ref.BlockActivation(FALSE)

endif

if PlacedPotion02Ref

PlacedPotion02Ref.BlockActivation(FALSE)

endif

if PlacedPotion03Ref

PlacedPotion03Ref.BlockActivation(FALSE)

endif

if PlacedPotion04Ref

PlacedPotion04Ref.BlockActivation(FALSE)

endif

if PlacedPotion05Ref

PlacedPotion05Ref.BlockActivation(FALSE)

endif

if PlacedPotion06Ref

PlacedPotion06Ref.BlockActivation(FALSE)

endif

if PlacedPotion07Ref

PlacedPotion07Ref.BlockActivation(FALSE)

endif

if PlacedPotion08Ref

PlacedPotion08Ref.BlockActivation(FALSE)

endif

if PlacedPotion09Ref

PlacedPotion09Ref.BlockActivation(FALSE)

endif

if PlacedPotion10Ref

PlacedPotion10Ref.BlockActivation(FALSE)

endif

if PlacedPotion11Ref

PlacedPotion11Ref.BlockActivation(FALSE)

endif

if PlacedPotion12Ref

PlacedPotion12Ref.BlockActivation(FALSE)

endif

if PlacedPotion13Ref

PlacedPotion13Ref.BlockActivation(FALSE)

endif

if PlacedPotion14Ref

PlacedPotion14Ref.BlockActivation(FALSE)

endif

if PlacedPotion15Ref

PlacedPotion15Ref.BlockActivation(FALSE)

endif

endFunction

 

Function RemovePotions(Form PotionBase, Int PotsAmount)

; Find an empty potion form and place the new potion there

While PotsAmount > 0

if PlacedPotion01 == PotionBase

PlacedPotion01 = EmptyForm

elseif PlacedPotion02 == PotionBase

PlacedPotion02 = EmptyForm

elseif PlacedPotion03 == PotionBase

PlacedPotion03 = EmptyForm

elseif PlacedPotion04 == PotionBase

PlacedPotion04 = EmptyForm

elseif PlacedPotion05 == PotionBase

PlacedPotion05 = EmptyForm

elseif PlacedPotion06 == PotionBase

PlacedPotion06 = EmptyForm

elseif PlacedPotion07 == PotionBase

PlacedPotion07 = EmptyForm

elseif PlacedPotion08 == PotionBase

PlacedPotion08 = EmptyForm

elseif PlacedPotion09 == PotionBase

PlacedPotion09 = EmptyForm

elseif PlacedPotion10 == PotionBase

PlacedPotion10 = EmptyForm

elseif PlacedPotion11 == PotionBase

PlacedPotion11 = EmptyForm

elseif PlacedPotion12 == PotionBase

PlacedPotion12 = EmptyForm

elseif PlacedPotion13 == PotionBase

PlacedPotion13 = EmptyForm

elseif PlacedPotion14 == PotionBase

PlacedPotion14 = EmptyForm

elseif PlacedPotion15 == PotionBase

PlacedPotion15 = EmptyForm

elseif PlacedPotion16 == PotionBase

PlacedPotion16 = EmptyForm

elseif PlacedPotion17 == PotionBase

PlacedPotion17 = EmptyForm

elseif PlacedPotion18 == PotionBase

PlacedPotion18 = EmptyForm

elseif PlacedPotion19 == PotionBase

PlacedPotion19 = EmptyForm

elseif PlacedPotion20 == PotionBase

PlacedPotion20 = EmptyForm

elseif PlacedPotion21 == PotionBase

PlacedPotion21 = EmptyForm

elseif PlacedPotion22 == PotionBase

PlacedPotion22 = EmptyForm

elseif PlacedPotion23 == PotionBase

PlacedPotion23 = EmptyForm

elseif PlacedPotion24 == PotionBase

PlacedPotion24 = EmptyForm

elseif PlacedPotion25 == PotionBase

PlacedPotion25= EmptyForm

elseif PlacedPotion26 == PotionBase

PlacedPotion26 = EmptyForm

elseif PlacedPotion27 == PotionBase

PlacedPotion27 = EmptyForm

elseif PlacedPotion28 == PotionBase

PlacedPotion28 = EmptyForm

elseif PlacedPotion29 == PotionBase

PlacedPotion29 = EmptyForm

elseif PlacedPotion30 == PotionBase

PlacedPotion30 = EmptyForm

elseif PlacedPotion31 == PotionBase

PlacedPotion31 = EmptyForm

elseif PlacedPotion32 == PotionBase

PlacedPotion32 = EmptyForm

elseif PlacedPotion33 == PotionBase

PlacedPotion33 = EmptyForm

elseif PlacedPotion34 == PotionBase

PlacedPotion34 = EmptyForm

elseif PlacedPotion35 == PotionBase

PlacedPotion35 = EmptyForm

elseif PlacedPotion36 == PotionBase

PlacedPotion36 = EmptyForm

elseif PlacedPotion37 == PotionBase

PlacedPotion37 = EmptyForm

elseif PlacedPotion38 == PotionBase

PlacedPotion38 = EmptyForm

elseif PlacedPotion39 == PotionBase

PlacedPotion39 = EmptyForm

elseif PlacedPotion40 == PotionBase

PlacedPotion40 = EmptyForm

elseif PlacedPotion41 == PotionBase

PlacedPotion41 = EmptyForm

elseif PlacedPotion42 == PotionBase

PlacedPotion42 = EmptyForm

elseif PlacedPotion43 == PotionBase

PlacedPotion43 = EmptyForm

elseif PlacedPotion44 == PotionBase

PlacedPotion44 = EmptyForm

elseif PlacedPotion45 == PotionBase

PlacedPotion45 = EmptyForm

elseif PlacedPotion46 == PotionBase

PlacedPotion46 = EmptyForm

elseif PlacedPotion47 == PotionBase

PlacedPotion47 = EmptyForm

elseif PlacedPotion48 == PotionBase

PlacedPotion48 = EmptyForm

elseif PlacedPotion49 == PotionBase

PlacedPotion49 = EmptyForm

elseif PlacedPotion50 == PotionBase

PlacedPotion50 = EmptyForm

endif

PotsAmount = PotsAmount - 1

endWhile

endFunction

 

Function AddPotions(Form PotionBase, Int PotionsSAmount)

; Find an empty potions form and place the new potion there

While PotionsSAmount > 0

if PlacedPotion01 == EmptyForm

PlacedPotion01 = PotionBase

elseif PlacedPotion02 == EmptyForm

PlacedPotion02 = PotionBase

elseif PlacedPotion03 == EmptyForm

PlacedPotion03 = PotionBase

elseif PlacedPotion04 == EmptyForm

PlacedPotion04 = PotionBase

elseif PlacedPotion05 == EmptyForm

PlacedPotion05 = PotionBase

elseif PlacedPotion06 == EmptyForm

PlacedPotion06 = PotionBase

elseif PlacedPotion07 == EmptyForm

PlacedPotion07 = PotionBase

elseif PlacedPotion08 == EmptyForm

PlacedPotion08 = PotionBase

elseif PlacedPotion09 == EmptyForm

PlacedPotion09 = PotionBase

elseif PlacedPotion10 == EmptyForm

PlacedPotion10 = PotionBase

elseif PlacedPotion11 == EmptyForm

PlacedPotion11 = PotionBase

elseif PlacedPotion12 == EmptyForm

PlacedPotion12 = PotionBase

elseif PlacedPotion13 == EmptyForm

PlacedPotion13 = PotionBase

elseif PlacedPotion14 == EmptyForm

PlacedPotion14 = PotionBase

elseif PlacedPotion15 == EmptyForm

PlacedPotion15 = PotionBase

elseif PlacedPotion16 == EmptyForm

PlacedPotion16 = PotionBase

elseif PlacedPotion17 == EmptyForm

PlacedPotion17 = PotionBase

elseif PlacedPotion18 == EmptyForm

PlacedPotion18 = PotionBase

elseif PlacedPotion19 == EmptyForm

PlacedPotion19 = PotionBase

elseif PlacedPotion20 == EmptyForm

PlacedPotion20= PotionBase

elseif PlacedPotion21 == EmptyForm

PlacedPotion21 = PotionBase

elseif PlacedPotion22== EmptyForm

PlacedPotion22= PotionBase

elseif PlacedPotion23 == EmptyForm

PlacedPotion23 = PotionBase

elseif PlacedPotion24 == EmptyForm

PlacedPotion24 = PotionBase

elseif PlacedPotion25 == EmptyForm

PlacedPotion25 = PotionBase

elseif PlacedPotion26 == EmptyForm

PlacedPotion26 = PotionBase

elseif PlacedPotion27 == EmptyForm

PlacedPotion27 = PotionBase

elseif PlacedPotion28 == EmptyForm

PlacedPotion28 = PotionBase

elseif PlacedPotion29 == EmptyForm

PlacedPotion29 = PotionBase

elseif PlacedPotion30 == EmptyForm

PlacedPotion30 = PotionBase

elseif PlacedPotion31 == EmptyForm

PlacedPotion31 = PotionBase

elseif PlacedPotion32 == EmptyForm

PlacedPotion32 = PotionBase

elseif PlacedPotion33 == EmptyForm

PlacedPotion33 = PotionBase

elseif PlacedPotion34 == EmptyForm

PlacedPotion34 = PotionBase

elseif PlacedPotion35 == EmptyForm

PlacedPotion35 = PotionBase

elseif PlacedPotion36 == EmptyForm

PlacedPotion36 = PotionBase

elseif PlacedPotion37 == EmptyForm

PlacedPotion37 = PotionBase

elseif PlacedPotion38 == EmptyForm

PlacedPotion38 = PotionBase

elseif PlacedPotion39 == EmptyForm

PlacedPotion40 = PotionBase

elseif PlacedPotion40 == EmptyForm

PlacedPotion40 = PotionBase

elseif PlacedPotion41 == EmptyForm

PlacedPotion41 = PotionBase

elseif PlacedPotion42 == EmptyForm

PlacedPotion42 = PotionBase

elseif PlacedPotion43 == EmptyForm

PlacedPotion43 = PotionBase

elseif PlacedPotion44 == EmptyForm

PlacedPotion44 = PotionBase

elseif PlacedPotion45 == EmptyForm

PlacedPotion45 = PotionBase

elseif PlacedPotion46 == EmptyForm

PlacedPotion46 = PotionBase

elseif PlacedPotion47 == EmptyForm

PlacedPotion47 = PotionBase

elseif PlacedPotion48 == EmptyForm

PlacedPotion48 = PotionBase

elseif PlacedPotion49 == EmptyForm

PlacedPotion49 = PotionBase

elseif PlacedPotion50 == EmptyForm

PlacedPotion50 = PotionBase

EndIF

PotionsSAmount = PotionsSAmount - 1

endWhile

endFunction

 

Function CountMaxPotions()

; Checks how many potions can be placed on this shelf

if PotionMarker01 == EmptyRef

MaxPotionsAllowed = 0

;else

; MaxpotionsAllowed=50

endif

 

endFunction

 

 

ObjectReference Function UpdateSinglePotion(Form TargetPotion, ObjectReference PlacedPotionRef, ObjectReference PotionMarker)

ObjectReference retVal ; We return the potion we placed (or None)

; Note - it would be more efficient to move the potion to its home position if the desired

; potion matches the placed potion, but MoveTo doesn't work correctly with multi-part dynamic

; objects. So we sidestep the issue by always deleting and placing

if PlacedPotionRef

PlacedPotionRef.Disable()

PlacedPotionRef.Delete()

endIf

if TargetPotion

retVal = PotionMarker.PlaceAtMe(TargetPotion)

retVal.BlockActivation()

endIf

return retVal

EndFunction

Function UpdatePotions()

GoToState("PlacingPotions") ; Future calls should not mess with this stuff

PlacedPotion01Ref = UpdateSinglePotion(PlacedPotion01, PlacedPotion01Ref, PotionMarker01)

PlacedPotion02Ref = UpdateSinglePotion(PlacedPotion02, PlacedPotion02Ref, PotionMarker02)

PlacedPotion03Ref = UpdateSinglePotion(PlacedPotion03, PlacedPotion03Ref, PotionMarker03)

PlacedPotion04Ref = UpdateSinglePotion(PlacedPotion04, PlacedPotion04Ref, PotionMarker04)

PlacedPotion05Ref = UpdateSinglePotion(PlacedPotion05, PlacedPotion05Ref, PotionMarker05)

PlacedPotion06Ref = UpdateSinglePotion(PlacedPotion06, PlacedPotion06Ref, PotionMarker06)

PlacedPotion07Ref = UpdateSinglePotion(PlacedPotion07, PlacedPotion07Ref, PotionMarker07)

PlacedPotion08Ref = UpdateSinglePotion(PlacedPotion08, PlacedPotion08Ref, PotionMarker08)

PlacedPotion09Ref = UpdateSinglePotion(PlacedPotion09, PlacedPotion09Ref, PotionMarker09)

PlacedPotion10Ref = UpdateSinglePotion(PlacedPotion10, PlacedPotion10Ref, PotionMarker10)

PlacedPotion11Ref = UpdateSinglePotion(PlacedPotion11, PlacedPotion11Ref, PotionMarker11)

PlacedPotion12Ref = UpdateSinglePotion(PlacedPotion12, PlacedPotion12Ref, PotionMarker12)

PlacedPotion13Ref = UpdateSinglePotion(PlacedPotion13, PlacedPotion13Ref, PotionMarker13)

PlacedPotion14Ref = UpdateSinglePotion(PlacedPotion14, PlacedPotion14Ref, PotionMarker14)

PlacedPotion15Ref = UpdateSinglePotion(PlacedPotion15, PlacedPotion15Ref, PotionMarker15)

PlacedPotion16Ref = UpdateSinglePotion(PlacedPotion16, PlacedPotion16Ref, PotionMarker16)

PlacedPotion17Ref = UpdateSinglePotion(PlacedPotion17, PlacedPotion17Ref, PotionMarker17)

PlacedPotion18Ref = UpdateSinglePotion(PlacedPotion18, PlacedPotion18Ref, PotionMarker18)

PlacedPotion19Ref = UpdateSinglePotion(PlacedPotion19, PlacedPotion19Ref, PotionMarker19)

PlacedPotion20Ref = UpdateSinglePotion(PlacedPotion20, PlacedPotion20Ref, PotionMarker20)

PlacedPotion21Ref = UpdateSinglePotion(PlacedPotion21, PlacedPotion21Ref, PotionMarker21)

PlacedPotion22Ref = UpdateSinglePotion(PlacedPotion22, PlacedPotion22Ref, PotionMarker22)

PlacedPotion23Ref = UpdateSinglePotion(PlacedPotion23, PlacedPotion23Ref, PotionMarker23)

PlacedPotion24Ref = UpdateSinglePotion(PlacedPotion24, PlacedPotion24Ref, PotionMarker24)

PlacedPotion25Ref = UpdateSinglePotion(PlacedPotion25, PlacedPotion25Ref, PotionMarker25)

PlacedPotion26Ref = UpdateSinglePotion(PlacedPotion26, PlacedPotion26Ref, PotionMarker26)

PlacedPotion27Ref = UpdateSinglePotion(PlacedPotion27, PlacedPotion27Ref, PotionMarker27)

PlacedPotion28Ref = UpdateSinglePotion(PlacedPotion28, PlacedPotion28Ref, PotionMarker28)

PlacedPotion29Ref = UpdateSinglePotion(PlacedPotion29, PlacedPotion29Ref, PotionMarker29)

PlacedPotion30Ref = UpdateSinglePotion(PlacedPotion30, PlacedPotion30Ref, PotionMarker30)

PlacedPotion31Ref = UpdateSinglePotion(PlacedPotion31, PlacedPotion31Ref, PotionMarker31)

PlacedPotion32Ref = UpdateSinglePotion(PlacedPotion32, PlacedPotion32Ref, PotionMarker32)

PlacedPotion33Ref = UpdateSinglePotion(PlacedPotion33, PlacedPotion32Ref, PotionMarker33)

PlacedPotion34Ref = UpdateSinglePotion(PlacedPotion34, PlacedPotion33Ref, PotionMarker34)

PlacedPotion35Ref = UpdateSinglePotion(PlacedPotion35, PlacedPotion34Ref, PotionMarker35)

PlacedPotion36Ref = UpdateSinglePotion(PlacedPotion36, PlacedPotion36Ref, PotionMarker36)

PlacedPotion37Ref = UpdateSinglePotion(PlacedPotion37, PlacedPotion36Ref, PotionMarker37)

PlacedPotion38Ref = UpdateSinglePotion(PlacedPotion38, PlacedPotion38Ref, PotionMarker38)

PlacedPotion39Ref = UpdateSinglePotion(PlacedPotion39, PlacedPotion39Ref, PotionMarker39)

PlacedPotion40Ref = UpdateSinglePotion(PlacedPotion40, PlacedPotion40Ref, PotionMarker40)

PlacedPotion41Ref = UpdateSinglePotion(PlacedPotion41, PlacedPotion41Ref, PotionMarker41)

PlacedPotion42Ref = UpdateSinglePotion(PlacedPotion42, PlacedPotion42Ref, PotionMarker42)

PlacedPotion43Ref = UpdateSinglePotion(PlacedPotion43, PlacedPotion43Ref, PotionMarker43)

PlacedPotion44Ref = UpdateSinglePotion(PlacedPotion44, PlacedPotion44Ref, PotionMarker44)

PlacedPotion45Ref = UpdateSinglePotion(PlacedPotion45, PlacedPotion45Ref, PotionMarker45)

PlacedPotion46Ref = UpdateSinglePotion(PlacedPotion46, PlacedPotion46Ref, PotionMarker46)

PlacedPotion47Ref = UpdateSinglePotion(PlacedPotion47, PlacedPotion47Ref, PotionMarker47)

PlacedPotion48Ref = UpdateSinglePotion(PlacedPotion48, PlacedPotion48Ref, PotionMarker48)

PlacedPotion49Ref = UpdateSinglePotion(PlacedPotion49, PlacedPotion49Ref, PotionMarker49)

PlacedPotion50Ref = UpdateSinglePotion(PlacedPotion50, PlacedPotion50Ref, PotionMarker50)

 

UnBlockActivate() ; Allow the player to mess with them

GoToState("") ; Now allow potions to be updated again

EndFunction

 

 

State PlacingPotions

Function UpdatePotions()

; Already updating

EndFunction

EndState


Very important Please press Ctrl+F to find ModN and replace it with your Mod Name or
abbreviation of your mod name. They must all be the exact same. Example, if you
replace ModN with the letters Jane then all instances of ModN must be replaced with 'Jane'.

10. COMPILE your SCRIPT

 

  1. Click on gameplay

  2. click on Papyrus script manager

  3. search for “potionshelf'

  4. right click on each script and click on compile.

If it is successful, it will say 'complete' then close the window by itself.

If it fails, the window stays open and you have to click on the name and

look at the errors.

 

11. Place Your Items

 

I. Placing the trigger first.


A. Trigger 3. Orange container trigger that holds the potions.

  1. Click on the Object Window

  2. Click on *All

Filter: Potionshelf
You should see the potion container that you created in SETUP called: PotionShelfContainer15ModN
*where ModN is your mod name or your name. ModN can only be ONE name consistant through out all of this tutorial.
Drag it over to the render window and place it high and flush in front of the shelf.


II. Placing potions.

You will place your created dummy potions on the shelf. 5 potions per shelf.

  1. click on *ALL in the Object Window

  2. Filter DefaultPotionShelf

  3. Find DefaultPotionShelfPotionMarker.

  4. Drag and drop DefaultPotionShelfPotionMarker to the shelf 5 times.

  5. Line them up on the SAME shelf, in a row.

  6. Press 'ctrl' key and click on each dummy potion.

  7. Make sure all 5 are selected.

  8. Right click any of the dummy potions and select 'duplicate'.

  9. Press 'e' to bring up the move arrows and click on the arrow that will slide all 5 potions to the 2nd shelf.
    You should now have 10 potions.

  10. Repeat the duplicate process to put 5 more potions on the 3rd shelf.
    3 boards on this shelf is 5 potions per shelf = 15 potions.

TIP* If they go over edge then delete them all. Place a new dummy potion but this time click on it, press '2' then resize it to make it smaller.

Duplicate the resized bottle.
They will be linkref'ed later.

III. Connecting The Trigger.

A. Linkref and change properties.

  1. Click on Trigger 1 inside render window. (PotionShelfContainer15ModN)

  2. Edit PotionShelfContainerModN.

  3. Click on the Linkreference tab.
    You will link ref a total of 15 times-. One linkref to each of the DefaultPotionRackPotionMarkers that are placed on the shelf.

  4. Right click white area, click 'new'

  5. Click 'select reference in render window'

  6. Select your first dummy potion and double click.

  7. Click on the keyword drop down menu and type PO to make it skip the PO section.
    If you don't see PotionShelfPot01 right away then press PageDown one time.

  8. Click on PotionShelfPot01 for your keyword.
    Do this in order from left to right so the top left corner is PotionShelfPot01 and lower right corner on 3rd shelf board is PotionShelfPot15.

  9. Repeat the above process and make sure there are 15 keywords, one for each orange dummy potion.

  10. Click on Script tab.

  11. Click on properties and auto fill all the variables. Ignore the item clutter

  12. Change MaxPotionsAllowed to 15.

  13. Close your orange trigger/press OK.

    It looks like this: (ignore playerpotionrackclick)

B. Put each of the 5 collision markers around the shelf. 4 sides, 1 on top.

C. Making other racks of different quantity.

For any new quantity, just duplicate PotionShelfContainer15Modn.

Rename your duplicate to the name the refers to the new quantity.

          Example: PotionShelfContainer5xWHCA

This will hold from 1 to 5 potions, you decide!

 

12. Test your potion rack in the cell you dropped it in.

Thats it!


* Remember that you can press 'm' to make invisible markers appear.
When your potion rack is showing the invisible orange dummy potions, collision planes,
and triggers; you can drag your mouse around all of them and right click on the shelf and
select 'COPY'.

You can then go anywhere you want to, in Skyrim, and PASTE the shelf. It only works in the active mod where you created the keywords, dummy potions, shelf, and triggers.

Copying from one mod to another will not work.

I have re done scripts to handle more than 15 potions. This is only one example.


Enjoy!
AshenFire


1