Postado Outubro 27, 2013 11 anos bom eu pelo menos conheço só essa: (é adicionado em itens.xml no item) <attribute key="reflectpercentall" value="30"/> <attribute key="reflectchanceall" value="30"/> e tem o sistema do matheusmklao Vá na pasta data/lib e crie um arquivo chamado de ReflectLib.lua e adicione isso dentro: function isHandedWeapon(itemuid) local typee = getItemWeaponType(itemuid) or 0 if typee >= 1 and typee <= 6 then return CONST_SLOT_RIGHT end return -1 end function getItemType(itemid) local slottypes = {"head", "body", "legs", "feet", "ring", "necklace"} local consts = { ["head"] = CONST_SLOT_HEAD, ["armor"] = CONST_SLOT_ARMOR, ["legs"] = CONST_SLOT_LEGS, ["feet"] = CONST_SLOT_FEET, ["ring"] = CONST_SLOT_RING, ["necklace"] = CONST_SLOT_NECKLACE } local arq = io.open("data/items/items.xml", "r"):read("*all") local attributes = arq:match('<item id="' .. itemid .. '".+name="' .. getItemNameById(itemid) ..'">(.-)</item>') local slot = "" for i,x in pairs(slottypes) do if attributes:find(x) then slot = x break end end if slot == "body" then slot = "armor" end return consts[slot] end function addReflectCharges(item, charges, reflectpercent) if charges ~= "inf" then charges = charges+1 doItemSetAttribute(item, "mcharges", charges) doItemSetAttribute(item, "charges", charges) doItemSetAttribute(item, "name", getItemNameById(getThing(item).itemid) .. " that is brand-new") else doItemSetAttribute(item, "charges", -1) doItemSetAttribute(item, "mcharges", "inf") end doItemSetAttribute(item, "reflect", reflectpercent) doItemSetAttribute(item, "description", "That item reflects " .. reflectpercent .. " percent of physical damage.") end function renewCharges(item) if getItemAttribute(item, "charges") and getItemAttribute(item, "mcharges") ~= "inf" then doItemSetAttribute(item, "charges", getItemAttribute(item, "mcharges")) doItemSetAttribute(item, "name", getItemNameById(getThing(item).itemid) .. " that is brand-new") end end Agora vá em data/creaturescripts/scripts e adicione o script reflectDamage.lua com esse script: function onStatsChange(cid, attacker, type, combat, value) local slots = {CONST_SLOT_HEAD, CONST_SLOT_NECKLACE, CONST_SLOT_ARMOR, CONST_SLOT_RIGHT, CONST_SLOT_LEFT, CONST_SLOT_LEGS, CONST_SLOT_FEET, CONST_SLOT_RING} local reflectpercent = 0 local itens = {} for i = 1, #slots do if getPlayerSlotItem(cid, slots[i]).uid > 1 and (getItemType(getPlayerSlotItem(cid, slots[i]).itemid) == slots[i] or isInArray({CONST_SLOT_RIGHT, CONST_SLOT_LEFT}, isHandedWeapon(getPlayerSlotItem(cid, slots[i]).uid))) and getItemAttribute(getPlayerSlotItem(cid, slots[i]).uid, "mcharges") and (getItemAttribute(getPlayerSlotItem(cid, slots[i]).uid, "charges") > 1 or getItemAttribute(getPlayerSlotItem(cid, slots[i]).uid, "mcharges") == "inf") then reflectpercent = reflectpercent+getItemAttribute(getPlayerSlotItem(cid, slots[i]).uid, "reflect") table.insert(itens, getPlayerSlotItem(cid, slots[i])) end end if combat == 1 and reflectpercent > 0 then if math.ceil(-value*((100-reflectpercent)/100)) < 0 then doCreatureAddHealth(cid, math.ceil(-value*((100-reflectpercent)/100))) doSendAnimatedText(getCreaturePosition(cid), math.ceil(value*((100-reflectpercent)/100)), COLOR_RED) local a = doCreateItem(2019, 2, getCreaturePosition(cid)) doSendMagicEffect(getCreaturePosition(cid), 0) doDecayItem(a) else doSendMagicEffect(getCreaturePosition(cid), 3) end if math.ceil(-value*(reflectpercent/100)) < 0 then doCreatureAddHealth(attacker, math.ceil(-value*(reflectpercent/100))) doSendAnimatedText(getCreaturePosition(attacker), math.ceil(value*(reflectpercent/100)), COLOR_GREY) local a = doCreateItem(2019, 2, getCreaturePosition(attacker)) doSendMagicEffect(getCreaturePosition(attacker), 9) doDecayItem(a) end for i,x in pairs(itens) do if getItemAttribute(x.uid, "mcharges") ~= "inf" then doItemSetAttribute(x.uid, "charges", getItemAttribute(x.uid, "charges")-1) doItemSetAttribute(x.uid, "name", getItemNameById(x.itemid) .. " that has " .. getItemAttribute(x.uid, "charges")-1 .. " charge" .. (getItemAttribute(x.uid, "charges")-1 > 1 and "s" or "") .. " left") end end else return TRUE end end Agora na mesma pasta, procure por login.lua, e antes do ultimo return true, adicione essa linha: registerCreatureEvent(cid, "ReflectDamage") Agora vá em creaturescripts.xml e adicione esta tag: <event type="statschange" name="ReflectDamage" event="script" value="reflectDamage.lua"/> Ot Design: https://discord.gg/VgtVRNmCD7
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.