SHARE
TWEET

Untitled

a guest Jul 16th, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "nw_i0_generic"
  2.  
  3. void main()
  4. {
  5.     // * if not runnning normal or better Ai then exit for performance reasons
  6.     if (GetAILevel() == AI_LEVEL_VERY_LOW) return;
  7.  
  8.     // Buff ourselves up right away if we should
  9.     if(GetSpawnInCondition(NW_FLAG_FAST_BUFF_ENEMY))
  10.     {
  11.         // This will return TRUE if an enemy was within 40.0 m
  12.         // and we buffed ourselves up instantly to respond --
  13.         // simulates a spellcaster with protections enabled
  14.         // already.
  15.         if(TalentAdvancedBuff(40.0))
  16.         {
  17.             // This is a one-shot deal
  18.             SetSpawnInCondition(NW_FLAG_FAST_BUFF_ENEMY, FALSE);
  19.  
  20.             // This return means we skip sending the user-defined
  21.             // heartbeat signal in this one case.
  22.             return;
  23.         }
  24.     }
  25.     else if ( GetWalkCondition(NW_WALK_FLAG_CONSTANT) )
  26.     {
  27.         // If we have the 'constant' waypoints flag set, walk to the next
  28.          //waypoint.
  29.  
  30. //         Only during certain hours of the day
  31.         if(GetTimeHour() == 20 || GetTimeHour() == 8 || GetTimeHour() == 12)
  32.         {
  33.             WalkWayPoints();
  34.         }
  35.     }
  36.  
  37.     if(GetCurrentHitPoints() < GetMaxHitPoints() && GetIsInCombat() == FALSE)
  38.     {
  39.         // Rest and recharge
  40.         ActionRest();
  41.  
  42.         SetSpawnInCondition(NW_FLAG_FAST_BUFF_ENEMY, TRUE);
  43.     }
  44.  
  45.     // Hold an Umbrella for the weather conditions
  46.     if(GetWeather(GetArea(OBJECT_SELF)) == WEATHER_RAIN || GetWeather(GetArea(OBJECT_SELF)) == WEATHER_SNOW)
  47.     {
  48.         // Do we have an umbrella in the inventory already?
  49.         if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF, "ZEP_UMBRELLA")) == TRUE ||
  50.         GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF, "Umbrella")) == TRUE ||
  51.         GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF, "Umbrella3")) == TRUE)
  52.         {
  53.             // Already have an umbrella, do I have it equipped?
  54.             object oUmbrella = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND);
  55.  
  56.             if(GetTag(oUmbrella) == "ZEP_UMBRELLA" ||
  57.             GetTag(oUmbrella) == "Umbrella" ||
  58.             GetTag(oUmbrella) == "Umbrella3")
  59.             {
  60.                // I already have it, so I'm happy; do nothing else
  61.             }
  62.             else
  63.             {
  64.                 // I have an umbrella, but I need to equip it only if I'm not in combat
  65.                 if(GetIsInCombat() == FALSE)
  66.                 {
  67.                     if(d3() == 3 && GetGender(OBJECT_SELF) == GENDER_FEMALE) { SpeakString("*Oh My Hair*"); }
  68.                     if(d3() == 3 && GetGender(OBJECT_SELF) == GENDER_MALE) { SpeakString("*Darn Weather*"); }
  69.  
  70.                     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF, "ZEP_UMBRELLA")) == TRUE)
  71.                     {
  72.                         oUmbrella = GetItemPossessedBy(OBJECT_SELF, "ZEP_UMBRELLA");
  73.                         ClearAllActions();
  74.                         ActionEquipItem(oUmbrella, INVENTORY_SLOT_RIGHTHAND);
  75.                         return;
  76.                     }
  77.  
  78.                     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF, "Umbrella")) == TRUE)
  79.                     {
  80.                         oUmbrella = GetItemPossessedBy(OBJECT_SELF, "Umbrella");
  81.                         ClearAllActions();
  82.                         ActionEquipItem(oUmbrella, INVENTORY_SLOT_RIGHTHAND);
  83.                         return;
  84.                     }
  85.  
  86.                     if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF, "Umbrella3")) == TRUE)
  87.                     {
  88.                         oUmbrella = GetItemPossessedBy(OBJECT_SELF, "Umbrella3");
  89.                         ClearAllActions();
  90.                         ActionEquipItem(oUmbrella, INVENTORY_SLOT_RIGHTHAND);
  91.                         return;
  92.                     }
  93.                 }
  94.             }
  95.         }
  96.         else
  97.         {
  98.             // Don't have one, so create one on me, I'll put in on next heartbeat
  99.             switch(d3())
  100.             {
  101.                 case 1:
  102.                 CreateItemOnObject("umbrella");
  103.                 break;
  104.  
  105.                 case 2:
  106.                 CreateItemOnObject("zep_umbrella");
  107.                 break;
  108.  
  109.                 case 3:
  110.                 CreateItemOnObject("umbrella003");
  111.                 break;
  112.             }
  113.         }
  114.     }
  115.     else
  116.     {
  117.         // It's clear again, so take off the umbrella so we don't look silly
  118.         object oUmbrella = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND);
  119.  
  120.         if(GetTag(oUmbrella) == "ZEP_UMBRELLA" ||
  121.         GetTag(oUmbrella) == "Umbrella" ||
  122.         GetTag(oUmbrella) == "Umbrella3")
  123.         {
  124.             ClearAllActions();
  125.             ActionUnequipItem(oUmbrella);
  126.         }
  127.     }
  128.  
  129.     // Send the user-defined event signal if specified
  130.     if(GetSpawnInCondition(NW_FLAG_HEARTBEAT_EVENT))
  131.     {
  132.         SignalEvent(OBJECT_SELF, EventUserDefined(EVENT_HEARTBEAT));
  133.     }
  134. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top