Difference between revisions of "GetCurrentHealth"

Jump to navigation Jump to search
197 bytes removed ,  11:13, 10 April 2011
no edit summary
imported>DragoonWraith
imported>Low Post
Line 1: Line 1:
{{errors}}
A command for [[:Category:Oblivion Script Extender|Oblivion Script Extender]]
A command for [[:Category:Oblivion Script Extender|Oblivion Script Extender]]


Line 8: Line 7:


'''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 )
<s>Get the current health of the player's equipped weapon.</s><br />
  ForEach InvRefs <- ( [[GetInvRefsForItem]] Base )
'''This does not work.''' [[GetEquippedObject]] returns a Base-Object, ''not'' a Reference. There is a very important difference.
  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 wich 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.


This page needs to be updated to explain that, and to provide a good example of how this function ''would'' be used. I don't have the time at the moment.
== See Also ==
 
*[[SetCurrentHealth]]
For those who are wondering, [[GetFirstRef]]/[[GetNextRef]] would be an excellent way to get references for use with this.<br />
[[User:DragoonWraith|<span style="font-family: Oblivion, Daedric Runes; size=2;">D</span>ragoon <span style="font-family: Oblivion, Daedric Runes; size=2;">W</span>raith]] [[User_talk:DragoonWraith|<span style="font-family: Oblivion, Daedric Runes; size=2;">TALK</span>]] 00:06, 8 December 2008 (EST)


[[Category:Functions]]
[[Category:Functions]]
Anonymous user

Navigation menu