Shnerr Posted November 4, 2016 Share Posted November 4, 2016 I am attempting to make a simple alchohol overhaul mod for Fallout 4, and I'm having trouble getting a script to add a potion to the player's inventory after drinking another potion. The basic idea is that drinking a full bottle of bourbon, rum, vodka, moonshine, or whiskey all at once is a horrible idea, so I want to break the liquors into smaller units. Essentially, there would be a Bourbon 4/4, Bourbon 3/4, and so on. I want to add a bourbon 3/4 to the player inventory after drinking bourbon 4/4. The script below is not working. This script is attached to a magic effect that is added to each liquor. Can anyone tell a rookie where I'm going wrong? Scriptname AlchOverAddBourbon34 extends activemagiceffect Potion Property Bourbon34 auto const Function AddBourbon34() Game.GetPlayer().AddItem(Bourbon34, 1) Endfunction Link to comment Share on other sites More sharing options...
shavkacagarikia Posted November 4, 2016 Share Posted November 4, 2016 In your script the game doesn't know when to execute the additem function, because you have put it inside your custom made function which is never called by itself. You don't need that AddBourbon34() function. You need an event for that to work. Try this: Scriptname AlchOverAddBourbon34 extends activemagiceffect Potion Property Bourbon34 auto const Event OnEffectStart(Actor akTarget, Actor akCaster) Game.getplayer().additem(Bourbon34,1) endEvent Link to comment Share on other sites More sharing options...
Shnerr Posted November 4, 2016 Author Share Posted November 4, 2016 In your script the game doesn't know when to execute the additem function, because you have put it inside your custom made function which is never called by itself. You don't need that AddBourbon34() function. You need an event for that to work. Try this:Scriptname AlchOverAddBourbon34 extends activemagiceffect Potion Property Bourbon34 auto const Event OnEffectStart(Actor akTarget, Actor akCaster)Game.getplayer().additem(Bourbon34,1)endEvent This worked great! Thanks for the help. Link to comment Share on other sites More sharing options...
Recommended Posts