MindRage
Toss Me
- Joined
- Nov 11, 2008
- Messages
- 474
- Reaction score
- 71
ontargetcreature and ontargettile, a sort of template that you write in lua, then have certain parameters that you can set in a properties window.
Sort of making it able to for example, trigger another combat if you hit a target, or send random effects on tile.
Kind of like:
and
- - - Updated - - -
Except when you add parameters which you can change, such as effect and that in some kind of list.
Sort of making it able to for example, trigger another combat if you hit a target, or send random effects on tile.
Kind of like:
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 34)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_EFFECT, 36)
local condition = createConditionObject(CONDITION_FIRE)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(condition, 5, 2000, -35)
function onGetFormulaValues(cid, level, maglevel)
local min = level / 5 + maglevel * 3.9 + 7
local max = level / 5 + maglevel * 4.2 + 8
return -min, -max
end
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
local arr = {
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
}
local arr2 = {
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
}
local area = createCombatArea(arr2, AREADIAGONAL_WAVE4)
local area2 = createCombatArea(arr, AREADIAGONAL_WAVE4)
setCombatArea(combat, area)
setCombatArea(combat2, area2)
function onTargetCreature(cid, target)
local pos = getCreaturePosition(target)
doSendMagicEffect(pos, 38)
if math.random(1,100) <= 10 then
doTargetCombatCondition(cid, target, condition, 15)
end
end
setCombatCallback(combat2, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")
function onCastSpell(cid, var)
doCombat(cid, combat2, var)
return doCombat(cid, combat, var)
end
and
Lua:
local combat = createPhase({
Timer = 200,
Agressive = true,
DamageType = COMBAT_ICEDAMAGE,
Formula = COMBAT_FORMULA_LEVELMAGIC,
Damage = function(cid, level, maglevel)
local min = level / 5 + maglevel * 1.2 + 7
local max = level / 5 + maglevel * 2.85 + 16
return -min, -max
end,
MagicEffect = 255, DistanceEffect = CONST_ANI_ICE,
OnTargetTile = function(cid, pos)
delay = math.random(50,200)
if math.random(1,5) < 3 then addEvent(doSendDistanceShoot, delay, {x = pos.x - 4, y = pos.y - 4, z = pos.z},pos, CONST_ANI_ICE) end
if math.random(1,20) < 10 then
addEvent(doSendMagicEffect,delay + 200, pos ,41)
else
addEvent(doSendMagicEffect,delay + 200, pos ,43)
end
end,
Area = AREA_CIRCLE3X3
}
,{Name="Ghost"}, 1)
function onCastSpell(cid, var)
return doCombat(cid, combat, var)
end
- - - Updated - - -
Except when you add parameters which you can change, such as effect and that in some kind of list.