Ir para conteúdo
  • 0

O Que É Esse Error?


tonynamoral

Pergunta

Eu peguei esse script de reflect damage aki do Aluccard , porém ele fica dando error . e a funçao de adicionar o reflect no ITEM não está funcionando ;

 

Script :

 

 

 

<?xml version="1.0" encoding="UTF-8"?>

<mod name="Reflect System" version="0.1" author="Aluccard" contact="" enabled="yes">

<description>

Script que funciona para refletir danos para as creatures que o atacar.

</description>

 

<event type="login" name="regReflectDamage" event="script"><![CDATA[

function onLogin(cid)

registerCreatureEvent(cid,"ReflectDamage")

return true

end

]]></event>

 

<event type="statschange" name="ReflectDamage" event="script"><![CDATA[

 

local slotPos = {CONST_SLOT_NECKLACE, CONST_SLOT_FEET, CONST_SLOT_HEAD}

 

function onStatsChange(cid, attacker, type, combat, value)

local reflectPercent = 0

local dmg = value

local playerPos = getCreaturePosition(cid)

local attackerPos = getCreaturePosition(attacker)

 

for i = 1, #slotPos do

if getPlayerSlotItem(cid, slotPos).uid > 1 then

if getItemReflectPercent(getPlayerSlotItem(cid, slotPos).uid) then

reflectPercent = reflectPercent + getItemReflectPercent(getPlayerSlotItem(cid, slotPos).uid)

end

end

end

 

if reflectPercent > 0 then

dmg = math.ceil(-value*((100-reflectPercent)/100))

if (dmg < 0) then

doCreatureAddHealth(cid, dmg)

doSendAnimatedText(playerPos, -dmg, COLOR_RED)

doSendMagicEffect(playerPos, 0)

else

doSendMagicEffect(playerPos, 3)

end

 

dmg = math.ceil(-value*(reflectPercent/100))

if (dmg < 0) then

doCreatureAddHealth(attacker, dmg)

doSendAnimatedText(attackerPos, -dmg, COLOR_RED)

doSendDistanceShoot(playerPos, attackerPos, CONST_ANI_SMALLHOLY)

end

else

return true

end

end]]></event>

</mod>

 

 

 

Funão de Adicionar item com Reflect


function getItemReflectPercent(itemid)
			return getItemAttribute(itemid, "reflectPercent")
end
function doPlayerAddReflectedItem(cid, itemid, percent)
local item = doPlayerAddItem(cid, itemid)
doItemSetAttribute(item, "description", "[Reflect: "..percent.."%]")
doItemSetAttribute(item, "reflectPercent", percent)
end

return true
end

 

Agora o error :


[11/12/2012 17:01:03] [Error - CreatureScript Interface]
[11/12/2012 17:01:03] buffer:onStatsChange
[11/12/2012 17:01:03] Description:
[11/12/2012 17:01:03] [string "loadBuffer"]:11: attempt to call global 'getItemReflectPercent' (a nil value)
[11/12/2012 17:01:03] stack traceback:
[11/12/2012 17:01:03]  [string "loadBuffer"]:11: in function <[string "loadBuffer"]:3>

Link para o comentário
Compartilhar em outros sites

Posts Recomendados

×
×
  • Criar Novo...