Difference between revisions of "Script Function: Q46J"

From Ultima Online: The Second Age
Jump to: navigation, search
(Created page with " <span style="color:#0000FF">function</span> <span style="color:#0000FF">int</span> Q46J(<span style="color:#0000FF">obj</span> user, <span style="color:#0000FF">obj</span> Q...")
 
 
Line 1: Line 1:
 +
  <span style="color:#0000FF">function</span> <span style="color:#0000FF">int</span> Q46J(<span style="color:#0000FF">obj</span> user, <span style="color:#0000FF">obj</span> Q66L)
 +
  {
 +
    <span style="color:#0000FF">if</span> ([[Engine Function:_hasObjVar|<span style="color:#FF0000;font-weight:bold">hasObjVar</span>]](Q66L, <span style="color:#800000">"lifeRemaining"</span>))
 +
    {
 +
      <span style="color:#0000FF">int</span> lifeRemaining = [[Engine Function:_getObjVar|<span style="color:#FF0000;font-weight:bold">getObjVar</span>]](Q66L, <span style="color:#800000">"lifeRemaining"</span>);
 +
      <span style="color:#0000FF">if</span> (lifeRemaining > 0x01)
 +
      {
 +
        [[Engine Function:_setObjVar|<span style="color:#FF0000;font-weight:bold">setObjVar</span>]](Q66L, <span style="color:#800000">"lifeRemaining"</span>, (lifeRemaining - 0x01));
 +
      }
 +
      <span style="color:#0000FF">else</span>
 +
      {
 +
        <span style="color:#0000FF">string</span> name = [[Engine Function:_getNameByType|<span style="color:#FF0000;font-weight:bold">getNameByType</span>]]([[Engine Function:_getObjType|<span style="color:#FF0000;font-weight:bold">getObjType</span>]](this));
 +
        [[Engine Function:_systemMessage|<span style="color:#FF0000;font-weight:bold">systemMessage</span>]](user, <span style="color:#800000">"You destroyed the "</span> + name + <span style="color:#800000">"."</span>);
 +
        <span style="color:#0000FF">return</span> (0x01);
 +
      }
 +
    }
 +
    <span style="color:#0000FF">else</span>
 +
    {
 +
      [[Engine Function:_setObjVar|<span style="color:#FF0000;font-weight:bold">setObjVar</span>]](Q66L, <span style="color:#800000">"lifeRemaining"</span>, 0x32);
 +
    }
 +
    <span style="color:#0000FF">return</span> (0x00);
 +
  }
 +
 
   <span style="color:#0000FF">function</span> <span style="color:#0000FF">int</span> Q46J(<span style="color:#0000FF">obj</span> user, <span style="color:#0000FF">obj</span> Q66L)
 
   <span style="color:#0000FF">function</span> <span style="color:#0000FF">int</span> Q46J(<span style="color:#0000FF">obj</span> user, <span style="color:#0000FF">obj</span> Q66L)
 
   {
 
   {

Latest revision as of 05:22, 12 October 2018

 function int Q46J(obj user, obj Q66L)
 {
   if (hasObjVar(Q66L, "lifeRemaining"))
   {
     int lifeRemaining = getObjVar(Q66L, "lifeRemaining");
     if (lifeRemaining > 0x01)
     {
       setObjVar(Q66L, "lifeRemaining", (lifeRemaining - 0x01));
     }
     else
     {
       string name = getNameByType(getObjType(this));
       systemMessage(user, "You destroyed the " + name + ".");
       return (0x01);
     }
   }
   else
   {
     setObjVar(Q66L, "lifeRemaining", 0x32);
   }
   return (0x00);
 }
 function int Q46J(obj user, obj Q66L)
 {
   if (hasObjVar(Q66L, "lifeRemaining"))
   {
     int lifeRemaining = getObjVar(Q66L, "lifeRemaining");
     if (lifeRemaining > 0x01)
     {
       setObjVar(Q66L, "lifeRemaining", (lifeRemaining - 0x01));
     }
     else
     {
       string name = getNameByType(getObjType(this));
       systemMessage(user, "You destroyed the " + name + ".");
       return (0x01);
     }
   }
   else
   {
     setObjVar(Q66L, "lifeRemaining", 0x32);
   }
   return (0x00);
 }