Bom esse script ele esta funcionando por item, eu queria que ele como uma alavanca alguém pode meda essa moral ai, rep+ Dodge System.lua
function onStatsChange(cid, attacker, type, combat, value)
local getStorage = getPlayerStorageValue(cid, 123455678)
if (type == STATSCHANGE_HEALTHLOSS or type == STATSCHANGE_MANALOSS) then
local chance = math.random (0,100)
if chance <= getStorage then
doSendAnimatedText(getCreaturePos(cid), "MISS!", 214)
doSendMagicEffect(getCreaturePosition(cid), 30)
return false
end
end
return true
end
Creaturescript.xml
<event type="StatsChange" name="DodgeSystem" event="script" value="Dodge System.lua"/>
Login.lua antes do ultimo return true
registerCreatureEvent(cid, "DodgeSystem")
if getPlayerStorageValue(cid, 123455678) == -1 then
setPlayerStorageValue(cid, 123455678, 0)
end
em action:
dodgestone.lua
function onUse(cid, item, fromPosition, itemEx, toPosition)
local max = 50 -- limite de dodge
local storagedodge = 123455678 -- storage do dodge
if getPlayerStorageValue(cid, storagedodge) >= max then
return doPlayerSendTextMessage(cid,22,"Você ja chego no limite de Dodge.")
else
doPlayerSetStorageValue(cid, storagedodge, (getPlayerStorageValue(cid, storagedodge)) + 1)
doPlayerSendTextMessage(cid,22, "DodgeSKILL:["..getPlayerStorageValue(cid, storagedodge).."/"..max.."].")
doRemoveItem(item.uid, 1)
end
return true
end
action.xml tag
<action itemid="Id do item" event="script" value="dodgestone.lua"/>