Difference between revisions of "GetCurrentHealth"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>WereWolf
(Add example)
imported>Ketoleperouch
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
A command for [[:Category:Oblivion Script Extender|Oblivion Script Extender]]
A command for [[:Category:Oblivion Script Extender|Oblivion Script Extender]]
'''Syntax:'''
(health:float) ''reference.''GetCurrentHealth


Returns the current health of the calling reference.
Returns the current health of the calling reference.


'''Syntax:'''
(health:float) ''reference.''GetCurrentHealth
'''Example:'''
'''Example:'''
ref Base
  ref Weapon
  ref Weapon
  float WeaponHealth
  float WeaponHealth
  set Weapon to player.[[GetEquippedObject]] 16
  array_var InvRefs
  set WeaponHealth to Weapon.GetCurrentHealth
let Base := ( PlayerRef.[[GetEquippedObject]] 16 )
  ForEach InvRefs <- ( [[GetInvRefsForItem]] Base )
  let Weapon := *InvRefs
  if [[Eval]] ( Weapon.[[IsEquipped]] )
  let WeaponHealth := ( Weapon.GetCurrentHealth )
  endif
Loop
Get the current health of the player's equipped weapon.
Get the current health of the player's equipped weapon.
Not recommanded if you're only interested in the health of the currently equipped weapon. Use [[GetEquippedCurrentHealth]] instead which is faster than creating [http://www.obse.silverlock.org/obse_command_doc.html#Inventory_Reference Inventory References] for the currently equipped Weapon, and looping through all of them afterwards.
== See Also ==
*[[SetCurrentHealth]]


[[Category:Functions]]
[[Category:Functions]]

Latest revision as of 11:06, 12 July 2015

A command for Oblivion Script Extender

Syntax:

(health:float) reference.GetCurrentHealth

Returns the current health of the calling reference.

Example:

ref Base
ref Weapon
float WeaponHealth
array_var InvRefs
let Base := ( PlayerRef.GetEquippedObject 16 )
ForEach InvRefs <- ( GetInvRefsForItem Base )
 let Weapon := *InvRefs
 if Eval ( Weapon.IsEquipped )
  let WeaponHealth := ( Weapon.GetCurrentHealth )
 endif
Loop

Get the current health of the player's equipped weapon. Not recommanded if you're only interested in the health of the currently equipped weapon. Use GetEquippedCurrentHealth instead which is faster than creating Inventory References for the currently equipped Weapon, and looping through all of them afterwards.

See Also[edit | edit source]