Script Function: Q4TC

From Ultima Online: The Second Age
Jump to: navigation, search
 function loc Q4TC(obj user, loc place)
 {
   loc Q4OT = 0x00, 0x00, (0x00 - 0x80);
   if (!isInMap(place))
   {
     return (Q4OT);
   }
   int Q4OU = 0x00;
   if (getDistanceInTiles(getLocation(user), place) > 0x0B)
   {
     systemMessage(user, "That location is too far away");
     Q4OU = 0x01;
   }
   if (!Q4OU && (getEncumbrance(user) > 0x64))
   {
     systemMessage(user, "Thou art too encumbered to move.");
     Q4OU = 0x01;
   }
   if (!Q4OU && (canSeeLoc(user, place) != 0x01))
   {
     systemMessage(user, "Target cannot be seen.");
     Q4OU = 0x01;
   }
   if (!Q4OU)
   {
     loc target = place;
     list Q5HS;
     getMobsAt(Q5HS, target);
     int Q4XW = getHeight(user);
     int Q48V = getZ(target);
     int Q63L = Q48V + 0x08;
     int Q4U1 = findGoodZ(target, Q48V, Q63L, Q4XW, 0x01);
     setZ(target, Q4U1);
     if (Q4U1 == (0x00 - 0x80))
     {
       systemMessage(user, "Cannot teleport to that spot.");
       return (Q4OT);
     }
     if ((0x07 == canExistAt(target, Q4XW, 0x01)) && (!Q4ZQ(target)))
     {
       if (0x00 == numInList(Q5HS))
       {
         if (Q46G(target, 0x05))
         {
           systemMessage(user, "Cannot teleport to that spot.");
           return (Q4OT);
         }
         return (target);
       }
       else
       {
         systemMessage(user, "Someone is standing there!");
         return (Q4OT);
       }
     }
     else
     {
       systemMessage(user, "Cannot teleport to that spot.");
       return (Q4OT);
     }
   }
   return (Q4OT);
 }