sumojellybean Posted October 29, 2015 Share Posted October 29, 2015 (edited) 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 = CurrentCountUpdateCurrentInstanceGlobal(pFFI03BearCount)if CurrentCount >= 10pFFI03Quest.SetObjectiveCompleted(10,1)pFFI03Quest.SetObjectiveDisplayed(20,true,true)elseif CurrentCount < 10pFFI03Quest.SetObjectiveCompleted(10,0)pFFI03Quest.SetObjectiveDisplayed(20,0)pFFI03Quest.SetObjectiveDisplayed(10,true,true) endif endFunction Function EndSwap() int ListSize = pFFI03FormList.GetSize()int CurrentPelts = 0int PeltsLeft = 10 while CurrentPelts < ListSize && PeltsLeft > 0Form CurrentItem = pFFI03FormList.GetAt(CurrentPelts)int PeltCount = Game.GetPlayer().GetItemCount(CurrentItem)if PeltCount >= PeltsLeftPeltsLeft = 0elsePeltsLeft -= PeltCountendif Game.GetPlayer().RemoveItem(CurrentItem,PeltCount)CurrentPelts += 1endwhile 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 October 29, 2015 by sumojellybean Link to comment Share on other sites More sharing options...
sumojellybean Posted October 30, 2015 Author Share Posted October 30, 2015 Bump Link to comment Share on other sites More sharing options...
sumojellybean Posted October 30, 2015 Author Share Posted October 30, 2015 (edited) 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 October 30, 2015 by sumojellybean Link to comment Share on other sites More sharing options...
Recommended Posts