Helliot1
Owner of Empire Online
- Joined
- Jul 26, 2017
- Messages
- 315
- Solutions
- 1
- Reaction score
- 60
Hello, I have a problem, need a mana potion that only need use to heal my mana, without "Use with" "Hotkey", somebody can help me ?
I'm using OTX3 8.60 , and a custom spr and dat. then how properties I use in Item editor too ?
This is my script.
I'm using OTX3 8.60 , and a custom spr and dat. then how properties I use in Item editor too ?
This is my script.
Code:
<action itemid="1831" script="others/potions.lua"/>
Code:
local potions = {
[1831] = {mana = {50, 75}, flask = 1841}
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if type(target) == "userdata" and not target:isPlayer() then
return false
end
if potion.health or potion.mana then
if potion.health then
doTargetCombatHealth(0, target, COMBAT_HEALING, potion.health[1], potion.health[2], CONST_ME_MAGIC_BLUE)
end
if potion.mana then
doTargetCombatMana(0, target, potion.mana[1], potion.mana[2], CONST_ME_MAGIC_BLUE)
end
target:say("Aaaah...", TALKTYPE_MONSTER_SAY)
player:RemoveItem(potion.mana, 1)
player:addItem(potion.flask, 1)
end
if potion.condition then
player:addCondition(potion.condition)
player:say(potion.text, TALKTYPE_MONSTER_SAY)
player:getPosition():sendMagicEffect(potion.effect)
end
if potion.transform then
item:transform(potion.transform.id[math.random(#potion.transform.id)])
item:getPosition():sendMagicEffect(potion.effect)
return true
end
item:remove(1)
return true
end
Last edited: