• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Game.getSpectators, custom area instead of square

Ahilphino

Excellent OT User
Joined
Jun 5, 2013
Messages
1,667
Solutions
1
Reaction score
734
Ok so I was wondering if there is any good way to make game.GetSpectators return an area like this for example?
Let's say I have this: Game.getSpectators(playerpos, false, false, 3, 3, 3, 3) and I want getSpectators to only read an area like in the gif, what would be the best way to achieve that?
EZiyxK2MU.gif


So far I have 2 ideas:

1. I have tried comparing posistions but i can't fkin get it to work or even understand how to do it nicely

2. Maybe I could use multiple game.getSpectators somehow and insert them into the same table (idk how to do that)? I guess that could work too
 
Code:
function onTargetCreature(creature, target)
    print(string.format("Caster name: %s, Target name: %s.", creature:getName(), target:getName()))
    return true
end

local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat:setArea(createCombatArea(AREA_CIRCLE3X3))
combat:setCallback(CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")

function onCastSpell(creature, variant)
    return combat:execute(creature, variant)
end
 
Back
Top