wafuboe
Active Member
- Joined
- Dec 24, 2010
- Messages
- 884
- Solutions
- 2
- Reaction score
- 26
How can i make this spell to attack twice? for example two spear shots per cast
Ethereal spear
Also for this spell how can i make in order to heal a 25% of the damage dealt?
Brutal strike
Last one, how can i make this spell give bonus mana and health and exp rate for 5 min
PRotect party
Ethereal spear
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ETHEREALSPEAR)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
function onGetFormulaValues(player, skill, attack, factor)
local distSkill = player:getEffectiveSkillLevel(SKILL_DISTANCE)
local min = (player:getLevel() / 5) + distSkill * 0.7
local max = (player:getLevel() / 5) + distSkill + 5
return -min, -max
end
combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
function onCastSpell(creature, variant)
return combat:execute(creature, variant)
end
Also for this spell how can i make in order to heal a 25% of the damage dealt?
Brutal strike
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_HITAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_WEAPONTYPE)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat:setParameter(COMBAT_PARAM_USECHARGES, true)
function onGetFormulaValues(player, skill, attack, factor)
local min = (player:getLevel() / 5) + (skill * attack * 0.02) + 4
local max = (player:getLevel() / 5) + (skill * attack * 0.04) + 9
return -min, -max
end
combat:setCallback(CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
function onCastSpell(creature, variant)
return combat:execute(creature, variant)
end
Last one, how can i make this spell give bonus mana and health and exp rate for 5 min
PRotect party
Code:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false)
combat:setArea(createCombatArea(AREA_CROSS5X5))
local condition = Condition(CONDITION_ATTRIBUTES)
condition:setParameter(CONDITION_PARAM_SUBID, 1)
condition:setParameter(CONDITION_PARAM_TICKS, 2 * 60 * 1000)
condition:setParameter(CONDITION_PARAM_SKILL_MELEE, 3)
condition:setParameter(CONDITION_PARAM_SKILL_DISTANCE, 3)
condition:setParameter(CONDITION_PARAM_BUFF_SPELL, true)
local baseMana = 60
function onCastSpell(creature, variant, isHotkey)
local position = creature:getPosition()
local party = creature:getParty()
if not party then
creature:sendCancelMessage("No party members in range.")
position:sendMagicEffect(CONST_ME_POFF)
return false
end
local membersList = party:getMembers()
membersList[#membersList + 1] = party:getLeader()
if membersList == nil or type(membersList) ~= 'table' or #membersList <= 1 then
creature:sendCancelMessage("No party members in range.")
position:sendMagicEffect(CONST_ME_POFF)
return false
end
local affectedList = {}
for _, targetPlayer in ipairs(membersList) do
if targetPlayer:getPosition():getDistance(position) <= 36 then
affectedList[#affectedList + 1] = targetPlayer
end
end
local tmp = #affectedList
if tmp <= 1 then
creature:sendCancelMessage("No party members in range.")
position:sendMagicEffect(CONST_ME_POFF)
return false
end
local mana = math.ceil((0.9 ^ (tmp - 1) * baseMana) * tmp)
if creature:getMana() < mana then
creature:sendCancelMessage(RETURNVALUE_NOTENOUGHMANA)
position:sendMagicEffect(CONST_ME_POFF)
return false
end
if not combat:execute(creature, variant) then
creature:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
position:sendMagicEffect(CONST_ME_POFF)
return false
end
creature:addMana(-(mana - baseMana), FALSE)
creature:addManaSpent((mana - baseMana))
for _, targetPlayer in ipairs(affectedList) do
targetPlayer:addCondition(condition)
end
return true
end