Difference between revisions of "Script: Gm"

From Ultima Online: The Second Age
Jump to: navigation, search
 
Line 30: Line 30:
 
   {
 
   {
 
   <span style="color:#0000FF">case</span> 0x00
 
   <span style="color:#0000FF">case</span> 0x00
     [[guildName|<span style="color:#2B91AF">guildName</span>]] = <span style="color:#800000">"Default Guild of Superheroic Non-Player Characters"</span>;
+
     guildName = <span style="color:#800000">"Default Guild of Superheroic Non-Player Characters"</span>;
 
     <span style="color:#0000FF">break</span>;
 
     <span style="color:#0000FF">break</span>;
 
   <span style="color:#0000FF">case</span> 0x01
 
   <span style="color:#0000FF">case</span> 0x01
     [[guildName|<span style="color:#2B91AF">guildName</span>]] = <span style="color:#800000">"Guild of Arcane Arts"</span>;
+
     guildName = <span style="color:#800000">"Guild of Arcane Arts"</span>;
 
     <span style="color:#0000FF">break</span>;
 
     <span style="color:#0000FF">break</span>;
 
   <span style="color:#0000FF">case</span> 0x02
 
   <span style="color:#0000FF">case</span> 0x02
     [[guildName|<span style="color:#2B91AF">guildName</span>]] = <span style="color:#800000">"Warrior's Guild"</span>;
+
     guildName = <span style="color:#800000">"Warrior's Guild"</span>;
 
     <span style="color:#0000FF">break</span>;
 
     <span style="color:#0000FF">break</span>;
 
   <span style="color:#0000FF">case</span> 0x03
 
   <span style="color:#0000FF">case</span> 0x03
     [[guildName|<span style="color:#2B91AF">guildName</span>]] = <span style="color:#800000">"Society of Thieves"</span>;
+
     guildName = <span style="color:#800000">"Society of Thieves"</span>;
 
     <span style="color:#0000FF">break</span>;
 
     <span style="color:#0000FF">break</span>;
 
   <span style="color:#0000FF">case</span> 0x04
 
   <span style="color:#0000FF">case</span> 0x04
     [[guildName|<span style="color:#2B91AF">guildName</span>]] = <span style="color:#800000">"League of Rangers"</span>;
+
     guildName = <span style="color:#800000">"League of Rangers"</span>;
 
     <span style="color:#0000FF">break</span>;
 
     <span style="color:#0000FF">break</span>;
 
   <span style="color:#0000FF">case</span> 0x05
 
   <span style="color:#0000FF">case</span> 0x05
     [[guildName|<span style="color:#2B91AF">guildName</span>]] = <span style="color:#800000">"Guild of Healers"</span>;
+
     guildName = <span style="color:#800000">"Guild of Healers"</span>;
 
     <span style="color:#0000FF">break</span>;
 
     <span style="color:#0000FF">break</span>;
 
   <span style="color:#0000FF">case</span> 0x06
 
   <span style="color:#0000FF">case</span> 0x06
     [[guildName|<span style="color:#2B91AF">guildName</span>]] = <span style="color:#800000">"Mining Cooperative"</span>;
+
     guildName = <span style="color:#800000">"Mining Cooperative"</span>;
 
     <span style="color:#0000FF">break</span>;
 
     <span style="color:#0000FF">break</span>;
 
   <span style="color:#0000FF">case</span> 0x07
 
   <span style="color:#0000FF">case</span> 0x07
     [[guildName|<span style="color:#2B91AF">guildName</span>]] = <span style="color:#800000">"Merchants' Association"</span>;
+
     guildName = <span style="color:#800000">"Merchants' Association"</span>;
 
     <span style="color:#0000FF">break</span>;
 
     <span style="color:#0000FF">break</span>;
 
   <span style="color:#0000FF">case</span> 0x08
 
   <span style="color:#0000FF">case</span> 0x08
     [[guildName|<span style="color:#2B91AF">guildName</span>]] = <span style="color:#800000">"Order of Engineers"</span>;
+
     guildName = <span style="color:#800000">"Order of Engineers"</span>;
 
     <span style="color:#0000FF">break</span>;
 
     <span style="color:#0000FF">break</span>;
 
   <span style="color:#0000FF">case</span> 0x09
 
   <span style="color:#0000FF">case</span> 0x09
     [[guildName|<span style="color:#2B91AF">guildName</span>]] = <span style="color:#800000">"Society of Clothiers"</span>;
+
     guildName = <span style="color:#800000">"Society of Clothiers"</span>;
 
     <span style="color:#0000FF">break</span>;
 
     <span style="color:#0000FF">break</span>;
 
   <span style="color:#0000FF">case</span> 0x0A
 
   <span style="color:#0000FF">case</span> 0x0A
     [[guildName|<span style="color:#2B91AF">guildName</span>]] = <span style="color:#800000">"Maritime Guild"</span>;
+
     guildName = <span style="color:#800000">"Maritime Guild"</span>;
 
     <span style="color:#0000FF">break</span>;
 
     <span style="color:#0000FF">break</span>;
 
   <span style="color:#0000FF">case</span> 0x0B
 
   <span style="color:#0000FF">case</span> 0x0B
     [[guildName|<span style="color:#2B91AF">guildName</span>]] = <span style="color:#800000">"Bardic Collegium"</span>;
+
     guildName = <span style="color:#800000">"Bardic Collegium"</span>;
 
     <span style="color:#0000FF">break</span>;
 
     <span style="color:#0000FF">break</span>;
 
   <span style="color:#0000FF">default</span>
 
   <span style="color:#0000FF">default</span>
     [[guildName|<span style="color:#2B91AF">guildName</span>]] = <span style="color:#800000">"Default Guild of Superheroic Non-Player Characters"</span>;
+
     guildName = <span style="color:#800000">"Default Guild of Superheroic Non-Player Characters"</span>;
 
     <span style="color:#0000FF">break</span>;
 
     <span style="color:#0000FF">break</span>;
 
   }
 
   }
