Difference between revisions of "LUA:GetHP"

(New page: = LUA Functions: GetCurrentHP(param) = Returns the current '''current hit points''' of ''param''. The parameter can be either a player or the NPC currently being interacted with. [[Devel...)
 
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
= LUA Functions: GetCurrentHP(param) =
+
== LUA Functions: GetHP(param) ==
 
 
 
Returns the current '''current hit points''' of ''param''. The parameter can be either a player or the NPC currently being interacted with.
 
Returns the current '''current hit points''' of ''param''. The parameter can be either a player or the NPC currently being interacted with.
 
[[Developer:LUA_Functions | Back to LUA]]
 
  
  
== Syntax ==
 
var = GetCurrentHP(param)
 
  
Must be a reference to a player or NPC.
+
=== Syntax ===
 +
var = GetHP(param)
  
  
== Parameters ==
+
=== Parameters ===
Required:  
+
Required: ''param'' (int)
''param'' (int) usually "NPC" or "Spawn"
 
  
  
== Type ==
+
=== Notes ===
SpawnScripts
+
''param'' must be one of the vars in the function params. In the example above, it would be either "NPC" or "Spawn"
  
  
== Usage ==
+
=== Usage ===
 
   function hailed(NPC, Spawn)
 
   function hailed(NPC, Spawn)
     Say(NPC, "Your current hit points are " .. GetCurrentHP(Spawn) .. "!")
+
     Say(NPC, "Your current hit points are " .. GetHP(Spawn) .. "! Very impressive!")
 
   end
 
   end
  
 
This makes the NPC respond to the player who hails it with the players current hit points.
 
This makes the NPC respond to the player who hails it with the players current hit points.

Latest revision as of 16:19, 17 October 2012

LUA Functions: GetHP(param)

Returns the current current hit points of param. The parameter can be either a player or the NPC currently being interacted with.


Syntax

var = GetHP(param)


Parameters

Required: param (int)


Notes

param must be one of the vars in the function params. In the example above, it would be either "NPC" or "Spawn"


Usage

 function hailed(NPC, Spawn)
   Say(NPC, "Your current hit points are " .. GetHP(Spawn) .. "! Very impressive!")
 end

This makes the NPC respond to the player who hails it with the players current hit points.