API:GetZoneObjectivesData
From RoR Wiki
UI Lua API · RvR functions
Version: WAR 1.4.8
Returns the battlefield objectives of a campaign zone with their map positions and timers.
objectives = GetZoneObjectivesData(zoneId)
Arguments
- zoneId
number– Zone id, for exampleGameData.Player.zone.
Returns
- objectives
table– Array of objective tables, indexed from 1, or nothing (see Details).
Each objective table has these fields:
| Key | Type | Meaning |
|---|---|---|
objId |
number |
Objective id. |
objMapTimer |
number |
Timer value of the objective (may be fractional). The stock UI formats it with TimeUtils.FormatClock. -1 if the client has no data for this objective. The stock UI hides the timer when it is not greater than 0.
|
objPositionX |
number |
X coordinate. The stock UI converts it with MapGetPointForCoordinates.
|
objPositionY |
number |
Y coordinate. |
Details
- The function returns nothing when the client has no campaign data at all (no error, argument not checked), or when the zone has no objective list.
- A zone id that is not a campaign zone raises the error below.
- A new table is built on every call.
- The function takes exactly one argument.
Errors
Error in function call 'GetZoneObjectivesData': Zone %d is not a valid campaign zone.
Example
From default/ea_rvrtracker/source/rvrtracker.lua:
local objectivesData = GetZoneObjectivesData( GameData.Player.zone )
if (objectivesData ~= nil)
then
for _, objectivePoint in ipairs(objectivesData)
do
EA_Window_RvRTracker.RefreshObjectiveTimer(objectivePoint.objId, objectivePoint.objMapTimer)
end
end
