Nice spells for servers with fast connection (dont use much CPU/ram!). Tested on TFS 0.3 beta engine. Spells:
Mortocalypse - shot "mort" on area like UE, hit each tile 5 or more times
Hellfire - like Mortocalypse, but attack by fire
Area of Life - heal all creatures on area like UE, heal 1 time/sec, area stay 15 seconds
Area of Drain - drain HP (2 times/sec) from all creatures on area like UE and give their HP to player who casted spell (he can run away), stay 15 seconds
Xena - big stone hit player attacked on battle, find another target in range 3 sqm and hit, hit up to 8 enemies, if can't find enemy or hit 8 times stone come back to player who cast spell
Light Chain - hit creature attacked on battle and creatures near him >> find new target in range 3 sqm >> hit another target, hit up to 5 targets, max. one time one creature
1.
mortocalypse.lua
2.
apocalypse.lua
3.
areaoflife.lua
4.
areaofdrain.lua
5.
xena.lua
6.
lightchain.lua
Before you can use Xena or Light Chain spell you must add in functions.lua or global.lua
Mortocalypse - shot "mort" on area like UE, hit each tile 5 or more times
Hellfire - like Mortocalypse, but attack by fire
Area of Life - heal all creatures on area like UE, heal 1 time/sec, area stay 15 seconds
Area of Drain - drain HP (2 times/sec) from all creatures on area like UE and give their HP to player who casted spell (he can run away), stay 15 seconds
Xena - big stone hit player attacked on battle, find another target in range 3 sqm and hit, hit up to 8 enemies, if can't find enemy or hit 8 times stone come back to player who cast spell
Light Chain - hit creature attacked on battle and creatures near him >> find new target in range 3 sqm >> hit another target, hit up to 5 targets, max. one time one creature
1.
Code:
<instant name="Mortocalypse" words="exevo gran mort" lvl="40" prem="1" aggressive="1" manapercent="40" exhaustion="5000" needlearn="0" script="custom/mortocalypse.lua">
<vocation name="Master Sorcerer"/>
</instant>
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, TRUE)
arr = {
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
}
local area = createCombatArea(arr)
setCombatArea(combat, area)
function spellCallbackMort(param)
if (isPlayer(param.cid)) == 1 then
if(param.hitmin == nil or param.hitmax == nil) then
param.hitmin = math.floor(-getPlayerLevel(param.cid) * 0.5 + -getPlayerMagLevel(param.cid) * 1)
param.hitmax = math.floor(-getPlayerLevel(param.cid) * 0.7 + -getPlayerMagLevel(param.cid) * 1.2)
end
if param.count > 0 or math.random(0, 1) == 1 then
doAreaCombatHealth(param.cid, COMBAT_DEATHDAMAGE, param.pos, 0, param.hitmin, param.hitmax, CONST_ME_MORTAREA)
doSendDistanceShoot(getCreaturePosition(param.cid), param.pos, CONST_ANI_DEATH)
end
if(param.count < 3) then
param.count = param.count + 1
addEvent(spellCallbackMort, math.random(1000, 3000), param)
end
end
end
function onTargetTileMort(cid, pos)
local param = {}
param.cid = cid
param.pos = pos
param.count = 0
spellCallbackMort(param)
end
setCombatCallback(combat, CALLBACK_PARAM_TARGETTILE, "onTargetTileMort")
function onCastSpell(cid, var)
return doCombat(cid, combat, var)
end
Code:
<instant name="Hellfire" words="exevo gran flam" lvl="40" prem="1" aggressive="1" manapercent="40" exhaustion="5000" needlearn="0" script="custom/apocalypse.lua">
<vocation name="Elder Druid"/>
</instant>
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, TRUE)
arr = {
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
}
local area = createCombatArea(arr)
setCombatArea(combat, area)
function spellCallbackFire(param)
if (isPlayer(param.cid)) == 1 then
if (param.hitmin == nil or param.hitmax == nil) then
param.hitmin = math.floor(-getPlayerLevel(param.cid) * 0.5 + -getPlayerMagLevel(param.cid) * 1)
param.hitmax = math.floor(-getPlayerLevel(param.cid) * 0.7 + -getPlayerMagLevel(param.cid) * 1.2)
end
if param.count > 0 or math.random(0, 1) == 1 then
doAreaCombatHealth(param.cid, COMBAT_FIREDAMAGE, param.pos, 0, param.hitmin, param.hitmax, CONST_ME_HITBYFIRE)
doSendDistanceShoot(getCreaturePosition(param.cid), param.pos, CONST_ANI_FIRE)
end
if(param.count < 3) then
param.count = param.count + 1
addEvent(spellCallbackFire, math.random(1000, 3000), param)
end
end
end
function onTargetTileFire(cid, pos)
local param = {}
param.cid = cid
param.pos = pos
param.count = 0
spellCallbackFire(param)
end
setCombatCallback(combat, CALLBACK_PARAM_TARGETTILE, "onTargetTileFire")
function onCastSpell(cid, var)
return doCombat(cid, combat, var)
end
Code:
<instant name="Area of Life" words="exura mas area" lvl="40" aggressive="0" prem="1" manapercent="20" exhaustion="5000" needlearn="0" script="custom/areaoflife.lua">
<vocation name="Elder Druid"/>
</instant>
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
arr = {
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
}
local area = createCombatArea(arr)
setCombatArea(combat, area)
function spellCallbackLifeArea(param)
if (isPlayer(param.cid)) == 1 then
if(param.hitmin == nil or param.hitmax == nil) then
param.hitmin = math.floor(getPlayerLevel(param.cid) * 1 + getPlayerMagLevel(param.cid) * 1)
param.hitmax = math.floor(getPlayerLevel(param.cid) * 1.4 + getPlayerMagLevel(param.cid) * 1.2)
end
if param.count > 0 or math.random(0, 1) == 1 then
doAreaCombatHealth(param.cid, COMBAT_HEALING, param.pos, 0, param.hitmin, param.hitmax, CONST_ME_BUBBLES)
end
if math.random(0, 30) == 1 then
doCreatureAddHealth(param.cid, math.random(param.hitmin, param.hitmax))
end
if(param.count < 15) then
param.count = param.count + 1
addEvent(spellCallbackLifeArea, 1000, param)
end
end
end
function onTargetTileLifeArea(cid, pos)
local param = {}
param.cid = cid
param.pos = pos
param.count = 0
spellCallbackLifeArea(param)
end
setCombatCallback(combat, CALLBACK_PARAM_TARGETTILE, "onTargetTileLifeArea")
function onCastSpell(cid, var)
return doCombat(cid, combat, var)
end
Code:
<instant name="Area of Drain" words="exura mas drain" lvl="40" prem="1" aggressive="1" manapercent="30" exhaustion="5000" needlearn="0" script="custom/areaofdrain.lua">
<vocation name="Elder Druid"/>
</instant>
Code:
local combat = createCombatObject()
arr = {
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
}
local area = createCombatArea(arr)
setCombatArea(combat, area)
function spellCallbackLifeDrainArea(param)
if (isPlayer(param.cid)) == 1 then
if (param.hitmin == nil or param.hitmax == nil or param.healmin == nil or param.healmax == nil) then
param.hitmin = math.floor(-getPlayerLevel(param.cid) * 0.1 + -getPlayerMagLevel(param.cid) * 0.1)
param.hitmax = math.floor(-getPlayerLevel(param.cid) * 0.2 + -getPlayerMagLevel(param.cid) * 0.15)
param.healmin = -param.hitmin
param.healmax = -param.hitmax
end
local onPos = param.pos
if param.count > 0 or math.random(0, 1) == 1 then
local creatureToHit = getThingfromPos({x=onPos.x,y=onPos.y,z=onPos.z,stackpos=STACKPOS_TOP_CREATURE})
if isCreature(creatureToHit.uid) == 1 and creatureToHit.uid ~= param.cid then
doCreatureAddHealth(param.cid, math.random(param.healmin, param.healmax+1))
doAreaCombatHealth(param.cid, COMBAT_LIFEDRAIN, param.pos, 0, param.hitmin, param.hitmax, CONST_ME_NONE)
end
end
if(param.count < 30) then
param.count = param.count + 1
addEvent(spellCallbackLifeDrainArea, 500, param)
end
end
end
function onTargetTileLifeDrainArea(cid, pos)
local param = {}
param.cid = cid
param.pos = pos
param.count = 0
spellCallbackLifeDrainArea(param)
end
setCombatCallback(combat, CALLBACK_PARAM_TARGETTILE, "onTargetTileLifeDrainArea")
function onCastSpell(cid, var)
return doCombat(cid, combat, var)
end
Code:
<instant name="Xena" words="exori xena" lvl="10" mana="250" prem="1" range="7" blockwalls="1" needtarget="1" exhaustion="2000" needlearn="0" script="custom/xena.lua">
<vocation name="Royal Paladin"/>
</instant>
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, TRUE)
local condition = createConditionObject(CONDITION_PARALYZE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 3000)
setConditionFormula(condition, -0.3, 0, -0.3, 0)
setCombatCondition(combat, condition)
function getSpellDamageXena(cid, weaponSkill, weaponAttack, attackStrength)
local attack = 35 --Spear's attack
local skill = getPlayerSkill(cid, CONST_SKILL_DISTANCE)
local maxWeaponDamage = (skill * attack) / 20 + attack
local damage = -((math.random(0, maxWeaponDamage) * attackStrength) / 20) * 0.8 --0.8 is the multiplier
return damage, damage --The random part of the formula has already been made, just return the normal damage
end
function xenaHit(param)
if isCreature(param.cid) == TRUE and isCreature(variantToNumber(param.var)) == TRUE then
doSendDistanceShoot(param.fromcidpos, getCreaturePosition(variantToNumber(param.var)), CONST_ANI_LARGEROCK)
doCombat(param.cid, param.combat, param.var)
param.fromcidpos = getCreaturePosition(variantToNumber(param.var))
table.insert(param.notHitCidArray, variantToNumber(param.var))
param.count = param.count + 1
if (param.lastshot == 0) then
local enemies = getMonstersInArea3(param.fromcidpos, param.notHitCidArray)
if (enemies.number > 0) and (param.count < 8) then
local enemiesList = enemies.list
local randenemy = math.random(1, enemies.number)
param.var = numberToVariant(enemiesList[randenemy])
else
param.var = numberToVariant(param.cid)
param.lastshot = 1
end
addEvent(xenaHit, 200, param)
end
end
end
setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "getSpellDamageXena")
function onCastSpell(cid, var)
if(variantToNumber(var) ~= 0) then
if isCreature(variantToNumber(var)) == TRUE then
local param = {}
param.cid = cid
param.fromcidpos = getCreaturePosition(cid)
param.var = var
param.combat = combat
param.count = 0
param.lastshot = 0
param.notHitCidArray = {cid}
addEvent(xenaHit, 1, param)
end
end
return true
end
Code:
<instant name="Light Chain" words="exevo vis mas" lvl="10" mana="1200" prem="1" range="7" blockwalls="1" needtarget="1" exhaustion="3000" needlearn="0" script="custom/lightchain.lua">
<vocation name="Master Sorcerer"/>
<vocation name="Elder Druid"/>
</instant>
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
local condition = createConditionObject(CONDITION_PARALYZE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 3000)
setConditionFormula(condition, -0.2, 0, -0.2, 0)
setCombatCondition(combat, condition)
local combatSmall = createCombatObject()
setCombatParam(combatSmall, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
function getSpellDamageLightChain(cid, level, maglevel)
local damage = -math.floor(((math.random(200, 400) * level) + (math.random(200, 300) * maglevel)) / 100)
return damage, damage --The random part of the formula has already been made, just return the normal damage
end
function getSpellDamageLightChainSmall(cid, level, maglevel)
local damage = -math.floor(((math.random(200, 400) * level) + (math.random(200, 300) * maglevel)) / 400)
return damage, damage --The random part of the formula has already been made, just return the normal damage
end
function lightChainHit(param)
if isCreature(param.cid) == TRUE and isCreature(variantToNumber(param.var)) == TRUE then
doSendDistanceShoot(param.fromcidpos, getCreaturePosition(variantToNumber(param.var)), CONST_ANI_HOLY)
doCombat(param.cid, param.combat, param.var)
param.fromcidpos = getCreaturePosition(variantToNumber(param.var))
param.count = param.count + 1
local enemies = getMonstersInArea3(param.fromcidpos, param.notHitCidArray)
if (enemies.number > 0) and (param.count < 5) then
local enemiesList = enemies.list
local randenemy = math.random(1, enemies.number)
param.var = numberToVariant(enemiesList[randenemy])
table.insert(param.notHitCidArray, variantToNumber(param.var))
local subenemies = getMonstersInArea1(param.fromcidpos, param.notHitCidArray)
if (subenemies.number > 0) then
local nearenemieslist = subenemies.list
for i = 1, subenemies.number do
doCombat(param.cid, param.combatSmall, numberToVariant(nearenemieslist[i]))
doSendDistanceShoot(param.fromcidpos, numberToVariant(nearenemieslist[i]), CONST_ANI_ENERGY)
end
end
addEvent(lightChainHit, 200, param)
end
end
end
setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "getSpellDamageLightChain")
setCombatCallback(combatSmall, CALLBACK_PARAM_LEVELMAGICVALUE, "getSpellDamageLightChainSmall")
function onCastSpell(cid, var)
if(variantToNumber(var) ~= 0) then
if isCreature(variantToNumber(var)) == TRUE then
local param = {}
param.cid = cid
param.fromcidpos = getCreaturePosition(cid)
param.var = var
param.combat = combat
param.combatSmall = combatSmall
param.count = 0
param.lastshot = 0
param.notHitCidArray = {cid, variantToNumber(var)}
addEvent(lightChainHit, 50, param)
end
end
return true
end
Code:
function getMonstersInArea3(cidpos, notCidArray)
local playernumber = 0
local playersInRange = {}
local pPos = cidpos
local positionsToCheck = {
{x=pPos.x-3,y=pPos.y+3,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x-2,y=pPos.y+3,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x-1,y=pPos.y+3,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x,y=pPos.y+3,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+1,y=pPos.y+3,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+2,y=pPos.y+3,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+3,y=pPos.y+3,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},
{x=pPos.x-3,y=pPos.y+2,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x-2,y=pPos.y+2,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x-1,y=pPos.y+2,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x,y=pPos.y+2,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+1,y=pPos.y+2,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+2,y=pPos.y+2,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+3,y=pPos.y+2,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},
{x=pPos.x-3,y=pPos.y+1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x-2,y=pPos.y+1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x-1,y=pPos.y+1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x,y=pPos.y+1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+1,y=pPos.y+1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+2,y=pPos.y+1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+3,y=pPos.y+1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},
{x=pPos.x-3,y=pPos.y,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x-2,y=pPos.y,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x-1,y=pPos.y,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x,y=pPos.y,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+1,y=pPos.y,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+2,y=pPos.y,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+3,y=pPos.y,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},
{x=pPos.x-3,y=pPos.y-1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x-2,y=pPos.y-1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x-1,y=pPos.y-1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x,y=pPos.y-1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+1,y=pPos.y-1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+2,y=pPos.y-1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+3,y=pPos.y-1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},
{x=pPos.x-3,y=pPos.y-2,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x-2,y=pPos.y-2,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x-1,y=pPos.y-2,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x,y=pPos.y-2,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+1,y=pPos.y-2,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+2,y=pPos.y-2,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+3,y=pPos.y-2,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},
{x=pPos.x-3,y=pPos.y-3,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x-2,y=pPos.y-3,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x-1,y=pPos.y-3,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x,y=pPos.y-3,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+1,y=pPos.y-3,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+2,y=pPos.y-3,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+3,y=pPos.y-3,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE}
}
for i = 1, table.maxn(positionsToCheck) do
local creatureToHit = getThingfromPos(positionsToCheck[i])
if getTilePzInfo(positionsToCheck[i]) == 0 then
if isCreature(creatureToHit.uid) == TRUE and creatureToHit.uid ~= cid and isInArray(notCidArray, creatureToHit.uid) ~= TRUE then
table.insert(playersInRange, creatureToHit.uid)
playernumber = playernumber + 1
end
end
end
return {list = playersInRange, number = playernumber}
end
function getMonstersInArea1(cidpos, notCidArray)
local playernumber = 0
local playersInRange = {}
local pPos = cidpos
local positionsToCheck = {
{x=pPos.x-1,y=pPos.y+1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x,y=pPos.y+1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+1,y=pPos.y+1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},
{x=pPos.x-1,y=pPos.y,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x,y=pPos.y,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+1,y=pPos.y,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},
{x=pPos.x-1,y=pPos.y-1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x,y=pPos.y-1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},{x=pPos.x+1,y=pPos.y-1,z=pPos.z,stackpos=STACKPOS_TOP_CREATURE},
}
for i = 1, table.maxn(positionsToCheck) do
local creatureToHit = getThingfromPos(positionsToCheck[i])
if getTilePzInfo(positionsToCheck[i]) == 0 then
if isCreature(creatureToHit.uid) == TRUE and creatureToHit.uid ~= cid and isInArray(notCidArray, creatureToHit.uid) ~= TRUE then
table.insert(playersInRange, creatureToHit.uid)
playernumber = playernumber + 1
end
end
end
return {list = playersInRange, number = playernumber}
end