You are viewing an old version of this page. Return to the latest version.
Difference between revisions of "LUA:SetLocationProximityFunction"
(→Syntax) |
(fixed spacing) |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
| − | This function sets a location to check when spawns enter a certain range of the location. It calls different functions when that spawn either moves in range or out of range. | + | {{PageHeaderChild|LUA|AddCoin}} |
| + | |||
| + | = LUA Functions: SetLocationProximityFunction() = | ||
| + | This function sets a location to check when spawns enter a certain range of the location. It calls different functions when that spawn either moves in range or out of range. | ||
| + | |||
==== Syntax ==== | ==== Syntax ==== | ||
| − | SetLocationProximityFunction(Zone, X, Y, Z, | + | SetLocationProximityFunction(Zone, X, Y, Z, Radius, "InRange", ["OutRange"]) |
| + | |||
| + | |||
| + | ==== Parameters ==== | ||
| + | ; Required - ''param1'' (Spawn), ''param2'' (int32), ''param3'' (int32), ''param4'' (int32), ''param5'' (int32), ''param6'' (string), ''param7'' (string) | ||
| + | : ''param1'' is Zone | ||
| + | : ''param2'' is the x coordinate | ||
| + | : ''param3'' is the y coordinate | ||
| + | : ''param4'' is the z coordinate | ||
| + | : ''param5'' is the radius | ||
| + | : ''param6'' is a lua call back function for in range | ||
| + | : ''param'' is a lua call back function for out of range | ||
| + | |||
==== Usage ==== | ==== Usage ==== | ||
Latest revision as of 17:40, 18 June 2018
LUA - AddCoin
Return to: LUA | Tutorials | Portal | Forum | Project Manager | Bug Tracker
LUA Functions: SetLocationProximityFunction()
This function sets a location to check when spawns enter a certain range of the location. It calls different functions when that spawn either moves in range or out of range.
Syntax
SetLocationProximityFunction(Zone, X, Y, Z, Radius, "InRange", ["OutRange"])
Parameters
- Required - param1 (Spawn), param2 (int32), param3 (int32), param4 (int32), param5 (int32), param6 (string), param7 (string)
- param1 is Zone
- param2 is the x coordinate
- param3 is the y coordinate
- param4 is the z coordinate
- param5 is the radius
- param6 is a lua call back function for in range
- param is a lua call back function for out of range
Usage
function init_zone_script(Zone)
SetLocationProximityFunction(Zone, -316.244, 35.409, -714.906, 10, "InRange", "OutRange")
end
When a zone script is started init_zone_script is called, which then sets a location of -316.244, 35.409, -714.409. When a spawn moves within 10 meters of that location InRange will be called, when a spawn moves out of range OutRange will be called.