Jump to content

Potion Racks


SDLMMclovin

Recommended Posts

Hi Roachy1, no you definately do need to use DefaultPotionRackPotionMarker! and this object also already exists..be carefult not to use the DefaultPotion object (it is quite different).

 

I'm not sure how the person in the above post used bookmarkers, perhaps they customised the script.

 

I have found that the potion markers are huge! For example in my noble shelf, you can only fit 3 length ways, THe potion marker allows for the biggest potion size, so if you place one of the small potions, or something like a bottle of skooma, there are huge gaps on your shelf in-game.

 

My solution to this has been to shrink the markers by scale down to something like 0.7, and then place them in two rows on the shelf (fitting 5 on the narrow noble shelf). I placed them staggered, so there are 3 bottles up front, and then 2 inbetween the gaps at the back. kinda like how ten pin bowling pins are arranged

 

back row:....4.....5.....

front row:.1.....3.....2.

 

The numbers denote the actual marker number keywords I assigned to those spots. So for example if I want to place some large bottles on there it will first place them in the front row on the far ends. Then I can select a smaller bottle to place, it will go in spot 3, then if there is still room, I can place 2 more in the back row...you get my drift. So it requires a little bit of thought on the players part in-game to judge if they will fit and in what order they place the bottles. If they don't fit, all that happens is that they bang into each other and fall over, but they wont fall out due to my collision planes. Once you get it working yourself you will see what I mean when you experiment.

Edited by windaddict
Link to comment
Share on other sites

I'm also working on this for a while. I downloaded the potion rack mod and it indeed uses modified bookshelf scripts. By default, it allows to put every kind of potion on the shelf, including food that wouldn't fit very well. So I made some alterations to the container script checking for the keywords VendorItemPotion and VendorItemPoison. Unfortunately, not all potions and poisons have these keywords, so I made a formlist PotionRackAddPotionsList to add the potions without keyword.

 

Then I thought I could extend this idea and added 3 more formlists:

 

PotionRackIngredientsList : Ingredients that fit on the shelf, like frost salts, vampire dust, etc.

PotionRackFoodList: Food that fits on the shelf (cooked meals, ale, mead, etc.)

PotionRackClutterList: Clutter to place on the rack (goblets and so on...)

 

With the property RackType one can define, which type of items are allowed to be added to the rack. For example: If RackType is set to 1, the player can put potions, poisons and the ingredients in the formlist on the rack. The script now looks like this:

 

 

Properties:

 

int Property RackType=0 auto
{Defines the types of placeable objects:
0 = Potions and Poisons (default)
1 = Potions, Poisons and selected ingredients
2 = Potions, Poisons, selected ingredients and food
3 = Potions, Poisons, selected ingredients, food and clutter}

Formlist Property PotionRackAddPotionsList Auto
Formlist Property PotionRackIngredientsList Auto
Formlist Property PotionRackFoodList Auto
Formlist Property PotionRackClutterList Auto
{Item lists to fill the rack with}

Keyword Property VendorItemPotion Auto
Keyword Property VendorItemPoison Auto

 

 

 

OnItemAdded() and OnItemRemoved() events:

 

Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)
if RackType == 0	
	if (akBaseItem.HasKeyword(VendorItemPotion)) ||  (akBaseItem.HasKeyword(VendorItemPoison)) || (PotionRackAddPotionsList.HasForm(akBaseItem))
		if BlockPotions == FALSE
			RemovePotions(akBaseItem, aiItemCount)
			CurrentPotionAmount = CurrentPotionAmount - aiItemCount
		else
			BlockPotions = FALSE
		endif
	endif
endif
if RackType == 1	
	if (akBaseItem.HasKeyword(VendorItemPotion)) ||  (akBaseItem.HasKeyword(VendorItemPoison)) || (PotionRackAddPotionsList.HasForm(akBaseItem)) || (PotionRackIngredientsList.HasForm(akBaseItem))
		if BlockPotions == FALSE
			RemovePotions(akBaseItem, aiItemCount)
			CurrentPotionAmount = CurrentPotionAmount - aiItemCount
		else
			BlockPotions = FALSE
		endif
	endif
endif
if RackType == 2	
	if (akBaseItem.HasKeyword(VendorItemPotion)) ||  (akBaseItem.HasKeyword(VendorItemPoison)) || (PotionRackAddPotionsList.HasForm(akBaseItem)) || (PotionRackIngredientsList.HasForm(akBaseItem)) || (PotionRackFoodList.HasForm(akBaseItem))
		if BlockPotions == FALSE				
			RemovePotions(akBaseItem, aiItemCount)
			CurrentPotionAmount = CurrentPotionAmount - aiItemCount
		else
			BlockPotions = FALSE
		endif
	endif