Line 145: Line 145:
 
     <span style="color:#0000FF">if</span> (Q618 == <span style="color:#800000">"guild"</span> || (Q618 == <span style="color:#800000">"guilds"</span>))
 
     <span style="color:#0000FF">if</span> (Q618 == <span style="color:#800000">"guild"</span> || (Q618 == <span style="color:#800000">"guilds"</span>))
 
     {
 
     {
       Q58D = <span style="color:#800000">"I am a Guildmaster of the "</span> + [[guildName|<span style="color:#2B91AF">guildName</span>]] + <span style="color:#800000">". Art thou interested in joining?"</span>
+
       Q58D = <span style="color:#800000">"I am a Guildmaster of the "</span> + guildName + <span style="color:#800000">". Art thou interested in joining?"</span>
 
       );
 
       );
 
       [[Engine Function:_bark|<span style="color:#FF0000;font-weight:bold">bark</span>]](this, Q58D);
 
       [[Engine Function:_bark|<span style="color:#FF0000;font-weight:bold">bark</span>]](this, Q58D);
Line 177: Line 177:
 
     Q4Q1 = [[Engine Function:_putObjContainer|<span style="color:#FF0000;font-weight:bold">putObjContainer</span>]](givenobj, this);
 
     Q4Q1 = [[Engine Function:_putObjContainer|<span style="color:#FF0000;font-weight:bold">putObjContainer</span>]](givenobj, this);
 
     [[Engine Function:_deleteObject|<span style="color:#FF0000;font-weight:bold">deleteObject</span>]](givenobj);
 
     [[Engine Function:_deleteObject|<span style="color:#FF0000;font-weight:bold">deleteObject</span>]](givenobj);
     <span style="color:#0000FF">string</span> Q58D = <span style="color:#800000">"Welcome to the "</span> + [[guildName|<span style="color:#2B91AF">guildName</span>]] + <span style="color:#800000">"!"</span>;
+
     <span style="color:#0000FF">string</span> Q58D = <span style="color:#800000">"Welcome to the "</span> + guildName + <span style="color:#800000">"!"</span>;
 
     Q608 = [[Engine Function:_getObjVar|<span style="color:#FF0000;font-weight:bold">getObjVar</span>]](this, <span style="color:#800000">"guildMember"</span>);
 
     Q608 = [[Engine Function:_getObjVar|<span style="color:#FF0000;font-weight:bold">getObjVar</span>]](this, <span style="color:#800000">"guildMember"</span>);
 
     <span style="color:#0000FF">if</span> (Q608 == 0x03)
 
     <span style="color:#0000FF">if</span> (Q608 == 0x03)

Latest revision as of 17:09, 19 October 2018

