Created: 5 days ago on 05/19/2025, 07:00:50 PMUpdated: 5 days ago on 05/19/2025, 07:07:55 PM
FileType: No file type provided
Size: 924
Category: Utility
Skills: No skills provided
Hotkey: No hotkey provided
Tags: pvp,pvm
Description: This works for all potions, just save one version for each and change the graphic id of the potion at the beginning.
If you have a weapon equipped when you drink the potion, it registers its id, unequip, drink potion, re-equip it.
If you don't have any weapon equipped, it just drinks the potion.
local weapFound = Items.FindByLayer(1)
-- 0x0F07 is Cure Potion, use -info to get graphic id
local POT = Items.FindByType('0x0F07')
-- If potion was found
if POT ~= nil then
function DrinkPot(POT)
Player.UseObject(POT.Serial)
while not Player.IsDead do
if Journal.Contains('cured') or Journal.Contains('not poisoned') then
Journal.Clear()
break
end
Pause(10)
end
end
-- if weapon equipped, drop it
if weapFound ~= nil then
local WEAP = weapFound.Serial
Player.PickUp(WEAP)
Player.DropInBackpack()
Pause(600)
DrinkPot(POT)
Pause(500)
Player.PickUp(WEAP)
Player.Equip(WEAP)
else
DrinkPot(POT)
end
else
Messages.Print('Potion not found')
end