Difference between revisions of "Script: Bountymark"

From Ultima Online: The Second Age
Jump to: navigation, search
(Created page with " <span style="color:#0000FF">inherits</span> sk_table; <span style="color:#0000FF">trigger</span> creation { <span style="color:#0000FF">if</span> (0x00) { [...")
 
 
Line 90: Line 90:
 
   <span style="color:#0000FF">if</span> ([[Engine Function:_giveItem|<span style="color:#FF0000;font-weight:bold">giveItem</span>]](attacker, head) == [[Engine Function:_NULL|<span style="color:#FF0000;font-weight:bold">NULL</span>]]())
 
   <span style="color:#0000FF">if</span> ([[Engine Function:_giveItem|<span style="color:#FF0000;font-weight:bold">giveItem</span>]](attacker, head) == [[Engine Function:_NULL|<span style="color:#FF0000;font-weight:bold">NULL</span>]]())
 
   {
 
   {
     <span style="color:#0000FF">int</span> Q4TR = [[teleport|<span style="color:#FF0000;font-weight:bold">teleport</span>]](head, [[Engine Function:_getLocation|<span style="color:#FF0000;font-weight:bold">getLocation</span>]](attacker));
+
     <span style="color:#0000FF">int</span> Q4TR = [[Engine Function:_teleport|<span style="color:#FF0000;font-weight:bold">teleport</span>]](head, [[Engine Function:_getLocation|<span style="color:#FF0000;font-weight:bold">getLocation</span>]](attacker));
 
   }
 
   }
 
   [[Engine Function:_setObjVar|<span style="color:#FF0000;font-weight:bold">setObjVar</span>]](head, <span style="color:#800000">"bountyObjID"</span>, this);
 
   [[Engine Function:_setObjVar|<span style="color:#FF0000;font-weight:bold">setObjVar</span>]](head, <span style="color:#800000">"bountyObjID"</span>, this);

Latest revision as of 07:42, 19 October 2018

inherits sk_table;
trigger creation
{
  if (0x00)
  {
    bark(this, "I am now bounty hunted!");
  }
  return (0x01);
}
function int Q4S2(obj killer)
{
  if (!hasObjListVar(killer, "killcount"))
  {
    return (0x00);
  }
  list Q51M;
  getObjListVar(Q51M, killer, "killcount");
  return (numInList(Q51M));
}
trigger time("hour:12")
{
  if (!hasObjListVar(this, "killcount"))
  {
    return (0x01);
  }
  list Q51M;
  getObjListVar(Q51M, this, "killcount");
  removeObjVar(this, "killcount");
  removeItem(Q51M, 0x01);
  if (numInList(Q51M) > 0x00)
  {
    setObjVar(this, "killcount", Q51M);
  }
  if (0x00)
  {
    bark(this, "Reducing bounty count.");
  }
  return (0x01);
}
function void Q5HL(obj Q5HY)
{
  if (0x00)
  {
    bark(Q5HY, "Penalizing stats.");
  }
  for(int i = 0x00; i < 0x2E; i++)
  {
    loseSkillLevel(Q5HY, i, (getSkillLevel(Q5HY, i) / 0x0A));
  }
  int Q4Q1;
  for(i = 0x00; i < 0x03; i++)
  {
    Q4Q1 = modifyRealStat(Q5HY, i, (0x00 - getRealStat(Q5HY, i) / 0x0A));
  }
  removeObjVar(Q5HY, "killcount");
  return ();
}
trigger death
{
  if (!isPlayer(attacker))
  {
    return (0x01);
  }
  if (getNotorietyLevel(attacker) < 0x01)
  {
    if (0x00)
    {
      bark(this, "Killer must be above neutral to collect bounty.");
    }
    return (0x01);
  }
  if (Q4S2(attacker) >= Q4S2(this))
  {
    if (0x00)
    {
      bark(this, "You have a higher killcount than the victim and cannot claim the bounty.");
    }
    return (0x01);
  }
  obj head;
  barkTo(attacker, attacker, "As you kill them, you realize there is a bounty on their head! You take the head as evidence of your victory.");
  head = createGlobalObjectIn(0x1DA0, this);
  string Q65L = "the head of " + getName(this);
  setObjVar(head, "lookAtText", Q65L);
  if (giveItem(attacker, head) == NULL())
  {
    int Q4TR = teleport(head, getLocation(attacker));
  }
  setObjVar(head, "bountyObjID", this);
  setObjVar(head, "bountyClaimant", attacker);
  Q5HL(this);
  shortCallback(this, 0x7F, 0x01);
  return (0x01);
}
trigger callback(0x7F)
{
  detachScript(this, "bountymark");
  return (0x01);
}