endif
if RackType == 3	
	if (akBaseItem.HasKeyword(VendorItemPotion)) ||  (akBaseItem.HasKeyword(VendorItemPoison)) || (PotionRackAddPotionsList.HasForm(akBaseItem)) || (PotionRackIngredientsList.HasForm(akBaseItem)) || (PotionRackFoodList.HasForm(akBaseItem)) || (PotionRackClutterList.HasForm(akBaseItem))
		if BlockPotions == FALSE
			RemovePotions(akBaseItem, aiItemCount)
			CurrentPotionAmount = CurrentPotionAmount - aiItemCount
		else
			BlockPotions = FALSE
		endif
	endif
endif
endEvent


Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
if RackType == 0
	if (akBaseItem.HasKeyword(VendorItemPotion)) ||  (akBaseItem.HasKeyword(VendorItemPoison)) || (PotionRackAddPotionsList.HasForm(akBaseItem))
		if ((aiItemCount + CurrentPotionAmount) <= MaxPotionsAllowed)				
			AddPotions(akBaseItem, aiItemCount)				
			CurrentPotionAmount = CurrentPotionAmount + aiItemCount
		else				
			utility.waitMenuMode(0)
			PotionRackNoMoreRoomMESSAGE.Show()				
			BlockPotions = TRUE
			self.RemoveItem(akBaseItem, aiItemCount, true, Game.GetPlayer())
		endif
	else			
		self.RemoveItem(akBaseItem, aiItemCount, true, Game.GetPlayer())
		utility.WaitMenuMode(0)
		PotionRackNotAPotionMESSAGE.Show()
	endif
endif
if RackType == 1
	if (akBaseItem.HasKeyword(VendorItemPotion)) ||  (akBaseItem.HasKeyword(VendorItemPoison)) || (PotionRackAddPotionsList.HasForm(akBaseItem)) || (PotionRackIngredientsList.HasForm(akBaseItem))
		if ((aiItemCount + CurrentPotionAmount) <= MaxPotionsAllowed)				
			AddPotions(akBaseItem, aiItemCount)				
			CurrentPotionAmount = CurrentPotionAmount + aiItemCount
		else				
			utility.waitMenuMode(0)				
			PotionRackNoMoreRoomMESSAGE.Show()				
			BlockPotions = TRUE
			self.RemoveItem(akBaseItem, aiItemCount, true, Game.GetPlayer())				
		endif
	else			
		self.RemoveItem(akBaseItem, aiItemCount, true, Game.GetPlayer())			
		utility.WaitMenuMode(0)			
		PotionRackNotAPotionMESSAGE.Show()			
	endif
endif
if RackType == 2
	if (akBaseItem.HasKeyword(VendorItemPotion)) ||  (akBaseItem.HasKeyword(VendorItemPoison)) || (PotionRackAddPotionsList.HasForm(akBaseItem)) || (PotionRackIngredientsList.HasForm(akBaseItem)) || (PotionRackFoodList.HasForm(akBaseItem))		
		if ((aiItemCount + CurrentPotionAmount) <= MaxPotionsAllowed)				
			AddPotions(akBaseItem, aiItemCount)				
			CurrentPotionAmount = CurrentPotionAmount + aiItemCount
		else				
			utility.waitMenuMode(0)				
			PotionRackNoMoreRoomMESSAGE.Show()				
			BlockPotions = TRUE
			self.RemoveItem(akBaseItem, aiItemCount, true, Game.GetPlayer())				
		endif
	else			
		self.RemoveItem(akBaseItem, aiItemCount, true, Game.GetPlayer())			
		utility.WaitMenuMode(0)			
		PotionRackNotAPotionMESSAGE.Show()			
	endif
