Jump to content
  • 0

[Pedido] Remover Item Do Inventario Ao Usar Magia


razurator

Question

preciso que cada vez que for usada essa magia remova uma assassin star da minha mochila ou slot de munição.

 

 

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, true)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_REDSTAR)
setCombatParam(combat, COMBAT_PARAM_USECHARGES, true)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
local condition = createConditionObject(CONDITION_PHYSICAL)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(condition, 1, 3000, -35)
addDamageCondition(condition, 3, 3000, -20)
addDamageCondition(condition, 2, 3000, -5)
setCombatCondition(combat, condition)
function onGetFormulaValues(cid, level, skill, attack, factor)
local skillTotal, levelTotal = skill + attack, level / 5
return -(skillTotal / 3 + levelTotal), -(skillTotal + levelTotal)
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
function onCastSpell(cid, var)
return
doCombat(cid, combat, var)

end

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0
local combat = createCombatObject()
if doRemoveItem(cid,2160) then
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, true)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_REDSTAR)
setCombatParam(combat, COMBAT_PARAM_USECHARGES, true)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
local condition = createConditionObject(CONDITION_PHYSICAL)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(condition, 1, 3000, -35)
addDamageCondition(condition, 3, 3000, -20)
addDamageCondition(condition, 2, 3000, -5)
setCombatCondition(combat, condition)
function onGetFormulaValues(cid, level, skill, attack, factor)
local skillTotal, levelTotal = skill + attack, level / 5
return -(skillTotal / 3 + levelTotal), -(skillTotal + levelTotal)
end
setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
function onCastSpell(cid, var)
return
doCombat(cid, combat, var)
end

Link to comment
Share on other sites

  • 0

Caro Vilden,

 

Seu script está incorreto, a função doRemoveItem não iria funcionar, uma vez que como está fora do corpo da função onCastSpell, não iria encontrar um cid válido.

 

O correto seria:

 


local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, true)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_REDSTAR)
setCombatParam(combat, COMBAT_PARAM_USECHARGES, true)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)

local condition = createConditionObject(CONDITION_PHYSICAL)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(condition, 1, 3000, -35)
addDamageCondition(condition, 3, 3000, -20)
addDamageCondition(condition, 2, 3000, -5)
setCombatCondition(combat, condition)

function onGetFormulaValues(cid, level, skill, attack, factor)
local skillTotal, levelTotal = skill + attack, level / 5
return -(skillTotal / 3 + levelTotal), -(skillTotal + levelTotal)
end
setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")

function onCastSpell(cid, var)
local item = {itemid = 2160, count = 1}
if doPlayerRemoveItem(cid, item.itemid, item.count) then
	return doCombat(cid, combat, var)
end
return doPlayerSendCancel(cid, "Você não possui ".. item.count .." ".. getItemNameById(item.itemid) ..".")
end

 

Ao criador do tópico, configure você mesmo o itemid da Assassin Star.

Edited by Oneshot
Link to comment
Share on other sites

  • 0

Valew cara, eu tinha visto ontem a reply do Loading... e usei ela dentro de uma function onCastSpell da maneira que você disse e deu certo mesmo assim.

 

Duvida sanada.

Link to comment
Share on other sites

×
×
  • Create New...