Difference between revisions of "NDDynamicSpawnerHUDVars"

From Legends of Aria Admin and Modding Wiki
Jump to: navigation, search
Line 2: Line 2:
 
<p style="color: #DDDD88;font-size: 22px;width:60%;margin: 0 auto">About HUDVars</p>
 
<p style="color: #DDDD88;font-size: 22px;width:60%;margin: 0 auto">About HUDVars</p>
 
<p style="width: 60%;margin: 0 auto">HudVars is the way to tell the new HUD element what to display when players are near your dynamic spawner. The dynamic window function UpdateDynamicEventHUD is located in the hud.lua here is the function as of P8 release.</p>
 
<p style="width: 60%;margin: 0 auto">HudVars is the way to tell the new HUD element what to display when players are near your dynamic spawner. The dynamic window function UpdateDynamicEventHUD is located in the hud.lua here is the function as of P8 release.</p>
 +
*Title -
 +
*Description -
 +
*EndTime -
 +
*Stage -
 +
*MaxStage -
 +
*Progress -
 
<div style="width:60%;margin: 0 auto">
 
<div style="width:60%;margin: 0 auto">
 
  function UpdateDynamicEventHUD(playerObj,vars)
 
  function UpdateDynamicEventHUD(playerObj,vars)

Revision as of 06:28, 9 December 2019

[Main] [Dynamic Spawners]

About HUDVars

HudVars is the way to tell the new HUD element what to display when players are near your dynamic spawner. The dynamic window function UpdateDynamicEventHUD is located in the hud.lua here is the function as of P8 release.

  • Title -
  • Description -
  • EndTime -
  • Stage -
  • MaxStage -
  • Progress -
function UpdateDynamicEventHUD(playerObj,vars)		
    local title = vars.Title or "Dynamic Event Title"
    local desc = vars.Description or "Dynamic Event Description."
    local endTime = vars.EndTime or nil
    local stage = vars.Stage or 0
    local maxStage = vars.MaxStage or 0
    local progress = vars.Progress or 0
    local dynWindow = DynamicWindow("DynamicEventHUD","",0,0,0,0,"Transparent","Top")
    dynWindow:AddLabel(0,30,title,0,0,24,"center",false,true,"SpectralSC-SemiBold")
    dynWindow:AddLabel(0,50,desc,0,0,18,"center",false,true,"SpectralSC-SemiBold")
    dynWindow:AddLabel(0,65,"["..COLORS.FloralWhite.."]".."Stage: [-]"..stage.." of ".. maxStage,0,0,18,"center",false,true ,"SpectralSC-SemiBold")

    if( endTime ) then
        local timeLeft = TimeSpanToWords(endTime:Subtract(DateTime.UtcNow), nil, {Seconds = true})
        dynWindow:AddLabel(0,80,timeLeft .. " Remaining",0,0,18,"center",false,true,"SpectralSC-SemiBold")
    end

    playerObj:OpenDynamicWindow(dynWindow)
end

function CloseDynamicEventHUD( playerObj )
    playerObj:CloseDynamicWindow("DynamicEventHUD")
end