Plarux Posted October 2, 2021 Share Posted October 2, 2021 Hello everyone, I've had the idea for brewing and winemaking in Skyrim recently after playing Survival and would like to create a mod to do so. Basically, placing activators around the world that trigger a message that lets you select what alcohol you'd like to brew, if you have the ingredients, the process starts and you have to wait 2-3 days before obtaining the finished product. If the player clicks on the activator again before the 2-3 days is up, a message will appear that says "The alcohol is not done yet." or something similar. This is a small project that is inspired by various oldrim mods that allow the player to craft alcohol. It's similar to the moonshine distillery in Point Lookout from Fallout 3. Any help with the script would be much appreciated! Plarux Link to comment Share on other sites More sharing options...
IsharaMeradin Posted October 2, 2021 Share Posted October 2, 2021 Take a look at this mod, Berts Hearthfire Dairy Goods Upgrade, while it is for milking a cow the script used for the cow contains the process for waiting X amount of time before being able to milk again. For a working example, this would be a good place to start. Beyond that, I can tell you that you'll probably want to use states. The initial state or "auto state" will be waiting for the player to place their brew order. Then you'll jump to another state or "busy state" and display your message box whenever the player activates again during the waiting period. When the waiting period is over, switch to a third state that will give the player the brewed item(s) when activated and switch back to the initial state. If you need additional help, feel free to post your script code. Link to comment Share on other sites More sharing options...
Plarux Posted October 2, 2021 Author Share Posted October 2, 2021 (edited) IsharaMeradin, thank you for your reply! I'll be sure to post what I come up with soon. Edited October 3, 2021 by Plarux Link to comment Share on other sites More sharing options...
Plarux Posted October 3, 2021 Author Share Posted October 3, 2021 (edited) I took a few hours after work today to splice together some code, but haven't tested it yet.Here's what I managed to come up with: Scriptname PLRX_AlcoholActivatorScript extends ObjectReference String Property DaysToWait Auto {select amount of days to wait} Float Property AlcoholStartTime auto Hidden {the game day alcohol was last successfully crafted} GlobalVariable Property AlcoholTypeCraft Auto Ingredient Property AshYam Auto Ingredient Property Wheat Auto Ingredient Property FireSalts Auto Ingredient Property CreepCluster Auto Ingredient Property JuniperBerries Auto Ingredient Property FrostMirriam Auto Ingredient Property DragonTongue Auto Ingredient Property PurpleMtnFlower Auto Ingredient Property Nightshade Auto Ingredient Property MoonSugar Auto Ingredient Property SaltPile Auto Ingredient Property JazbayGrapes Auto Ingredient Property Snowberries Auto Ingredient Property Thistle Auto Ingredient Property Histcarp Auto Food Property Honey Auto Food Property Ale Auto Food Property AshfireMead Auto Food Property NordMead Auto Food Property VilodMead Auto Food Property CirodiilicBrandy Auto Food Property ColovianBrandy Auto Potion Property Skooma Auto Potion Property BalmoraBlue Auto Potion Property DistilledSkooma Auto Food Property AltoWine Auto Food Property SpicedWine Auto Food Property Wine Auto Food Property ArgonianBloodwine Auto Food Property FirebrandWine Auto Message Property NotReady_Ale Auto Message Property NotReady_AshfireMead Auto Message Property NotReady_NordMead Auto Message Property NotReady_VilodMead Auto Message Property NotReady_CirodiilicBrandy Auto Message Property NotReady_ColovianBrandy Auto Message Property NotReady_Skooma Auto Message Property NotReady_BalmoraBlue Auto Message Property NotReady_DistilledSkooma Auto Message Property NotReady_AltoWine Auto Message Property NotReady_SpicedWine Auto Message Property NotReady_Wine Auto Message Property NotReady_ArgonianBloodwine Auto Message Property NotReady_FirebrandWine Auto Message Property LackIngredients_Ale Auto Message Property LackIngredients_AshfireMead Auto Message Property LackIngredients_NordMead Auto Message Property LackIngredients_VilodMead Auto Message Property LackIngredients_CirodiilicBrandy Auto Message Property LackIngredients_ColovianBrandy Auto Message Property LackIngredients_Skooma Auto Message Property LackIngredients_BalmoraBlue Auto Message Property LackIngredients_DistilledSkooma Auto Message Property LackIngredients_AltoWine Auto Message Property LackIngredients_SpicedWine Auto Message Property LackIngredients_Wine Auto Message Property LackIngredients_ArgonianBloodwine Auto Message Property LackIngredients_FirebrandWine Auto Message Property Ale_Started Auto Message Property AshfireMead_Started Auto Message Property NordMead_Started Auto Message Property VilodMead_Started Auto Message Property CirodiilicBrandy_Started Auto Message Property ColovianBrandy_Started Auto Message Property Skooma_Started Auto Message Property BalmoraBlue_Started Auto Message Property DistilledSkooma_Started Auto Message Property AltoWine_Started Auto Message Property SpicedWine_Started Auto Message Property Wine_Started Auto Message Property ArgonianBloodwine_Started Auto Message Property FirebrandWine_Started Auto Message Property AlcoholMenu Auto Message Property BrewMenu Auto Message Property DistillMenu Auto Message Property VinifyMenu Auto Int DaysWaited ;=================================================================== ;;STATE BLOCK ;=================================================================== Auto State ReadytoBrew event onActivate(ObjectReference akActionRef) AlcoholMenu() endEvent EndState ;-------------------------------------------------------------------------- State WaitingtoFinish event onBeginState() AlcoholStartTime = utility.getCurrentGameTime() endEvent event onActivate(ObjectReference akActionRef) If AlcoholTypeCraft.GetValue() == 1 NotReady_Ale.Show() ElseIf AlchoholTypeCraft.GetValue() == 2 NotReady_AshfireMead.Show() ElseIf AlchoholTypeCraft.GetValue() == 3 NotReady_NordMead.Show() ElseIf AlchoholTypeCraft.GetValue() == 4 NotReady_VilodMead.Show() ElseIf AlchoholTypeCraft.GetValue() == 5 NotReady_CirodiilicBrandy.Show() ElseIf AlchoholTypeCraft.GetValue() == 6 NotReady_ColovianBrandy.Show() ElseIf AlchoholTypeCraft.GetValue() == 7 NotReady_Skooma.Show() ElseIf AlchoholTypeCraft.GetValue() == 8 NotReady_BalmoraBlue.Show() ElseIf AlchoholTypeCraft.GetValue() == 9 NotReady_DistilledSkooma.Show() ElseIf AlchoholTypeCraft.GetValue() == 10 NotReady_AltoWine.Show() ElseIf AlchoholTypeCraft.GetValue() == 11 NotReady_SpicedWine.Show() ElseIf AlchoholTypeCraft.GetValue() == 12 NotReady_Wine.Show() ElseIf AlchoholTypeCraft.GetValue() == 13 NotReady_ArgonianBloodwine.Show() ElseIf AlchoholTypeCraft.GetValue() == 14 NotReady_FirebrandWine.Show() EndIf endEvent event onCellLoad() Float FLTDaysWaited = DaysToWait as Float Float ThreeDays = 3 Float FLTDaysToWait = (FLTDaysWaited * ThreeDays) Utility.Wait(1.0) if (AlcoholStartTime +FLTDaystoWait) <= utility.GetCurrentGameTime() goToState("AlcoholFinished") elseif (AlcoholStartTime +FLTDaystoWait) >= utility.GetCurrentGameTime() ;do nothing EndIf endEvent EndState ;-------------------------------------------------------------------------- State AlcoholFinished Event onActivate(ObjectReference akActionRef) If AlcoholTypeCraft.GetValue() == 1 Game.GetPlayer().AddItem(Ale, 10, false) goToState("ReadytoBrew") ElseIf AlchoholTypeCraft.GetValue() == 2 Game.GetPlayer().AddItem(AsfireMead, 10, false) goToState("ReadytoBrew") ElseIf AlchoholTypeCraft.GetValue() == 3 Game.GetPlayer().AddItem(NordMead, 10, false) goToState("ReadytoBrew") ElseIf AlchoholTypeCraft.GetValue() == 4 Game.GetPlayer().AddItem(VilodMead, 10, false) goToState("ReadytoBrew") ElseIf AlchoholTypeCraft.GetValue() == 5 Game.GetPlayer().AddItem(CirodiilicBrandy, 10, false) goToState("ReadytoBrew") ElseIf AlchoholTypeCraft.GetValue() == 6 Game.GetPlayer().AddItem(ColovianBrandy, 10, false) goToState("ReadytoBrew") ElseIf AlchoholTypeCraft.GetValue() == 7 Game.GetPlayer().AddItem(Skooma, 10, false) goToState("ReadytoBrew") ElseIf AlchoholTypeCraft.GetValue() == 8 Game.GetPlayer().AddItem(BalmoraBlue, 10, false) goToState("ReadytoBrew") ElseIf AlchoholTypeCraft.GetValue() == 9 Game.GetPlayer().AddItem(DistilledSkooma, 10, false) goToState("ReadytoBrew") ElseIf AlchoholTypeCraft.GetValue() == 10 Game.GetPlayer().AddItem(AltoWine, 10, false) goToState("ReadytoBrew") ElseIf AlchoholTypeCraft.GetValue() == 11 Game.GetPlayer().AddItem(SpicedWine, 10, false) goToState("ReadytoBrew") ElseIf AlchoholTypeCraft.GetValue() == 12 Game.GetPlayer().AddItem(Wine, 10, false) goToState("ReadytoBrew") ElseIf AlchoholTypeCraft.GetValue() == 13 Game.GetPlayer().AddItem(ArgonianBloodwine, 10, false) goToState("ReadytoBrew") ElseIf AlchoholTypeCraft.GetValue() == 14 Game.GetPlayer().AddItem(Firebrandwine, 10, false) goToState("ReadytoBrew") EndIf EndEvent EndState ;=================================================================== ;;FUNCTION BLOCK ;=================================================================== Function AlcoholMenu(int aButton = 0, Bool abMenu = True) aButton = AlcoholMenu.Show() If aButton == 0 ; Brew Menu BrewMenu() ElseIf aButton == 1 ; Distill Menu DistillMenu() ElseIf aButton == 2 ; Vinify Menu VinifyMenu() ElseIf aButton == 3 ; Exit Menu AbMenu = False EndIf EndFunction ;-------------------------------------------------------------------------- Function BrewMenu(int aButton = 0, Bool abMenu = True) aButton = BrewMenu.Show() If aButton == 0 ; Go Back to Alcohol Menu AlcoholMenu() Else If aButton == 1 ; Craft Ale Game.GetPlayer().RemoveItem(Wheat, 50, true AlcoholTypeCraft.SetValue(1) Ale_Started.Show() goToState("WaitingtoFinish") ElseIf aButton == 2 ; Cannot Craft Ale LackIngredients_Ale.Show() ElseIf aButton == 3 ; Craft Ashfire Mead Game.GetPlayer().RemoveItem(AshYam, 20, true) Game.GetPlayer().RemoveItem(Wheat, 20, true) Game.GetPlayer().RemoveItem(FireSalts, 10, true) AlcoholTypeCraft.SetValue(2) AshfireMead_Started.Show() goToState("WaitingtoFinish") ElseIf aButton == 4 ; Cannot Craft Ashfire Mead LackIngredients_AshfireMead.Show() ElseIf aButton == 5 ; Craft Nord Mead Game.GetPlayer().RemoveItem(CreepCluster, 10, true) Game.GetPlayer().RemoveItem(Wheat, 10, true) Game.GetPlayer().RemoveItem(Honey, 2, true) AlcoholTypeCraft.SetValue(3) NordMead_Started.Show() goToState("WaitingtoFinish") ElseIf aButton == 6 ; Cannot Craft Nord Mead LackIngredients_NordMead ElseIf aButton == 7 ; Craft Vilod Mead Game.GetPlayer().RemoveItem(JuniperBerries, 20, true) Game.GetPlayer().RemoveItem(Wheat, 10, true) Game.GetPlayer().RemoveItem(Honey, 2, true) AlcoholTypeCraft.SetValue(4) VilodMead_Started.Show() goToState("WaitingtoFinish") ElseIf aButton == 8 ; Cannot Craft Vilod Mead LackIngredients_VilodMead ElseIf aButton == 9 ; EXIT Menu abMenu = False EndIf EndFunction ;-------------------------------------------------------------------------- Function DistillMenu(int aButton = 0, Bool abMenu = True) aButton = DistillMenu.Show() If aButton == 0 ; Go Back to Alcohol Menu AlcoholMenu() ElseIf aButton == 1 ; Craft Cirodiilic Brandy Game.GetPlayer().RemoveItem(Wheat, 30, true) Game.GetPlayer().RemoveItem(FrostMirriam, 10, true) AlcoholTypeCraft.SetValue(5) CirodiilicBrandy_Started.Show() goToState("WaitingtoFinish") ElseIf aButton == 2 ; Cannot Craft Cirodiilic Brandy LackIngredients_CirodiilicBrandy.Show() ElseIf aButton == 3 ; Craft Colovian Brandy Game.GetPlayer().RemoveItem(Wheat, 20, true) Game.GetPlayer().RemoveItem(DragonTongue, 10, true) Game.GetPlayer().RemoveItem(PurpleMtnFlower, 20, true) AlcoholTypeCraft.SetValue(6) ColovianBrandy_Started.Show() goToState("WaitingtoFinish") ElseIf aButton == 4 ; Cannot Craft Colovian Brandy LackIngredients_ColovianBrandy.Show() ElseIf aButton == 5 ; Craft Skooma Game.GetPlayer().RemoveItem(Nightshade, 20, true) Game.GetPlayer().RemoveItem(MoonSugar, 15, true) AlcoholTypeCraft.SetValue(7) Skooma_Started.Show() goToState("WaitingtoFinish") ElseIf aButton == 6 ; Cannot Craft Skooma LackIngredients_Skooma.Show() ElseIf aButton == 7 ; Craft Balmora Blue Game.GetPlayer().RemoveItem(MoonSugar, 20, true) Game.GetPlayer().RemoveItem(PurpleMtnFlower, 20, true) AlcoholTypeCraft.SetValue(8) BalmoraBlue_Started.Show() goToState("WaitingtoFinish") ElseIf aButton == 8 ; Cannot Craft Balmora Blue LackIngredients_BalmoraBlue ElseIf aButton == 9 ; Craft Double-Distilled Skooma Game.GetPlayer().RemoveItem(Nightshade, 30, true) Game.GetPlayer().RemoveItem(MoonSugar, 25, true) AlcoholTypeCraft.SetValue(9) DistilledSkooma_Started.Show() goToState("WaitingtoFinish") ElseIf aButton == 10 ; Cannot Craft Double-Distilled Skooma LackIngredients_DistilledSkooma.Show() ElseIf aButton == 11 ; EXIT Menu AbMenu = False EndIf EndFunction ;-------------------------------------------------------------------------- Function VinifyMenu(int aButton = 0, Bool abMenu = True) aButton = VinifyMenu.Show() If aButton == 0 ; Go Back to Alcohol Menu AlcoholMenu() ElseIf aButton == 1 ; Craft Alto Wine Game.GetPlayer().RemoveItem(Wheat, 30, true) Game.GetPlayer().RemoveItem(FrostMirriam, 5, true) AlcoholTypeCraft.SetValue(10) AltoWine_Started.Show() goToState("WaitingtoFinish") ElseIf aButton == 2 ; Cannot Craft Alto Wine LackIngredients_AltoWine.Show() ElseIf aButton == 3 ; Craft Spiced Wine Game.GetPlayer().RemoveItem(JazbayGrapes, 20, true) Game.GetPlayer().RemoveItem(SaltPile, 10, true) Game.GetPlayer().RemoveItem(Wheat, 10, true) Game.GetPlayer().RemoveItem(Honey, 5, true) AlcoholTypeCraft.SetValue(11) SpicedWine_Started.Show() goToState("WaitingtoFinish") ElseIf aButton == 4 ; Cannot Craft Spiced Wine LackIngredients_SpicedWine.Show() ElseIf aButton == 5 ; Craft Wine Game.GetPlayer().RemoveItem(Snowberries, 20, true) Game.GetPlayer().RemoveItem(Honey, 2, true) Game.GetPlayer().RemoveItem(JazbayGrapes, 10, true) AlcoholTypeCraft.SetValue(12) Wine_Started.Show() goToState("WaitingtoFinish") ElseIf aButton == 6 ; Cannot Craft Wine LackIngredients_SpicedWine.Show() ElseIf aButton == 7 ; Craft Argonain Bloodwine Game.GetPlayer().RemoveItem(Thistle, 20, true) Game.GetPlayer().RemoveItem(Histcarp, 5, true) Game.GetPlayer().RemoveItem(JazbayGrapes, 20, true) AlcoholTypeCraft.SetValue(13) ArgonianBloodwine_Started.Show() goToState("WaitingtoFinish") ElseIf aButton == 8 ; Cannot Craft Argonian Bloodwine LackIngredients_ArgonainBloodwine.Show() ElseIf aButton == 9 ; Craft Firebrand Wine Game.GetPlayer().RemoveItem(FireSalts, 10, true) Game.GetPlayer().RemoveItem(JuniperBerries, 10, true) Game.GetPlayer().RemoveItem(JazbayGrapes, 20, true) AlcoholTypeCraft.SetValue(14) FirebrandWine_Started.Show() goToState("WaitingtoFinish") ElseIf aButton == 10 ; Cannot Craft Firebrand Wine LackIngredients_FirebrandWine.Show() ElseIf aButton == 11 ; EXIT Menu AbMenu = False EndIf EndFunction ;-------------------------------------------------------------------------- Edited October 3, 2021 by Plarux Link to comment Share on other sites More sharing options...
IsharaMeradin Posted October 3, 2021 Share Posted October 3, 2021 Looks like it might work. Test it out when you can. Minor tip: If using Game.GetPlayer() a lot, you can speed up the script processing some by using a variable to store the results of Game.GetPlayer(). Each time the papyrus thread runs across Game.GetPlayer() it has to pause the current script to jump to the Game script and run the GetPlayer() function. By being stored in a local variable, the thread only needs to jump to the Game script one time instead of multiple times. Thus saving a few precious moments of time. Link to comment Share on other sites More sharing options...
Plarux Posted October 3, 2021 Author Share Posted October 3, 2021 (edited) Looks like it might work. Test it out when you can. Minor tip: If using Game.GetPlayer() a lot, you can speed up the script processing some by using a variable to store the results of Game.GetPlayer(). Each time the papyrus thread runs across Game.GetPlayer() it has to pause the current script to jump to the Game script and run the GetPlayer() function. By being stored in a local variable, the thread only needs to jump to the Game script one time instead of multiple times. Thus saving a few precious moments of time. I've been using the script "zz01scrptmaturing03maturing.psc" from the Bert mod as a reference and did notice "Actor Player = Game.GetPlayer()" is there before "Player.AddItem()" is used. Assuming that is exactly what you're suggesting. Should be able to test it later today or in a couple of days. I appreciate the knowledge and advice! Edited October 4, 2021 by Plarux Link to comment Share on other sites More sharing options...
Plarux Posted October 4, 2021 Author Share Posted October 4, 2021 I was able to get the script to compile successfully after some tweaking. Here is the updated script: Scriptname PLRX_AlcoholActivatorScript extends ObjectReference String Property DaysToWait Auto {select amount of days to wait} Float Property AlcoholStartTime auto Hidden {the game day alcohol was last successfully crafted} GlobalVariable Property AlcoholTypeCraft Auto Potion Property FoodHoney Auto Potion Property DLC2FoodAshYam Auto Ingredient Property Wheat Auto Ingredient Property FireSalts Auto Ingredient Property CreepClusterRoot Auto Ingredient Property JuniperBerries Auto Ingredient Property FrostMirriam Auto Ingredient Property DragonsTongue Auto Ingredient Property MountainFlower01Purple Auto Ingredient Property Nightshade Auto Ingredient Property MoonSugar Auto Ingredient Property SaltPile Auto Ingredient Property JazBay Auto Ingredient Property Snowberry Auto Ingredient Property Thistle01 Auto Ingredient Property Histcarp Auto Potion Property Ale Auto Potion Property DLC2FoodAshfireMead Auto Potion Property FoodMead Auto Potion Property MQ101JuniperMead Auto ; Vilod's Mead Potion Property WEDL03CyrodilicBrandy Auto Potion Property MQ201Drink Auto ; Colovian Brandy Potion Property Skooma Auto Potion Property TGTQ02BalmoraBlue Auto Potion Property WindhelmDoubleDistilledSkooma Auto Potion Property FoodWineAltoA Auto Potion Property FoodSolitudeSpicedWine Auto Potion Property FoodWineBottle02A Auto Potion Property BYOHFoodWineBottle04 Auto ; Argonian Bloodwine Potion Property FirebrandWine Auto Message Property LackIngredients_Ale Auto Message Property LackIngredients_AshfireMead Auto Message Property LackIngredients_NordMead Auto Message Property LackIngredients_VilodMead Auto Message Property LackIngredients_CyrodilicBrandy Auto Message Property LackIngredients_ColovianBrandy Auto Message Property LackIngredients_Skooma Auto Message Property LackIngredients_BalmoraBlue Auto Message Property LackIngredients_DistilledSkooma Auto Message Property LackIngredients_AltoWine Auto Message Property LackIngredients_SpicedWine Auto Message Property LackIngredients_Wine Auto Message Property LackIngredients_ArgonianBloodwine Auto Message Property LackIngredients_FirebrandWine Auto Message Property Ale_Started Auto Message Property AshfireMead_Started Auto Message Property NordMead_Started Auto Message Property VilodMead_Started Auto Message Property CyrodilicBrandy_Started Auto Message Property ColovianBrandy_Started Auto Message Property Skooma_Started Auto Message Property BalmoraBlue_Started Auto Message Property DistilledSkooma_Started Auto Message Property AltoWine_Started Auto Message Property SpicedWine_Started Auto Message Property Wine_Started Auto Message Property ArgonianBloodwine_Started Auto Message Property FirebrandWine_Started Auto Message Property NotReady_Ale Auto Message Property NotReady_AshfireMead Auto Message Property NotReady_NordMead Auto Message Property NotReady_VilodMead Auto Message Property NotReady_CyrodilicBrandy Auto Message Property NotReady_ColovianBrandy Auto Message Property NotReady_Skooma Auto Message Property NotReady_BalmoraBlue Auto Message Property NotReady_DistilledSkooma Auto Message Property NotReady_AltoWine Auto Message Property NotReady_SpicedWine Auto Message Property NotReady_Wine Auto Message Property NotReady_ArgonianBloodwine Auto Message Property NotReady_FirebrandWine Auto Message Property AlcoholMenu Auto Message Property BrewMenu Auto Message Property DistillMenu Auto Message Property VinifyMenu Auto ;=================================================================== ;;STATE BLOCK ;=================================================================== Auto State ReadytoBrew event onActivate(ObjectReference akActionRef) AlcoholMenu() endEvent EndState ;-------------------------------------------------------------------------- State WaitingtoFinish event onBeginState() AlcoholStartTime = utility.getCurrentGameTime() endEvent event onActivate(ObjectReference akActionRef) If AlcoholTypeCraft.GetValue() == 1 NotReady_Ale.Show() ElseIf AlcoholTypeCraft.GetValue() == 2 NotReady_AshfireMead.Show() ElseIf AlcoholTypeCraft.GetValue() == 3 NotReady_NordMead.Show() ElseIf AlcoholTypeCraft.GetValue() == 4 NotReady_VilodMead.Show() ElseIf AlcoholTypeCraft.GetValue() == 5 NotReady_CyrodilicBrandy.Show() ElseIf AlcoholTypeCraft.GetValue() == 6 NotReady_ColovianBrandy.Show() ElseIf AlcoholTypeCraft.GetValue() == 7 NotReady_Skooma.Show() ElseIf AlcoholTypeCraft.GetValue() == 8 NotReady_BalmoraBlue.Show() ElseIf AlcoholTypeCraft.GetValue() == 9 NotReady_DistilledSkooma.Show() ElseIf AlcoholTypeCraft.GetValue() == 10 NotReady_AltoWine.Show() ElseIf AlcoholTypeCraft.GetValue() == 11 NotReady_SpicedWine.Show() ElseIf AlcoholTypeCraft.GetValue() == 12 NotReady_Wine.Show() ElseIf AlcoholTypeCraft.GetValue() == 13 NotReady_ArgonianBloodwine.Show() ElseIf AlcoholTypeCraft.GetValue() == 14 NotReady_FirebrandWine.Show() EndIf endEvent event onCellLoad() Float FLTDaysWaited = DaysToWait as Float Float ThreeDays = 3 Float FLTDaysToWait = (FLTDaysWaited * ThreeDays) Utility.Wait(1.0) if (AlcoholStartTime +FLTDaystoWait) <= utility.GetCurrentGameTime() goToState("AlcoholFinished") elseif (AlcoholStartTime +FLTDaystoWait) >= utility.GetCurrentGameTime() ;do nothing EndIf endEvent EndState ;-------------------------------------------------------------------------- State AlcoholFinished Event onActivate(ObjectReference akActionRef) Actor Player = Game.GetPlayer() If AlcoholTypeCraft.GetValue() == 1 Game.GetPlayer().AddItem(Ale, 10, false) goToState("ReadytoBrew") ElseIf AlcoholTypeCraft.GetValue() == 2 Game.GetPlayer().AddItem(DLC2FoodAshfireMead, 10, false) goToState("ReadytoBrew") ElseIf AlcoholTypeCraft.GetValue() == 3 Game.GetPlayer().AddItem(FoodMead, 10, false) goToState("ReadytoBrew") ElseIf AlcoholTypeCraft.GetValue() == 4 Game.GetPlayer().AddItem(MQ101JuniperMead, 10, false) ; Vilod's Mead goToState("ReadytoBrew") ElseIf AlcoholTypeCraft.GetValue() == 5 Game.GetPlayer().AddItem(WEDL03CyrodilicBrandy, 10, false) goToState("ReadytoBrew") ElseIf AlcoholTypeCraft.GetValue() == 6 Game.GetPlayer().AddItem(WEDL03CyrodilicBrandy, 10, false) goToState("ReadytoBrew") ElseIf AlcoholTypeCraft.GetValue() == 7 Game.GetPlayer().AddItem(Skooma, 10, false) goToState("ReadytoBrew") ElseIf AlcoholTypeCraft.GetValue() == 8 Game.GetPlayer().AddItem(TGTQ02BalmoraBlue, 10, false) goToState("ReadytoBrew") ElseIf AlcoholTypeCraft.GetValue() == 9 Game.GetPlayer().AddItem(WindhelmDoubleDistilledSkooma, 10, false) goToState("ReadytoBrew") ElseIf AlcoholTypeCraft.GetValue() == 10 Game.GetPlayer().AddItem(FoodWineAltoA, 10, false) goToState("ReadytoBrew") ElseIf AlcoholTypeCraft.GetValue() == 11 Game.GetPlayer().AddItem(FoodSolitudeSpicedWine, 10, false) goToState("ReadytoBrew") ElseIf AlcoholTypeCraft.GetValue() == 12 Game.GetPlayer().AddItem(FoodWineBottle02A, 10, false) goToState("ReadytoBrew") ElseIf AlcoholTypeCraft.GetValue() == 13 Game.GetPlayer().AddItem(BYOHFoodWineBottle04, 10, false) goToState("ReadytoBrew") ElseIf AlcoholTypeCraft.GetValue() == 14 Game.GetPlayer().AddItem(Firebrandwine, 10, false) goToState("ReadytoBrew") EndIf EndEvent EndState ;=================================================================== ;;FUNCTION BLOCK ;=================================================================== Function AlcoholMenu(int aButton = 0, Bool abMenu = True) aButton = AlcoholMenu.Show() If aButton == 0 ; Brew Menu BrewMenu() ElseIf aButton == 1 ; Distill Menu DistillMenu() ElseIf aButton == 2 ; Vinify Menu VinifyMenu() ElseIf aButton == 3 ; Exit Menu AbMenu = False EndIf EndFunction ;-------------------------------------------------------------------------- Function BrewMenu(int aButton = 0, Bool abMenu = True) aButton = BrewMenu.Show() Actor Player = Game.GetPlayer() If aButton == 0 ; Go Back to Alcohol Menu AlcoholMenu() ElseIf aButton == 1 ; Craft Ale Player.RemoveItem(Wheat, 50, true) AlcoholTypeCraft.SetValue(1) Ale_Started.Show() goToState("WaitingtoFinish") ElseIf aButton == 2 ; Cannot Craft Ale LackIngredients_Ale.Show() ElseIf aButton == 3 ; Craft Ashfire Mead Player.RemoveItem(DLC2FoodAshYam, 20, true) Player.RemoveItem(Wheat, 20, true) Player.RemoveItem(FireSalts, 10, true) AlcoholTypeCraft.SetValue(2) AshfireMead_Started.Show() goToState("WaitingtoFinish") ElseIf aButton == 4 ; Cannot Craft Ashfire Mead LackIngredients_AshfireMead.Show() ElseIf aButton == 5 ; Craft Nord Mead Player.RemoveItem(CreepClusterRoot, 10, true) Player.RemoveItem(Wheat, 10, true) Player.RemoveItem(FoodHoney, 2, true) AlcoholTypeCraft.SetValue(3) NordMead_Started.Show() goToState("WaitingtoFinish") ElseIf aButton == 6 ; Cannot Craft Nord Mead LackIngredients_NordMead ElseIf aButton == 7 ; Craft Vilod Mead Player.RemoveItem(JuniperBerries, 20, true) Player.RemoveItem(Wheat, 10, true) Player.RemoveItem(FoodHoney, 2, true) AlcoholTypeCraft.SetValue(4) VilodMead_Started.Show() goToState("WaitingtoFinish") ElseIf aButton == 8 ; Cannot Craft Vilod Mead LackIngredients_VilodMead ElseIf aButton == 9 ; EXIT Menu abMenu = False EndIf EndFunction ;-------------------------------------------------------------------------- Function DistillMenu(int aButton = 0, Bool abMenu = True) aButton = DistillMenu.Show() Actor Player = Game.GetPlayer() If aButton == 0 ; Go Back to Alcohol Menu AlcoholMenu() ElseIf aButton == 1 ; Craft Cyrodilic Brandy Player.RemoveItem(Wheat, 30, true) Player.RemoveItem(FrostMirriam, 10, true) AlcoholTypeCraft.SetValue(5) CyrodilicBrandy_Started.Show() goToState("WaitingtoFinish") ElseIf aButton == 2 ; Cannot Craft Cyrodilic Brandy LackIngredients_CyrodilicBrandy.Show() ElseIf aButton == 3 ; Craft Colovian Brandy Player.RemoveItem(Wheat, 20, true) Player.RemoveItem(DragonsTongue, 10, true) Player.RemoveItem(MountainFlower01Purple, 20, true) AlcoholTypeCraft.SetValue(6) ColovianBrandy_Started.Show() goToState("WaitingtoFinish") ElseIf aButton == 4 ; Cannot Craft Colovian Brandy LackIngredients_ColovianBrandy.Show() ElseIf aButton == 5 ; Craft Skooma Player.RemoveItem(Nightshade, 20, true) Player.RemoveItem(MoonSugar, 15, true) AlcoholTypeCraft.SetValue(7) Skooma_Started.Show() goToState("WaitingtoFinish") ElseIf aButton == 6 ; Cannot Craft Skooma LackIngredients_Skooma.Show() ElseIf aButton == 7 ; Craft Balmora Blue Player.RemoveItem(MoonSugar, 20, true) Player.RemoveItem(MountainFlower01Purple, 20, true) AlcoholTypeCraft.SetValue(8) BalmoraBlue_Started.Show() goToState("WaitingtoFinish") ElseIf aButton == 8 ; Cannot Craft Balmora Blue LackIngredients_BalmoraBlue ElseIf aButton == 9 ; Craft Double-Distilled Skooma Player.RemoveItem(Nightshade, 30, true) Player.RemoveItem(MoonSugar, 25, true) AlcoholTypeCraft.SetValue(9) DistilledSkooma_Started.Show() goToState("WaitingtoFinish") ElseIf aButton == 10 ; Cannot Craft Double-Distilled Skooma LackIngredients_DistilledSkooma.Show() ElseIf aButton == 11 ; EXIT Menu AbMenu = False EndIf EndFunction ;-------------------------------------------------------------------------- Function VinifyMenu(int aButton = 0, Bool abMenu = True) aButton = VinifyMenu.Show() Actor Player = Game.GetPlayer() If aButton == 0 ; Go Back to Alcohol Menu AlcoholMenu() ElseIf aButton == 1 ; Craft Alto Wine Player.RemoveItem(Wheat, 30, true) Player.RemoveItem(FrostMirriam, 5, true) AlcoholTypeCraft.SetValue(10) AltoWine_Started.Show() goToState("WaitingtoFinish") ElseIf aButton == 2 ; Cannot Craft Alto Wine LackIngredients_AltoWine.Show() ElseIf aButton == 3 ; Craft Spiced Wine Player.RemoveItem(Jazbay, 20, true) Player.RemoveItem(SaltPile, 10, true) Player.RemoveItem(Wheat, 10, true) Player.RemoveItem(FoodHoney, 5, true) AlcoholTypeCraft.SetValue(11) SpicedWine_Started.Show() goToState("WaitingtoFinish") ElseIf aButton == 4 ; Cannot Craft Spiced Wine LackIngredients_SpicedWine.Show() ElseIf aButton == 5 ; Craft Wine Player.RemoveItem(Snowberry, 20, true) Player.RemoveItem(FoodHoney, 2, true) Player.RemoveItem(Jazbay, 10, true) AlcoholTypeCraft.SetValue(12) Wine_Started.Show() goToState("WaitingtoFinish") ElseIf aButton == 6 ; Cannot Craft Wine LackIngredients_SpicedWine.Show() ElseIf aButton == 7 ; Craft Argonain Bloodwine Player.RemoveItem(Thistle01, 20, true) Player.RemoveItem(Histcarp, 5, true) Player.RemoveItem(Jazbay, 20, true) AlcoholTypeCraft.SetValue(13) ArgonianBloodwine_Started.Show() goToState("WaitingtoFinish") ElseIf aButton == 8 ; Cannot Craft Argonian Bloodwine LackIngredients_ArgonianBloodwine.Show() ElseIf aButton == 9 ; Craft Firebrand Wine Player.RemoveItem(FireSalts, 10, true) Player.RemoveItem(JuniperBerries, 10, true) Player.RemoveItem(Jazbay, 20, true) AlcoholTypeCraft.SetValue(14) FirebrandWine_Started.Show() goToState("WaitingtoFinish") ElseIf aButton == 10 ; Cannot Craft Firebrand Wine LackIngredients_FirebrandWine.Show() ElseIf aButton == 11 ; EXIT Menu AbMenu = False EndIf EndFunction ;-------------------------------------------------------------------------- Compiler Output: Starting 1 compile threads for 1 files... Compiling "PLRX_AlcoholActivatorScript"... Starting assembly of PLRX_AlcoholActivatorScript 0 error(s), 0 warning(s) Assembly succeeded Compilation succeeded. Batch compile of 1 files finished. 1 succeeded, 0 failed. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted October 4, 2021 Share Posted October 4, 2021 Now the big question: Does it work the way that you want in game? I can see a benefit in using some arrays and formlists here. ;at the top in the empty state Message[] Property Not_Ready_Messages Auto Message[] Property Started_Messages Auto Message[] Property LackIngredients_Messages Auto FormList Property CraftedItems Auto ;inside the WaitingToFinish state event onActivate(ObjectReference akActionRef) Int index = (AlcoholTypeCraft.GetValue() - 1) ;array & formlist indices start at 0 Not_Ready_Messages[index].Show() endEvent ;inside the AlcoholFinished state Event onActivate(ObjectReference akActionRef) Actor PlayerRef = Game.GetPlayer() Int index = (AlcoholTypeCraft.GetValue() - 1) ;array & formlist indices start at 0 Form Entry = CraftedItems.GetAt(index) PlayerRef.AddItem(Entry,10,false) EndEvent ;and the BrewMenu, DistillMenu and VinifyMenu functions could pop out to separate functions and make use of the Started_Messages array and LackIngredients_Messages array ;example follows with the BrewMenu Function StartCraft(Int CraftChoice) AlcoholTypeCraft.SetValue(CraftChoice) Int index = CraftChoice - 1 Started_Messages[index].Show() goToState("WaitingtoFinish") EndFunction Function CannotCraft(Int CraftChoice) Int index = CraftChoice - 1 LackIngredients_Messages[index].Show() EndFunction Function BrewMenu(int aButton = 0, Bool abMenu = True) aButton = BrewMenu.Show() Actor PlayerRef = Game.GetPlayer() If aButton == 0 ; Go Back to Alcohol Menu AlcoholMenu() ElseIf aButton == 1 ; Craft Ale PlayerRef.RemoveItem(Wheat, 50, true) StartCraft(1) ElseIf aButton == 2 ; Cannot Craft Ale CannotCraft(1) ElseIf aButton == 3 ; Craft Ashfire Mead PlayerRef.RemoveItem(DLC2FoodAshYam, 20, true) PlayerRef.RemoveItem(Wheat, 20, true) PlayerRef.RemoveItem(FireSalts, 10, true) StartCraft(2) ElseIf aButton == 4 ; Cannot Craft Ashfire Mead CannotCraft(2) ElseIf aButton == 5 ; Craft Nord Mead PlayerRef.RemoveItem(CreepClusterRoot, 10, true) PlayerRef.RemoveItem(Wheat, 10, true) PlayerRef.RemoveItem(FoodHoney, 2, true) StartCraft(3) ElseIf aButton == 6 ; Cannot Craft Nord Mead CannotCraft(3) ElseIf aButton == 7 ; Craft Vilod Mead PlayerRef.RemoveItem(JuniperBerries, 20, true) PlayerRef.RemoveItem(Wheat, 10, true) PlayerRef.RemoveItem(FoodHoney, 2, true) StartCraft(4) ElseIf aButton == 8 ; Cannot Craft Vilod Mead CannotCraft(4) ElseIf aButton == 9 ; EXIT Menu abMenu = False EndIf EndFunction The Not_Ready_Messages array, Started_Messages array, LackIngredients_Messages array and CraftedItems formlist would have index matching entries with the order as defined by AlcoholTypeCraft. You do not need to switch to doing this method. Just wanted to demonstrate another possible way. Link to comment Share on other sites More sharing options...
Recommended Posts