Skip to content

Metatable:Position

Stefan A. Brannfjell edited this page Jan 8, 2018 · 9 revisions

No description available at the moment.

Available methods:

getDistance(positionEx)
isSightClear(positionEx[, sameFloor = true])
isInRange(from, to)
sendDistanceEffect(positionEx, distanceEffect, player = nil)
sendMagicEffect(magicEffect[, player = nil])


getDistance(positionEx)

Description: N/A
Parameters:

  • positionEx - No description
Returns: N/A
Example:
local position = Position(...)
position:getDistance(Position())

Added in version: 1.0


isSightClear(positionEx[, sameFloor = true])

Description: N/A
Parameters:

  • positionEx - No description
  • sameFloor - (optional, default: true)
Returns: N/A
Example:
local position = Position(...)
position:isSightClear(Position(), true)

Added in version: 1.0


isInRange(from, to)

Description: Checks if current position is inside the specified range from and to.
Parameters:

  • from - Position object or table
  • to - Position object or table
Returns: Boolean: true/false
Example:
-- Sample #1:
local position = Position(...)
if position:isInRange({x=100, y=100, z=6}, {x=200, y=200, z=8}) then
    -- Position is inside
end

-- Sample #2:
local zone = {
    from = Position(100, 100, 6),
    to = Position(200, 200, 8)
}

local playerpos = player:getPosition()
if playerpos:isInRange(zone.from, zone.to) then
    -- Player is in the zone
end

Added in version: 1.3


sendDistanceEffect(positionEx, distanceEffect[, player = nil])

Description: N/A
Parameters:

  • positionEx - Other Position object or table
  • distanceEffect
  • player - (optional, default: nil)
Returns: N/A
Example:
local position = Position(...)
position:sendDistanceEffect(Position(), CONST_ANI_ARROW, nil)

Added in version: 1.0


sendMagicEffect(magicEffect[, player = nil])

Description: N/A
Parameters:

Returns: N/A
Example:
local position = Position(...)
position:sendMagicEffect(CONST_ME_POFF, nil)

Added in version: 1.0

Clone this wiki locally