OsSetHealth

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
m (Added note stating which version of OpenSim introduced this function)
m (Change See Also)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{osslfunc
 
{{osslfunc
 
|threat_level=High
 
|threat_level=High
|permissions=${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER
+
|permissions=${OSSL|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER
 
|delay=0
 
|delay=0
|function_syntax=void osSetHealth(string avatar, float health)
+
|function_syntax= osSetHealth(key avatar, float health)
 +
|description=Sets an avatars health by key to the specified float value.
 
|ossl_example=<source lang="lsl">
 
|ossl_example=<source lang="lsl">
 +
//
 +
// osSetHealth Script Example
 +
// Author: djphil
 +
//
 +
 
default
 
default
 
{
 
{
     touch(integer t)
+
    state_entry()
 +
    {
 +
        llSay(PUBLIC_CHANNEL, "Touch to see osSetHealth usage.");
 +
    }
 +
 
 +
     touch(integer number)
 
     {
 
     {
 
         key agentID = llDetectedKey(0);
 
         key agentID = llDetectedKey(0);
         osSetHealth(agentID, 50);
+
         osSetHealth(agentID, 50.0);
         llSay(0, llKey2Name(agentID) + " has " + (string)osGetHealth(agentID) + "% health left.");
+
         llSay(PUBLIC_CHANNEL, llKey2Name(agentID) + " has " + (string)osGetHealth(agentID) + "% health left.");
 
     }
 
     }
 
}
 
}
 
</source>
 
</source>
|description=Sets an avatars health by key to the specified float value.
+
|additional_info=This function was added in 0.9.0.1
 
+
See also [[osGetHealth]], [[OsCauseDamage]], [[OsCauseHealing]].
+
|additional_info=This function was added in 0.9.0-post-fixes
+
 
}}
 
}}
 +
== See Also ==
 +
* [[osGetHealth]]
 +
* [[osSetHealth]]
 +
* [[osGetHealRate]]
 +
* [[osSetHealRate]]
 +
* [[OsCauseDamage]]
 +
* [[OsCauseHealing]]

Latest revision as of 19:49, 5 December 2020

osSetHealth(key avatar, float health)
Sets an avatars health by key to the specified float value.
Threat Level High
Permissions ${OSSL|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER
Extra Delay 0 seconds
Example(s)
//
// osSetHealth Script Example
// Author: djphil
//
 
default
{
    state_entry()
    {
        llSay(PUBLIC_CHANNEL, "Touch to see osSetHealth usage.");
    }
 
    touch(integer number)
    {
        key agentID = llDetectedKey(0);
        osSetHealth(agentID, 50.0);
        llSay(PUBLIC_CHANNEL, llKey2Name(agentID) + " has " + (string)osGetHealth(agentID) + "% health left.");
    }
}
Notes
This function was added in 0.9.0.1


[edit] See Also

Personal tools
General
About This Wiki