Script Function: Q4E8

From Ultima Online: The Second Age
Jump to: navigation, search
 function void Q4E8(obj user, obj Q66M, int Q4QY, string name)
 {
   if (isAtHome(this))
   {
     systemMessage(user, "You can't use that, it belongs to someone else.");
     return ();
   }
   int Q66P = getObjType(Q66M);
   if (Q4Z2(Q66P))
   {
     if (!testSkill(user, 0x0D))
     {
       systemMessage(user, "You burn the food to a crisp! It's ruined.");
       destroyOne(this);
       return ();
     }
     if (name != "default")
     {
       if (hasObjVar(this, "NAME"))
       {
         removeObjVar(this, "NAME");
         setObjVar(this, "NAME", name);
       }
     }
     if (random(0x00, 0x01))
     {
       barkTo(user, user, "Looks delicious.");
     }
     else
     {
       barkTo(user, user, "Mmmm, smells good.");
     }
     obj Q47F = getBackpack(user);
     int Q4TM;
     obj Q5CN = createGlobalObjectOn(this, Q4QY);
     if (!isInContainer(this))
     {
       if (canHold(Q47F, Q5CN))
       {
         Q4TM = putObjContainer(Q5CN, Q47F);
         systemMessage(user, "You put the cooked food into your backpack.");
       }
       else
       {
         Q4TM = teleport(Q5CN, getLocation(user));
         systemMessage(user, "You put the cooked food on the ground.");
       }
     }
     destroyOne(this);
   }
   else
   {
     systemMessage(user, "You can't cook on that.");
   }
   return ();
 }