inherits human;
trigger objectloaded
{
  callBack(this, 0x64, 0x60);
  return (0x01);
}
trigger creation
{
  int Q608;
  member string guildName;
  member int Q59L;
  loc Q4VS = getLocation(this);
  setObjVar(this, "myGuildLocation", Q4VS);
  setLoiterMode(this, 0x01);
  goLoiter(this, Q4VS, 0x03E8);
  callBack(this, 0x64, 0x60);
  setBehavior(this, 0x02);
  if (hasObjVar(this, "guildMember"))
  {
    Q608 = getObjVar(this, "guildMember");
  }
  if (!Q608)
  {
    setObjVar(this, "guildMember", 0x00);
  }
  Q59L = Q608;
  switch (Q608)
  {
  case 0x00
    guildName = "Default Guild of Superheroic Non-Player Characters";
    break;
  case 0x01
    guildName = "Guild of Arcane Arts";
    break;
  case 0x02
    guildName = "Warrior's Guild";
    break;
  case 0x03
    guildName = "Society of Thieves";
    break;
  case 0x04
    guildName = "League of Rangers";
    break;
  case 0x05
    guildName = "Guild of Healers";
    break;
  case 0x06
    guildName = "Mining Cooperative";
    break;
  case 0x07
    guildName = "Merchants' Association";
    break;
  case 0x08
    guildName = "Order of Engineers";
    break;
  case 0x09
    guildName = "Society of Clothiers";
    break;
  case 0x0A
    guildName = "Maritime Guild";
    break;
  case 0x0B
    guildName = "Bardic Collegium";
    break;
  default
    guildName = "Default Guild of Superheroic Non-Player Characters";
    break;
  }
  return (0x00);
}
trigger callback(0x60)
{
  if (hasObjVar(this, "myGuildLocation"))
  {
    loc there = getObjVar(this, "myGuildLocation");
    if (getDistanceInTiles(getLocation(this), there) > 0x0A)
    {
      int Q4EL = teleport(this, there);
    }
  }
  callBack(this, 0x64, 0x60);
  return (0x01);
}
trigger pathnotfound(0x06)
{
  if (!hasObjVar(this, "myGuildLocation"))
  {
    return (0x00);
  }
  loc place = getObjVar(this, "myGuildLocation");
  int Q4Q1 = teleport(this, place);
  return (0x00);
}
trigger speech("*")
{
  string Q618;
  list args;
  int Q608;
  string Q58D;
  if (!Q4J8(this, speaker, arg))
  {
    return (0x01);
  }
  split(args, arg);
  for(int i = 0x00; i < numInList(args); i++)
  {
    Q618 = args[i];
    if (Q618 == "join" || (Q618 == "member"))
    {
      if (hasObjVar(speaker, "guildMember"))
      {
        Q608 = getObjVar(speaker, "guildMember");
        if (Q608 != Q59L)
        {
          bark(this, "Thou must resign from thy other guild first.");
          return (0x00);
        }
        bark(this, "Thou art already a member of our guild.");
        return (0x00);
      }
      bark(this, "The fee for joining a guild is 500 gold coins.");
      setObjVar(speaker, "guildAskedToJoin", this);
      return (0x00);
    }
    if (Q618 == "resign" || (Q618 == "quit"))
    {
      if (hasObjVar(speaker, "guildMember"))
      {
        Q608 = getObjVar(speaker, "guildMember");
        if (Q608 != Q59L)
        {
          bark(this, "Thou dost not belong to my guild!");
          return (0x00);
        }
        bark(this, "I accept thy resignation.");
        removeObjVar(speaker, "guildMember");
        return (0x00);
      }
    }
    if (Q618 == "guild" || (Q618 == "guilds"))
    {
      Q58D = "I am a Guildmaster of the " + guildName + ". Art thou interested in joining?"
      );
      bark(this, Q58D);
      return (0x00);
    }
  }
  return (0x01);
}
trigger give
{
  int Q608;
  if (hasObjVar(giver, "guildAskedToJoin"))
  {
    obj Q68T = getObjVar(giver, "guildAskedToJoin");
    if (Q68T != this)
    {
      return (0x01);
    }
    int value;
    int Q4Q1;
    Q4Q1 = getResource(value, givenobj, "gold", 0x03, 0x02);
    if (!Q4Q1)
    {
      return (0x01);
    }
    if (value != 0x01F4)
    {
      return (0x01);
    }
    Q4Q1 = putObjContainer(givenobj, this);
    deleteObject(givenobj);
    string Q58D = "Welcome to the " + guildName + "!";
    Q608 = getObjVar(this, "guildMember");
    if (Q608 == 0x03)
    {
      Q58D = Q58D + " Fellow thieves and beggars shall not bother thee now.";
    }
    else
    {
      Q58D = Q58D + " Thou shalt find that fellow members shall grant thee lower prices in shops.";
    }
    bark(this, Q58D);
    setObjVar(giver, "guildMember", Q608);
    return (0x00);
  }
  return (0x01);
}