Jump to content

[LE] Return Empty Bottle


wizkid34

Recommended Posts

Hi all, I need a little help with a simple script that returns empty bottles on player inventory after a beverage is used. The old script works but I get empty bottles even if an npc is drinking.

 

this is the old script

 

Scriptname Returnemptybottles extends activemagiceffect
MiscObject Property EmptyBottle Auto
Event OnEffectStart(Actor akTarget, Actor akCaster)
Game.GetPlayer().AddItem(EmptyBottle, 1)
EndEvent
can anyone tell me if this would work?
Scriptname Returnemptybottles extends activemagiceffect
MiscObject Property EmptyBottle Auto
Event OnEffectStart(Actor akTarget, Actor akCaster)
if (Game.GetPlayer() == akCaster)
Game.GetPlayer().AddItem(EmptyBottle, 1)
endif
EndEvent
thanks in advance for the reply
Edited by wizkid34
Link to comment
Share on other sites

A simpler version for your old Script

 

 

Scriptname Returnemptybottles02 extends activemagiceffect

MiscObject Property EmptyBottle  Auto  
 
Event OnEffectStart(Actor akTarget, Actor akCaster)
        Utility.Wait(4.5)
        Game.GetPlayer().AddItem(EmptyBottle, 1)
EndEvent

 

 

 

Just modify the time to match the time needed to consume the beverage.

Edited by maxarturo
Link to comment
Share on other sites

A simpler version for your old Script

 

 

Scriptname Returnemptybottles02 extends activemagiceffect

MiscObject Property EmptyBottle  Auto  
 
Event OnEffectStart(Actor akTarget, Actor akCaster)
        Utility.Wait(4.5)
        Game.GetPlayer().AddItem(EmptyBottle, 1)
EndEvent

 

 

 

Just modify the time to match the time needed to consume the beverage.

@maxaturo thanks alot for the reply, Is there a way to check if the player is drinking the beverage? It seems that my old script works with the npc too and this cause to receive extra empty bottles when, for example, an enemy drink a potion

Link to comment
Share on other sites

I'm guessing that you want the bottle to be returned when a SPECIFIC beverage is consumed.

Is this what you want ?

 

I already done that part in my mod and it works flawlessly, what I need now is that the bottle returns in the invetory only when the player is drinking it, my old script works even if a beverage is drunk by an NPC

Link to comment
Share on other sites

it can be done.

Don't know if this wil work.

 

 

MiscObject Property EmptyBottle  Auto  
 
Event OnEffectStart(Actor akTarget, Actor akCaster)
     If akTarget == Game.GetPlayer()
        Utility.Wait(4.5)
        Game.GetPlayer().AddItem(EmptyBottle, 1)
EndEvent

This might need a more experienced coder. Haven't experimented with this kind of actions.

Link to comment
Share on other sites

it can be done.

Don't know if this wil work.

 

 

MiscObject Property EmptyBottle  Auto  
 
Event OnEffectStart(Actor akTarget, Actor akCaster)
     If akTarget == Game.GetPlayer()
        Utility.Wait(4.5)
        Game.GetPlayer().AddItem(EmptyBottle, 1)
EndEvent

This might need a more experienced coder. Haven't experimented with this kind of actions.

 

@maxarturo thanks again, I'll try your modified script and I'll let you know if it works

Link to comment
Share on other sites

  • Recently Browsing   0 members

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