Exedion
Active Member
- Joined
- Jun 11, 2007
- Messages
- 628
- Reaction score
- 30
Well i made this spell for my berserker knight based promotion of my ot, i take the name of famous videogame xD but no have relation with it :S well this spell take the 30% of the character hp to cast, doing a blood area which reduces the states depending on the vocation affected, giving him a berserker state but greatly reducing their defenses, I hope you like it! Enjoy!
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_DRAWBLOOD)
AREA_CIRCLE = {
{0, 1, 1, 1, 0},
{1, 1, 1, 1, 1},
{1, 1, 2, 1, 1},
{1, 1, 1, 1, 1},
{0, 1, 1, 1, 0}
}
local area = createCombatArea(AREA_CIRCLE)
setCombatArea(combat, area)
local condition = {}
for i = 1, 4 do
condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, 10000)
setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELDPERCENT, 50)
end
setConditionParam(condition[1], CONDITION_PARAM_STAT_MAGICLEVEL, 5)
setConditionParam(condition[2], CONDITION_PARAM_SKILL_DISTANCEPERCENT, 150)
setConditionParam(condition[3], CONDITION_PARAM_SKILL_MELEEPERCENT, 150)
function onTargetCreature(cid, target)
if(isSorcerer(target) or isDruid(target)) then
return doTargetCombatCondition(cid, target, condition[1], CONST_ME_MAGIC_BLUE), true
elseif(isPaladin(target)) then
return doTargetCombatCondition(cid, target, condition[2], CONST_ME_MAGIC_GREEN), true
elseif(isKnight(target)) then
return doTargetCombatCondition(cid, target, condition[3], CONST_ME_MAGIC_RED), true
end
return true
end
setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")
function onCastSpell(cid, var)
local tribute = getCreatureMaxHealth(cid) * 1.3 - getCreatureMaxHealth(cid)
if getCreatureHealth(cid) <= tribute then
doPlayerSendCancel(cid, "You need more health points.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
return LUA_ERROR
else
doCreatureAddHealth(cid, -tribute)
return doCombat(cid, combat, var)
end
end
Last edited: