wizkid34 Posted March 24, 2019 Share Posted March 24, 2019 (edited) 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) endifEndEvent thanks in advance for the reply Edited March 24, 2019 by wizkid34 Link to comment Share on other sites More sharing options...
maxarturo Posted March 24, 2019 Share Posted March 24, 2019 (edited) 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 March 24, 2019 by maxarturo Link to comment Share on other sites More sharing options...
wizkid34 Posted March 24, 2019 Author Share Posted March 24, 2019 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 More sharing options...
maxarturo Posted March 24, 2019 Share Posted March 24, 2019 I'm guessing that you want the bottle to be returned when a SPECIFIC beverage is consumed.Is this what you want ? Link to comment Share on other sites More sharing options...
wizkid34 Posted March 24, 2019 Author Share Posted March 24, 2019 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 More sharing options...
maxarturo Posted March 24, 2019 Share Posted March 24, 2019 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 More sharing options...
wizkid34 Posted March 25, 2019 Author Share Posted March 25, 2019 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 More sharing options...
Recommended Posts