OsSetHealRate

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(Created page with "{{osslfunc |threat_level=High |function_syntax=float osSetHealRate(key avatar, float healrate) |ossl_example=<source lang="lsl"> key uuid; default { state_entry() { ...")
 
Line 3: Line 3:
 
|function_syntax=float osSetHealRate(key avatar, float healrate)
 
|function_syntax=float osSetHealRate(key avatar, float healrate)
 
|ossl_example=<source lang="lsl">
 
|ossl_example=<source lang="lsl">
key uuid;
+
//
 +
// osSetHealth Script Exemple
 +
//
  
 
default
 
default
Line 9: Line 11:
 
     state_entry()
 
     state_entry()
 
     {
 
     {
         llSay(PUBLIC_CHANNEL, "Script running");
+
         key uuid = llGetOwner();
    }
+
         osSetHealRate(uuid, 10.0);
 
+
         osCauseDamage(uuid, 50.0);
    touch_start(integer number)
+
         llOwnerSay("osGetHealRate = " + (string)osGetHealRate(uuid));
    {
+
         llOwnerSay(llKey2Name(uuid) + " has " + (string)osGetHealth(uuid) + "% health left.");
        uuid = llDetectedKey(0);
+
         llOwnerSay("osGetHealRate Before = " + (string)osGetHealRate(uuid));
+
         osSetHealRate(uuid, llFrand(1.0));
+
         llOwnerSay("osGetHealRate After = " + (string)osGetHealRate(uuid));
+
         llSetTimerEvent(5.0);
+
    }
+
 
+
    timer()
+
    {
+
        llSetTimerEvent(0.0);
+
        osSetHealRate(uuid, 0.5);
+
        llOwnerSay("osGetHealRate Default = " + (string)osGetHealRate(uuid));
+
 
     }
 
     }
 
}
 
}

Revision as of 05:45, 15 April 2017

float osSetHealRate(key avatar, float healrate)
Sets the automatic healing rate in % per second.

Default heal rate is now around 0.5% per second.
A value of zero can disable automatic heal, current maximum value is 100 % per second.

See also OsGetHealRate, OsGetHealth, OsCauseDamage, OsCauseHealing.

Threat Level High
Permissions No permissions specified
Extra Delay No function delay specified
Example(s)
//
// osSetHealth Script Exemple
//
 
default
{
    state_entry()
    {
        key uuid = llGetOwner();
        osSetHealRate(uuid, 10.0);
        osCauseDamage(uuid, 50.0);
        llOwnerSay("osGetHealRate = " + (string)osGetHealRate(uuid));
        llOwnerSay(llKey2Name(uuid) + " has " + (string)osGetHealth(uuid) + "% health left.");
    }
}
Personal tools
General
About This Wiki