zxzxzx
New Member
- Joined
- Mar 12, 2011
- Messages
- 334
- Reaction score
- 3
Hello! I just need to add different "arr" in this spell for third effect, how to make it work?
the spell
I tried many times with this lines and every time I do it bad..
The spell needs to look like this:
There's different callbacks too..
Help me! I be very grateful! rep++
bump ;c
the spell
Code:
local combatConfig = {
[0] = {type = COMBAT_PHYSICALDAMAGE, effect = CONST_ME_POFF, distanceEffect = CONST_ANI_THROWINGSTAR},
[1] = {type = COMBAT_PHYSICALDAMAGE, effect = CONST_ME_POFF, distanceEffect = CONST_ANI_GREENSTAR},
[2] = {type = COMBAT_PHYSICALDAMAGE, effect = CONST_ME_POFF, distanceEffect = CONST_ANI_REDSTAR},
[3] = {type = COMBAT_PHYSICALDAMAGE, effect = CONST_ME_HOLYAREA, distanceEffect = CONST_ANI_SMALLHOLY},
}
function onGetFormulaValues0(player, level, maglevel)
local min = (level / 5) + (maglevel * 1.8) + 11
local max = (level / 5) + (maglevel * 3) + 19
return -min, -max
end
function onGetFormulaValues1(player, level, maglevel)
local min = (level / 5) + (maglevel * 1.8) + 11
local max = (level / 5) + (maglevel * 3) + 19
return -min, -max
end
function onGetFormulaValues2(player, level, maglevel)
local min = (level / 5) + (maglevel * 1.8) + 11
local max = (level / 5) + (maglevel * 3) + 19
return -min, -max
end
function onGetFormulaValues3(player, level, maglevel)
local min = (level / 5) + (maglevel * 1.8) + 11
local max = (level / 5) + (maglevel * 3) + 19
return -min, -max
end
function onTargetTile0(creature, position)
creature:getPosition():sendDistanceEffect(position, combatConfig[0].distanceEffect)
end
function onTargetTile1(creature, position)
creature:getPosition():sendDistanceEffect(position, combatConfig[1].distanceEffect)
end
function onTargetTile2(creature, position)
creature:getPosition():sendDistanceEffect(position, combatConfig[2].distanceEffect)
end
function onTargetTile3(creature, position)
creature:getPosition():sendDistanceEffect(position, combatConfig[3].distanceEffect)
end
function onTargetCreature0(creature, target)
return doChallengeCreature(creature, target)
end
function onTargetCreature1(creature, target)
return doChallengeCreature(creature, target)
end
function onTargetCreature2(creature, target)
return doChallengeCreature(creature, target)
end
function onTargetCreature3(creature, target)
return doChallengeCreature(creature, target)
end
local combat = {}
for i = 0, 3 do
combat[i] = Combat()
combat[i]:setParameter(COMBAT_PARAM_TYPE, combatConfig[i].type)
combat[i]:setParameter(COMBAT_PARAM_EFFECT, combatConfig[i].effect)
combat[i]:setArea(createCombatArea(AREA_CROSS6X6))
combat[i]:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues"..i)
combat[i]:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile"..i)
combat[i]:setCallback(CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature"..i)
end
local function combatCallBack(cid, id, variant)
local player = Player(cid)
if not player then
return false
end
return combat[id]:execute(player, variant)
end
function onCastSpell(creature, variant)
local cid = creature:getId()
for i = 0, 3 do
addEvent(combatCallBack, i * 500, cid, i, variant)
end
return true
end
I tried many times with this lines and every time I do it bad..
Code:
for i = 0, 3 do
combat[i] = Combat()
combat[i]:setParameter(COMBAT_PARAM_TYPE, combatConfig[i].type)
combat[i]:setParameter(COMBAT_PARAM_EFFECT, combatConfig[i].effect)
combat[i]:setArea(createCombatArea(AREA_CROSS6X6))
combat[i]:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues"..i)
combat[i]:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile"..i)
combat[i]:setCallback(CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature"..i)
end
The spell needs to look like this:
There's different callbacks too..
Help me! I be very grateful! rep++
bump ;c
Last edited by a moderator: