<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE funcs
  SYSTEM '../../../clonk.dtd'>
<?xml-stylesheet type="text/xsl" href="../../../clonk.xsl"?>
<funcs>
  <func>
    <title>SetPhysical</title>
    <category>Objects</category>
    <subcat>Status</subcat>
    <version>5.1 OC</version>
    <syntax>
      <rtype>bool</rtype>
      <params>
        <param>
          <type>string</type>
          <name>physical</name>
          <desc>Name of property to be changed.</desc>
        </param>
        <param>
          <type>int</type>
          <name>value</name>
          <desc>0-100000: new value for the property</desc>
        </param>
        <param>
          <type>int</type>
          <name>mode</name>
          <desc>
            Physical attribute change mode:<br/>
            <table>
              <rowh>
                <col>Constant</col>
                <col>Value</col>
                <col>Meaning</col>
              </rowh>
              <row>
                <col>PHYS_Current</col>
                <col>0</col>
                <col>The physical attributes are changed in the current mode (temporary or permanent) of the object.</col>
              </row>
              <row>
                <col>PHYS_Permanent</col>
                <col>1</col>
                <col>The physical attributes are changed in permanent mode. This modifies the info section of the associated crew object, which means that the changes will be written to the player file as well. Only player crew objects have  a permanent info section.</col>
              </row>
              <row>
                <col>PHYS_Temporary</col>
                <col>2</col>
                <col>The object will be set to temporary physical mode, and a temporary info section will be created if none exists already. Use <funclink>ResetPhysical</funclink> to reset temporary physicals to permanent mode.</col>
              </row>
              <row>
                <col>PHYS_StackTemporary</col>
                <col>3</col>
                <col>Like PHYS_Temporary, but the previous physical-value will be backed up and can be restored by calling <funclink>ResetPhysical</funclink>.</col>
              </row>
            </table>
<br/>
          </desc>
          <optional />
        </param>
      </params>
    </syntax>
    <desc>Changes the physical properties of the object. With this, the values from the Physical section of the <emlink href="definition/DefCore.html">DefCore.txt</emlink> can be permanently or temporarily adapted.</desc>
    <examples>
      <example>
        <code>func ControlUse(object eater)
{
  eater-&gt;SetPhysical(&quot;Energy&quot;, 10000000, PHYS_Temporary);
  eater-&gt;<funclink>DoEnergy</funclink>(1000);
  <funclink>RemoveObject</funclink>();
}</code>
        <text>Steroids - The clonk gains a ridiculous amount of energy for this round on eating.</text>
      </example>
      <example>
        <code>protected func FxJumpBoostStart(object trg, effect, int temporary)
{
  trg-&gt;SetPhysical(&quot;Jump&quot;, trg-&gt;<funclink>GetPhysical</funclink>(&quot;Jump&quot;, PHYS_Current) + 10000, PHYS_StackTemporary);
  <funclink>return</funclink> FX_OK;
}
		
protected func FxJumpBoostStop(object trg, effect, int reason, bool tmp)
{
  trg-&gt;<funclink>ResetPhysical</funclink>(&quot;Jump&quot;);
  <funclink>return</funclink> FX_OK;
}</code>
        <text>Script of an effect named JumpBoost: If created on a Clonk, it can jump higher until the effect is deleted again. Using PHYS_StackTemporary and <funclink>ResetPhysical</funclink> in this manner ensures that multiple effects written in this style can be combined without causing unwanted behaviour when one effect wears off while another remains.</text>
      </example>
    </examples>
    <related>
      <emlink href="definition/DefCore.html#SektionPhysical">DefCore.txt, [Physical]</emlink>
      <funclink>GetPhysical</funclink>
      <funclink>ResetPhysical</funclink>
      <funclink>TrainPhysical</funclink>
    </related>
  </func>
  <author>Sven2</author><date>2003-06</date>
</funcs>
