Jump to content

Adding potion to inventory after using another potion.


Shnerr

Recommended Posts

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

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

 

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

  • Recently Browsing   0 members

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