No categories assigned

LUA:GetSpawn

Revision as of 17:45, 11 September 2013 by Jabantiz (talk | contribs) (Created page with "= LUA Functions: GetSpawn() = Gets a spawn by the given spawn id. ==== Syntax ==== var = GetSpawn(param1, param2) ==== Parameters ==== ; Required - ''param1'' (Spawn), ''para...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

LUA Functions: GetSpawn()

Gets a spawn by the given spawn id.


Syntax

var = GetSpawn(param1, param2)


Parameters

Required - param1 (Spawn), param2 (int32)
param1 is a known spawn in the same zone, usually the player
param2 is DB id of the spawn you want


Usage

function hailed(NPC, Spawn)
    local spawn2 = GetSpawn(Spawn, 1234)
    local distance = GetDistance(Spawn, Spawn2)
    Say(NPC, "Distance to spawn: " .. distance)
end

The NPC will respond with the distance to the closest spawn to the player with an id of 1234

Notes

Returns a spawn

Gets the closest spawn to the spawn given as the first param