Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "nw_i0_generic"
- void main()
- {
- // * if not runnning normal or better Ai then exit for performance reasons
- if (GetAILevel() == AI_LEVEL_VERY_LOW) return;
- // Buff ourselves up right away if we should
- if(GetSpawnInCondition(NW_FLAG_FAST_BUFF_ENEMY))
- {
- // This will return TRUE if an enemy was within 40.0 m
- // and we buffed ourselves up instantly to respond --
- // simulates a spellcaster with protections enabled
- // already.
- if(TalentAdvancedBuff(40.0))
- {
- // This is a one-shot deal
- SetSpawnInCondition(NW_FLAG_FAST_BUFF_ENEMY, FALSE);
- // This return means we skip sending the user-defined
- // heartbeat signal in this one case.
- return;
- }
- }
- else if ( GetWalkCondition(NW_WALK_FLAG_CONSTANT) )
- {
- // If we have the 'constant' waypoints flag set, walk to the next
- //waypoint.
- // Only during certain hours of the day
- if(GetTimeHour() == 20 || GetTimeHour() == 8 || GetTimeHour() == 12)
- {
- WalkWayPoints();
- }
- }
- if(GetCurrentHitPoints() < GetMaxHitPoints() && GetIsInCombat() == FALSE)
- {
- // Rest and recharge
- ActionRest();
- SetSpawnInCondition(NW_FLAG_FAST_BUFF_ENEMY, TRUE);
- }
- // Hold an Umbrella for the weather conditions
- if(GetWeather(GetArea(OBJECT_SELF)) == WEATHER_RAIN || GetWeather(GetArea(OBJECT_SELF)) == WEATHER_SNOW)
- {
- // Do we have an umbrella in the inventory already?
- if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF, "ZEP_UMBRELLA")) == TRUE ||
- GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF, "Umbrella")) == TRUE ||
- GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF, "Umbrella3")) == TRUE)
- {
- // Already have an umbrella, do I have it equipped?
- object oUmbrella = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND);
- if(GetTag(oUmbrella) == "ZEP_UMBRELLA" ||
- GetTag(oUmbrella) == "Umbrella" ||
- GetTag(oUmbrella) == "Umbrella3")
- {
- // I already have it, so I'm happy; do nothing else
- }
- else
- {
- // I have an umbrella, but I need to equip it only if I'm not in combat
- if(GetIsInCombat() == FALSE)
- {
- if(d3() == 3 && GetGender(OBJECT_SELF) == GENDER_FEMALE) { SpeakString("*Oh My Hair*"); }
- if(d3() == 3 && GetGender(OBJECT_SELF) == GENDER_MALE) { SpeakString("*Darn Weather*"); }
- if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF, "ZEP_UMBRELLA")) == TRUE)
- {
- oUmbrella = GetItemPossessedBy(OBJECT_SELF, "ZEP_UMBRELLA");
- ClearAllActions();
- ActionEquipItem(oUmbrella, INVENTORY_SLOT_RIGHTHAND);
- return;
- }
- if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF, "Umbrella")) == TRUE)
- {
- oUmbrella = GetItemPossessedBy(OBJECT_SELF, "Umbrella");
- ClearAllActions();
- ActionEquipItem(oUmbrella, INVENTORY_SLOT_RIGHTHAND);
- return;
- }
- if(GetIsObjectValid(GetItemPossessedBy(OBJECT_SELF, "Umbrella3")) == TRUE)
- {
- oUmbrella = GetItemPossessedBy(OBJECT_SELF, "Umbrella3");
- ClearAllActions();
- ActionEquipItem(oUmbrella, INVENTORY_SLOT_RIGHTHAND);
- return;
- }
- }
- }
- }
- else
- {
- // Don't have one, so create one on me, I'll put in on next heartbeat
- switch(d3())
- {
- case 1:
- CreateItemOnObject("umbrella");
- break;
- case 2:
- CreateItemOnObject("zep_umbrella");
- break;
- case 3:
- CreateItemOnObject("umbrella003");
- break;
- }
- }
- }
- else
- {
- // It's clear again, so take off the umbrella so we don't look silly
- object oUmbrella = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND);
- if(GetTag(oUmbrella) == "ZEP_UMBRELLA" ||
- GetTag(oUmbrella) == "Umbrella" ||
- GetTag(oUmbrella) == "Umbrella3")
- {
- ClearAllActions();
- ActionUnequipItem(oUmbrella);
- }
- }
- // Send the user-defined event signal if specified
- if(GetSpawnInCondition(NW_FLAG_HEARTBEAT_EVENT))
- {
- SignalEvent(OBJECT_SELF, EventUserDefined(EVENT_HEARTBEAT));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement