• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua How to send effect

Sigoles

Discord: @sigoles
Joined
Nov 20, 2015
Messages
1,209
Solutions
2
Reaction score
154
I wanted to send effect in a square area, like the function to check if the player is in that area:

isInRange(player: getPosition (), Position (30525, 30297, 4), Position (30531, 30303, 4))

a function that had effect in that entire area


how I can do it?

Tried:

LUA:
local EffectsArea = isInRange(player: getPosition (), Position (33525, 32297, 4), Position (33531, 32303, 4))
EffectsArea:sendMagicEffect(CONST_ME_TELEPORT)



tfs 1.3
 
Solution
Is in range is a boolean function = true or false.
I guess the easiest way would be to use ex:
LUA:
local position = player:getPosition()
local array = {
    Position(position.x + 1, position,y, position.z),
    Position(position.x - 1, position,y, position.z)
}

for i = 1, #array do
    array[i]:sendMagicEffect(effect_id)
end
Is in range is a boolean function = true or false.
I guess the easiest way would be to use ex:
LUA:
local position = player:getPosition()
local array = {
    Position(position.x + 1, position,y, position.z),
    Position(position.x - 1, position,y, position.z)
}

for i = 1, #array do
    array[i]:sendMagicEffect(effect_id)
end
 
Solution
LUA:
local pos1 = Position(30525, 30297, 4)
local pos2 = Position(30531, 30303, 4)
local pos = Position() -- don't edit this
for x = pos1.x, pos2.x do
    for y = pos1.y, pos2.y do
        pos.x = x
        pos.y = y
        pos.z = 4
        pos:sendMagicEffect(CONST_ME_TELEPORT)
    end
end
 
Back
Top