endif	
if RackType == 3
	if (akBaseItem.HasKeyword(VendorItemPotion)) ||  (akBaseItem.HasKeyword(VendorItemPoison)) || (PotionRackAddPotionsList.HasForm(akBaseItem)) || (PotionRackIngredientsList.HasForm(akBaseItem)) || (PotionRackFoodList.HasForm(akBaseItem)) || (PotionRackClutterList.HasForm(akBaseItem))		
		if ((aiItemCount + CurrentPotionAmount) <= MaxPotionsAllowed)				
			AddPotions(akBaseItem, aiItemCount)				
			CurrentPotionAmount = CurrentPotionAmount + aiItemCount
		else				
			utility.waitMenuMode(0)				
			PotionRackNoMoreRoomMESSAGE.Show()				
			BlockPotions = TRUE
			self.RemoveItem(akBaseItem, aiItemCount, true, Game.GetPlayer())				
		endif
	else
		self.RemoveItem(akBaseItem, aiItemCount, true, Game.GetPlayer())			
		utility.WaitMenuMode(0)			
		PotionRackNotAPotionMESSAGE.Show()			
	endif
endif			
endEvent

 

 

 

Potion rack (Rack type 2) for potions, ingredients and food:

 

 

 

 

Potion rack (Rack type 3), that also allows clutter to be placed:

 

 

 

 

 

Edited by Ghaunadaur
Link to comment
Share on other sites

@winaddict, Ah I see, I didn't realize that object already existed. Yeah when making my bookshelves, I decided I didn't like how journals acted with the DefaultBookShelfBookMarkers, so I made a bookshelf dedicated to journals that uses much smaller DefaultBookShelfBookMarkers, and stacks them flat, 16 to a stack.

 

@Ghaunadaur, that's awesome man. This is exactly what I've been looking for. I've wanted to extend the bookshelf idea to other things, but I'm not nearly good enough with Papyrus to try. It was really frustrating reading the footnotes on the official Bookshelf tutorial page saying stuff like "Just imagine you could make bookshelf for ANY object in the game lol", and then finding that basically no-one has implemented it yet! But that's a great start to be sure.

 

I'll have to try out both you guys' modifications when I get the chance. Thanks.

Edited by Guest
Link to comment
Share on other sites

Just wondering if anyone had continued to work on this idea and got the triggers/activators/scripts working to where the potions actually left inventory and went to the shelf?

 

Hi, sorry to drag up an old thread, but I thought I would chime in. I did the following and it has made working potion racks using the existing items that are in the creation kit.

 

Firstly delete the 3 existing potion rack scripts, they are just copies of old bookshelf scripts!

 

1) Make a copy of the 3 bookshelf scripts, which are the trigger, clicktrigger and container.

2) Name the scripts as follows:

 

PlayerBookShelfClickTriggerSCRIPT.psc

PlayerBookShelfContainerScript.psc

PlayerBookShelfTriggerSCRIPT.psc

 

Replace BookShelf with PotionRack in the file names, so PlayerBookShelfClickTriggerSCRIPT.psc becomes PlayerPotionRackClickTriggerSCRIPT.psc etc

 

3) Open the 3 new scripts in a text editor and replace all instances of the following (note it must be in the same case!)

 

BookShelf with PotionRack

Book with Potion

book with potion

BOOK with POTION

 

4) Edit the Container script and edit this line :

 

Int Property CurrentPotionAmount Auto Hidden

change it to

Int Property CurrentPotionAmount=0 Auto Hidden

 

I found the game does not initialise this variable, and it will say the rack is full.

 

Now the scripts are done.

 

5) Open Creation Kit and you will need to edit the three base objects

PlayerPotionRackClickTrigger

PlayerPotionRackContainer

PlayerPotionRackTrigger

 

Go to scripts on each one, select Edit Source and build then save the scripts to compile them, they should compile without error (might need to do them in a certain order IIRC)

 

6) Find this object: LItemBookClutter and duplicate it, rename the new one to LItemPotionClutter, edit this new object and remove all the current books inside it and add some potions (any will do) (I don't think you need this step, but for completeness)

 

7) You need to create the missing keywords, which are for the PotionRackPotionMarker01 to 18

PotionRackClickTrigger, PotionRackTrigger01 to 04, PotionRackContainer...Basically just duplicate all the bookshelf keywords and replace the words BookShelf with PotionRack etc

 

8) Edit the properties of the script for the PotionRackContainer base object and insert all the relevent keywords, do the same for PotionRackTrigger, and PotionRackClickTrigger.

 

9) Lastly, just make sure all the other settings are the same ie the primitive settings for each of the three PotionRack base objects.

 

Now make your potion rack the same as you would a book shelf and presto! It works. I have it working in a mod I am working on at the moment.

 

I might eventually do a youtube tutorial on the above to show it all, but no time at the moment. But I thought I would share this info as I have searched long and hard for this info!

 

One thing is I have not tested it to see if it stores player created potions etc, but it stores built-in potions no problems.

 

 

Thanks! Worked perfectly.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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