Script: Poisfood

From Ultima Online: The Second Age
Revision as of 17:46, 5 October 2018 by Grimoric (talk | contribs) (Created page with " <span style="color:#0000FF">trigger</span> use { <span style="color:#0000FF">int</span> Q4AY = ([[getObjVar|<span style="color:#FF0000;font-weight:bold">getObjVar</span>]...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
trigger use
{
  int Q4AY = (getObjVar(this, "poison_chance"));
  if (Q4AY == 0x00)
  {
    Q4AY = 0x32;
  }
  if (random(0x00, 0x64) < Q4AY)
  {
    int strength = (getObjVar(this, "poison_strength"));
    if ((!hasObjVar(user, "poison_strength")) && (!hasScript(user, "poisoned")))
    {
      if (strength < 0x01)
      {
        strength = 0x01;
      }
      if (strength > 0x05)
      {
        strength = 0x05;
      }
      setObjVar(user, "poison_strength", strength);
      attachScript(user, "poisoned");
      receiveUnhealthyActionFrom(user, this);
      systemMessage(user, "That " + getName(this) + " was poisoned!");
    }
  }
  setDefaultReturn(0x01);
  detachscript(this, "poisfood");
  return (0x01);
}