Difference between revisions of "Script: Witness"

From Ultima Online: The Second Age
Jump to: navigation, search
(Created page with " <span style="color:#0000FF">inherits</span> globals; <span style="color:#0000FF">function</span> <span style="color:#0000FF">void</span> cleanup() { removeObjVar|...")
 
Line 31: Line 31:
 
     [[Engine Function:_callGuards|<span style="color:#FF0000;font-weight:bold">callGuards</span>]](criminal, victim, Q5RN);
 
     [[Engine Function:_callGuards|<span style="color:#FF0000;font-weight:bold">callGuards</span>]](criminal, victim, Q5RN);
 
   }
 
   }
   [[cleanup|<span style="color:#2B91AF">cleanup</span>]]();
+
   [[Script_Function:_cleanup|<span style="color:#2B91AF">cleanup</span>]]();
 
   <span style="color:#0000FF">return</span> ();
 
   <span style="color:#0000FF">return</span> ();
 
  }
 
  }
Line 49: Line 49:
 
  <span style="color:#0000FF">trigger</span> callback(0x58)
 
  <span style="color:#0000FF">trigger</span> callback(0x58)
 
  {
 
  {
   [[cleanup|<span style="color:#2B91AF">cleanup</span>]]();
+
   [[Script_Function:_cleanup|<span style="color:#2B91AF">cleanup</span>]]();
 
   <span style="color:#0000FF">return</span> (0x01);
 
   <span style="color:#0000FF">return</span> (0x01);
 
  }
 
  }

Revision as of 08:31, 19 October 2018

inherits globals;
function void cleanup()
{
  removeObjVar(this, "lastCriminal");
  removeObjVar(this, "lastVictim");
  removeObjVar(this, "crimeSeverity");
  removeObjVar(this, "crimeLocation");
  detachScript(this, "witness");
  return ();
}
function void Q49H()
{
  loc Q4F5 = getObjVar(this, "crimeLocation");
  obj criminal = getObjVar(this, "lastCriminal");
  if (getDistanceInTiles(getLocation(this), Q4F5) > 0x19)
  {
    if (isValid(criminal))
    {
      if (getDistanceInTiles(getLocation(this), getLocation(criminal)) > 0x19)
      {
        return ();
      }
    }
  }
  if (isValid(criminal))
  {
    obj victim = getObjVar(this, "lastVictim");
    int Q5RN = getObjVar(this, "crimeSeverity");
    callGuards(criminal, victim, Q5RN);
  }
  cleanup();
  return ();
}
trigger creation
{
  callback(this, 0x1E, 0x58);
  return (0x00);
}
trigger speech("*guard*")
{
  Q49H();
  return (0x00);
}
trigger callback(0x58)
{
  cleanup();
  return (0x01);
}