MU
pedido

Apos acabar a carga! AJUDA - +REp

Por Murilosz, 29 de mar. de 2013 em Scripts

itens
tibia
ajuda
help
otserv
carga
+rep
script
6
936
MuriloszM
29 de março de 2013 às 12:14

Arrumei 500 cargas em um item, mas quando chega a 0 de carga o item não some script -->

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

chance = 970

if type == STATSCHANGE_HEALTHLOSS then

if isPlayer(attacker) then

local slotWeapon = nil

 

if weapons[getPlayerSlotItem(attacker, CONST_SLOT_RIGHT).itemid] then

slotWeapon = CONST_SLOT_RIGHT

elseif weapons[getPlayerSlotItem(attacker, CONST_SLOT_LEFT).itemid] then

slotWeapon = CONST_SLOT_LEFT

end

 

if slotWeapon == nil then

return true

end

 

if (getItemAttribute(getPlayerSlotItem(attacker, slotWeapon).uid, "Charges") == "Broken") then

doPlayerSendTextMessage(attacker, 22, "Sua weapon esta quebrada.")

return false

elseif (math.random(1,1000) > chance) then

setDurabilidade(attacker, slotWeapon, weapons)

end

end

 

elseif type == STATSCHANGE_HEALTHGAIN then

return false

end

 

return true

end

 

function onCombat(cid, target)

registerCreatureEvent(target, "DurGain")

return true

end

 

Editado Março 29 por Murilosz

AlexclusiveA
29 de março de 2013 às 12:50

Cara, em items.xml você tem que ter esses tags no item que você quer fazer isso..

 

 <attribute key="charges" value="200" />
 <attribute key="showcharges" value="1" />

 

Depois disso você tem que adicionar as seguintes tags em movements.xml:

 

<movevent type="Equip" itemid="2170" slot="necklace" event="function" value="onEquipItem"/>
<movevent type="DeEquip" itemid="2170" slot="necklace" event="function" value="onDeEquipItem"/>

 

Isso foi só um exemplo..e só você alterar os ids e vê se deu certo! Vlw

drakylucasD
29 de março de 2013 às 20:16

mude

doPlayerSendTextMessage(attacker, 22, "Sua weapon esta quebrada.")

 

para

 

doRemoveItem(getPlayerSlotItem(attacker, slotWeapon).uid)

MuriloszM
29 de março de 2013 às 21:30

Perfeito brigado amigo! duvida senada pode fechar!

MuriloszM
04 de abril de 2013 às 17:20

Pode fechar eu ja criei meu script! '

AlexclusiveA
04 de abril de 2013 às 17:38

Tópico movido para a seção de dúvidas e pedidos resolvidos.