Jump to content

Recommended Posts

Posted

I'm trying to display a units health via a message to the user. Here's what I got::

 

local unt = Unit.getLife0("uArmor")

trigger.action.outText("Armor Health:" .. unt, 10)

Posted

getLife0 returns the initial life of the unit not the current life like Unit.getLife() does.

 

local tank = Unit.getByName('tank1')

local life = tank:getLife()/tank:getLife0()

trigger.action.outText('Armor Health: " .. life, 10)

  • Like 1

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Posted

That worked perfectly. Thank you very much. Small syntax correction below on the last line changing " to '.

 

local tank = Unit.getByName('tank1')
local life = tank:getLife()/tank:getLife0()
trigger.action.outText('Armor Health: ' .. life, 10)

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...