Script Function: Q4ET

From Ultima Online: The Second Age
Revision as of 22:25, 11 October 2018 by Grimoric (talk | contribs) (Created page with " <span style="color:#0000FF">function</span> <span style="color:#0000FF">void</span> Q4ET(<span style="color:#0000FF">obj</span> Q5KS, <span style="color:#0000FF">int</span>...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
 function void Q4ET(obj Q5KS, int Q5D9)
 {
   if (hasObjVar(Q5KS, "questReward"))
   {
     return ();
   }
   obj reward = NULL();
   int success = 0x00;
   switch (Q5D9)
   {
   default
   case 0x00
     break;
   case 0x01
     reward = requestCreateObjectAt(0x0EED, getLocation(Q5KS));
     if (reward != NULL())
     {
       success = requestAddQuantity(reward, random(0x64, 0x01F4));
     }
     if (!success)
     {
       deleteObject(reward);
       Q4ET(Q5KS, 0x00);
       return ();
     }
     break;
   case 0x02
     reward = requestCreateObjectAt(0x0EED, getLocation(Q5KS));
     if (reward != NULL())
     {
       success = requestAddQuantity(reward, random(0x0190, 0x0320));
     }
     if (!success)
     {
       deleteObject(reward);
       Q4ET(Q5KS, 0x01);
       return ();
     }
     break;
   case 0x03
     reward = requestCreateObjectAt(0x0EED, getLocation(Q5KS));
     if (reward != NULL())
     {
       success = requestAddQuantity(reward, random(0x0320, 0x05DC));
     }
     if (!success)
     {
       deleteObject(reward);
       Q4ET(Q5KS, 0x02);
       return ();
     }
     break;
   }
   if (reward != NULL())
   {
     success = putObjContainer(reward, this);
   }
   setObjVar(Q5KS, "questReward", reward);
   return ();
 }