Difference between revisions of "SetItemHealthPercent - ObjectReference"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Sagitarius22
(Created page with "Category:Scripting Category:Papyrus Category:SKSE '''SKSE Member of:''' ObjectReference Script This Function will set a ObjectReference's health (tempering st...")
 
imported>Rasikko
 
Line 13: Line 13:
== Parameters ==
== Parameters ==
* health - The amount, as a float you wish to set the Object's health to.
* health - The amount, as a float you wish to set the Object's health to.
1.0 will set the item to the "not tempered" state; 1.6 is seems to be Legendary. Values below 1.0 do nothing.
See [[GetItemHealthPercent - ObjectReference]] for values to use and what they correspond to.


== Examples ==
== Examples ==

Latest revision as of 02:43, 1 December 2017

SKSE Member of: ObjectReference Script

This Function will set a ObjectReference's health (tempering state) to the specified amount. Works on weapons and armours, including clothes and rings.

Syntax[edit | edit source]

Function SetItemHealthPercent(Float health) native

Parameters[edit | edit source]

  • health - The amount, as a float you wish to set the Object's health to.

See GetItemHealthPercent - ObjectReference for values to use and what they correspond to.

Examples[edit | edit source]

ObjectReference Property weaponRef Auto
Float currenthealth

Function TemperWeapon(float tempering)
	currenthealth = weaponRef.GetItemHealthPercent()
	weaponref.SetItemHealthPercent(currenthealth +tempering)
EndFunction
  • Do note that this will only work on a weapon/armour that is currently loaded and not in a container.

Notes[edit | edit source]

  • This function can only be run on items outside of containers, as when they are put into containers member functions cannot be called on them.

See Also[edit | edit source]