Forum Evo OTSa
Zrobiłem z rl tibi potiony;
wchodzimy w silnik/data/actions/script i dodajemy potions.lua
local greatHealthPot = 7591
local greatManaPot = 7590
local strongHealthPot = 7588
local strongManaPot = 7589
local healthPot = 7618
local manaPot = 7620
local greatEmptyPot = 7635
local strongEmptyPot = 7634
local emptyPot = 7636
function onUse(cid, item, frompos, item2, topos)
if(item.itemid == healthPot) then
doSendAnimatedText(getPlayerPosition(cid), "Aaaah...", TEXTCOLOR_ORANGE)
if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 170, 230, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
return FALSE
end
doTransformItem(item.uid, emptyPot)
elseif(item.itemid == manaPot) then
doSendAnimatedText(getPlayerPosition(cid), "Aaaah...", TEXTCOLOR_ORANGE)
if(doTargetCombatMana(0, cid, 170, 230, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
return FALSE
end
doTransformItem(item.uid, emptyPot)
elseif(item.itemid == strongHealthPot) then
doSendAnimatedText(getPlayerPosition(cid), "Aaaah...", TEXTCOLOR_ORANGE)
if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 300, 500, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
return FALSE
end
doTransformItem(item.uid, strongEmptyPot)
elseif(item.itemid == strongManaPot) then
doSendAnimatedText(getPlayerPosition(cid), "Aaaah...", TEXTCOLOR_ORANGE)
if(doTargetCombatMana(0, cid, 300, 500, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
return FALSE
end
doTransformItem(item.uid, strongEmptyPot)
elseif(item.itemid == greatHealthPot) then
doSendAnimatedText(getPlayerPosition(cid), "Aaaah...", TEXTCOLOR_ORANGE)
if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 500, 800, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
return FALSE
end
doTransformItem(item.uid, greatEmptyPot)
elseif(item.itemid == greatManaPot) then
doSendAnimatedText(getPlayerPosition(cid), "Aaaah...", TEXTCOLOR_ORANGE)
if(doTargetCombatMana(0, cid, 500, 800, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
return FALSE
end
doTransformItem(item.uid, greatEmptyPot)
end
return TRUE
end
potem wchodzimy w actions.xml i dodajemy
-- Life potions
<action itemid="7618" exhaustion="1" script="potions/health potion.lua" />
<action itemid="7588" exhaustion="1" script="potions/strong health potion.lua" />
<action itemid="7591" exhaustion="3" script="potions/great health potion.lua" />
-- Mana potions
<action itemid="7620" exhaustion="1" script="potions/mana potion.lua" />
<action itemid="7589" exhaustion="1" script="potions/strong mana potion.lua" />
<action itemid="7590" exhaustion="1" script="potions/great mana potion.lua" />
nastepnie w npc/scripts dodajemy potions.lua
nastepnie w data/npc dodajemy npc zeby sprzedawal te potiony:
<?xml version="1.0"?>
<npc name="Rashid" script="data/npc/scripts/potions.lua" access="6" lookdir="7">
<health now="1000" max="1000"/>
<look type="146" head="132" body="116" legs="116" feet="76"/>
</npc>
Offline