Jump to content

[Papyrus] Potion System Functions are not working


sumojellybean

Recommended Posts

Hello guys! I’m have trouble with this script I'm trying to adapt from one of the vanilla fetch quests.

 

In this script, you can put ingredients into an actorIngredientSatchel and with EventOnUpdate, it will update the ingredient count. Through dialogue, you can create specific potions, IF you have enough ingredients. If you don't, my follower will tell you.

 

Thing is, in game, these globalvariables are not properly updating and the ingredients inside the satchel are not being removed.

 

My brain is fried at the moment (got 4 hours of sleep) but can someone tell me what is wrong with my script or how to improve on it?

 

 

 

Here is Bestheda's script, which I based mine off from. It was from the quest where you needed to collect 10 bear pelts and at on a quest stage, EndSwap() would happen.

 

 

 

 

Function PeltsCounted()
float CurrentCount = Game.GetPlayer().GetItemCount(pFFI03FormList)
pFFI03BearCount.Value = CurrentCount
UpdateCurrentInstanceGlobal(pFFI03BearCount)
if CurrentCount >= 10
pFFI03Quest.SetObjectiveCompleted(10,1)
pFFI03Quest.SetObjectiveDisplayed(20,true,true)
elseif CurrentCount < 10
pFFI03Quest.SetObjectiveCompleted(10,0)
pFFI03Quest.SetObjectiveDisplayed(20,0)
pFFI03Quest.SetObjectiveDisplayed(10,true,true)
endif
endFunction
Function EndSwap()
int ListSize = pFFI03FormList.GetSize()
int CurrentPelts = 0
int PeltsLeft = 10
while CurrentPelts < ListSize && PeltsLeft > 0
Form CurrentItem = pFFI03FormList.GetAt(CurrentPelts)
int PeltCount = Game.GetPlayer().GetItemCount(CurrentItem)
if PeltCount >= PeltsLeft
PeltsLeft = 0
else
PeltsLeft -= PeltCount
endif
Game.GetPlayer().RemoveItem(CurrentItem,PeltCount)
CurrentPelts += 1
endwhile
Game.GetPlayer().AddItem(pFFI03Axe,1)
endFunction

 

 

 

And here is my adapted script. IngredientsSwap() happens via dialogue.

 

 

 

 

Function IngredientsCount(int index)
INGCount[index].value= actorSatchel.GetItemCount(aPotionFormlist[index])
UpdateCurrentInstanceGlobal(INGCount[index])
endFunction
Function IngredientsSwap(int whichPotion)
int CurrentIngredients = 0
Form CurrentItem = aPotionFormList[whichPotion].GetAt(CurrentIngredients)
Int iCount = actorSatchel.GetItemCount(CurrentItem)
actorSatchel.RemoveItem(CurrentItem,iCount)
PlayerRef.AddItem(lPotions[whichPotion], 1)
endFunction

Edited by sumojellybean
Link to comment
Share on other sites

FIXED. Finally after a cold shower I saw that my problem was actually the CurrentIngredients integer that was getting everything screwed up. >< I still need more sleep.

Edited by sumojellybean
Link to comment
Share on other sites

  • Recently Browsing   0 members

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