Blizzard Sector
Anyone have or can make this script? - Printable Version

+- Blizzard Sector (https://www.blizzsector.co)
+-- Forum: Diablo II (https://www.blizzsector.co/forum-4.html)
+--- Forum: Hacks Bots and Editors (https://www.blizzsector.co/forum-16.html)
+--- Thread: Anyone have or can make this script? (/thread-47331.html)



Anyone have or can make this script? - Pauluk1986 - 05-14-2011

For the bot to do cow runs skipping cow king ofc Smile

Thanks in adv


Anyone have or can make this script? - skidude - 05-15-2011

First off i would like to say this is not my script and i don't know who the maker is since its been posted on so many sites.

This script would be best used by a lightning char, Cause hammers might kill the king
#1 open notepad.
#2 copy the script below into notepad
#3 save the script into your bots folder \\scripts\NTBot\bots and name NTCow.ntj
#4 open your character config \\scripts\NTBot\char_configs
#5 add this to your character config under boss config

Code:
NTConfig_Script.push("NTCow.ntj"); NTConfig_KillRakanishuCows = true; NTConfig_TristExtension = false;


add this to the notepad and name it NTCow.ntj
Code:
// D2NT Cow script
// Version 1.4.1
//--- CONFIG ---
const  _NTR_FAIL_CHECKS = 25; // Number of failed teleports before script  ends. Ex. Edge of map causes a fail teleport. DEFAULT: 25
const _NTR_PRE_EVERY = 40; // Number of seconds before precasting again. -1 for never. DEFAULT: 40
const _NTR_CHEST_AND_ROCKS = true; // Open chest and rocks. DEFAULT: true
//--- END ---

const _NTR_STRING_PORTAL = GetLocaleString(3226);

function NTMain()
{
   Include("libs/common/NTCommon.ntl");
   NTC_IncludeLibs();
   NTC_IncludeConfig("NTBot/char_configs");
   NT_LoadConfig();
   NTSI_LoadNIPFiles("NTBot/item_configs");
   NTA_Initialize();
   if(!NTTM_CheckAct())
   {
      NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_CheckAct()");
      return;
   }
   NTTMGR_TownManager();
  
   var _wirtbody, _cube, _leg, _portal, _stash, _items, i, _npc, prearea;

   for (i = 0; i < 10; i++)
   {
      _leg = NTC_FindUnit(NTC_UNIT_ITEM, 88);
      if (_leg)
      break;
   }
   if (!_leg)
   {
      if(!NTTM_TownMove("waypoint"))
      {
         NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_TownMove()");
         return;
      }
      if(!NTM_TakeWaypoint(4))
      {
         NTC_SendMsgToScript("NTBotGame.ntj", "NTM_TakeWaypoint()");
         return;
      }
      NTP_DoPrecast(true);
      if(!NTM_MoveToPresetUnit(me.areaid, NTC_UNIT_MONSTER, 737, 10, 10))
      {
         NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveToPresetUnit()");
         return;
      }
      if(NTConfig_KillRakanishuCows)
      {
         if(!NTTMGR_CheckSafe(0x00, NTConfig_CheckMercSafe&0x01))
         {
            NTC_SendMsgToScript("NTBotGame.ntj", "NTTMGR_CheckSafe()");
            return;
         }
         if(NTA_KillMonster(GetLocaleString(2872)))
         {
            if(NTConfig_ClearPosition)
               NTA_ClearPosition();
            NTSI_PickItems();
         }
      }
      if(!NTM_UsePortal("Portal", 38))
      {
         NTC_SendMsgToScript("NTBotGame.ntj", "NTM_UsePortal()");
         return;
      }
      if(NTConfig_TristExtension)
      {
         if(!NTA_ClearLevel())
         {
            NTC_SendMsgToScript("NTBotGame.ntj", "NTA_ClearLevel()");
         }
      }
      NTM_MoveTo(me.areaid, 25047, 5178);
      if(NTA_ClearPosition(10))
         NTSI_PickItems();
      _wirtbody = NTC_FindUnit(NTC_UNIT_OBJECT, 268);
      if(!_wirtbody)
      {
         NTC_SendMsgToScript("NTBotGame.ntj", "Wirt's body not found.");
         return;
      }
      if(NTM_MoveTo(_wirtbody.areaid, _wirtbody.x+3, _wirtbody.y))
      {
         if(NTC_OpenChest(_wirtbody))
         {
            NTC_PingDelay(500);
            for (i = 0; i < 10; i++)
            {
               _leg = NTC_FindUnit(NTC_UNIT_ITEM, 88);
               if (_leg)
                  break;
            }
            if(!NTT_CheckSpace(_leg.xsize, _leg.ysize))
            {
               _prearea = me.areaid;
               if(NTTM_CheckAct())
               {
                  NTTMGR_TownManager(true);
                  NTTM_TownMove("portalspot")
                  NTM_UsePortal("BluePortal", _prearea)
               }
            }
            for (i = 0; i < 20; i++)
            {
               if ((i % 5) == 0)
               {
                  if (_leg.mode == 3 || _leg.mode == 5)
                  {
                     if (NTC_ClearCursor())
                        NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _leg);
                  }
               }
               NTC_PingDelay(100);
               if (_leg.mode != 3 && _leg.mode != 5)
               {
                  Print("ÿc4Got Leg");
                  NTC_PingDelay(200);
                  break;
               }
            }
         }
      }
      if(!_leg)
      {
         NTC_SendMsgToScript("NTBotGame.ntj", "No leg found.");
         return;
      }
      NTM_MakeTP();
      NTM_UsePortal("BluePortal");
   }
   else
   {
      if(!NTT_CheckSpace(_leg.xsize, _leg.ysize))
      {
         _prearea = me.areaid;
         if(NTTM_CheckAct())
         {
            NTTMGR_TownManager(true);
            NTTM_TownMove("portalspot")
            NTM_UsePortal("BluePortal", _prearea)
         }
      }
      for (i = 0; i < 20; i++)
      {
         if ((i % 5) == 0)
         {
            if (_leg.mode == 3 || _leg.mode == 5)
            {
               if (NTC_ClearCursor())
                  NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _leg);
            }
         }
         NTC_PingDelay(100);
         if (_leg.mode != 3 && _leg.mode != 5)
         {
            Print("ÿc4Who caries a leg around?");
            NTC_PingDelay(200);
            Print("ÿc4Dude, thats sick.");
            break;
         }
      }
   }
    NTTM_TownMove("akara");
    for(var i = 0 ; i < 10 ; i++)
    {
        _npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_AKARA);
        if(_npc)
         break;
    }
    if(_npc)
    {
        if(NTT_DoInteract(_npc))
        {
            if(NTT_DoTrade(_npc))
            {
            _NTR_DoID = NTT_CheckUnids();
            if(_NTR_DoID)
               NTTMGR_IDItems(_npc);
            NTT_FillTome(_npc, 1);
            NTT_FillTome(_npc, 0);
            NTT_SecondTomeTP(_npc, "tbk", 1);
            _portal = NTR_GetTP();
            if(!_portal)
            {
               NTC_SendMsgToScript("NTBotGame.ntj", "No extra tome of townportal found.");
               return;
            }
            }
        }
        me.Cancel(1);
    }
    NTTM_TownMove("stash");
    for(var i = 0 ; i < 10 ; i++)
    {
        _stash = NTC_FindUnit(NTC_UNIT_OBJECT, NTC_UNIT_STASH);
        if(_stash)
         break;
   }
    if(NTT_DoInteract(_stash))
    {
        _items = me.GetItems(NTC_UNIT_CUBE);
        _cube = _items[0];
        if(!_cube)
        {
            NTC_SendMsgToScript("NTBotGame.ntj", "No cube found.");
         return;
        }
        if(NTCU_CheckCubeInventoryInt() > 0)
        {
            NTCU_OpenCubeInt(_cube)
            if(NTCU_ClearCubeInt() < 1)
            {
            NTC_SendMsgToScript("NTBotGame.ntj", "Cube cannot be emptied.");
            return;
         }
         NTCU_CloseCubeInt();
        }
        NTCU_MoveItemToCubeInt(_cube,_leg)
        NTCU_MoveItemToCubeInt(_cube,_portal)
        NTCU_OpenCubeInt(_cube);
        Transmute();
        NTCU_CloseCubeInt();
        me.Cancel(1);
    }
    NTC_PingDelay(500);
    if(!NTR_TakeCowPortal(18))
    {
        NTC_SendMsgToScript("NTBotGame.ntj", "Failed to take Cow Portal.");
        return;
    }
    NTP_DoPrecast();
    NTR_ClearRooms();
   NTC_SendMsgToScript("NTBotGame.ntj", "SCRIPT_END");
}

// Internal functions
function NTR_GetTP()
{
   var _portals = me.GetItems("tbk");
  
   if (_portals)
   {
      for (var i = 0; i < _portals.length; i++)
      {
          if (_portals[i].mode == 0 && (_portals[i].itemloc != 0  || NTConfig_Columns[_portals[i].y][_portals[i].x] > 0))
         {
            return _portals[i];
         }
      }
   }
   return false;
}
function abs(integer)
{
   if(integer < 0){
      integer = -integer;
   }
   return integer;
}
function NTR_TakeCowPortal(range)
{
   var _portal = NTC_FindUnit(NTC_UNIT_OBJECT, _NTR_STRING_PORTAL);
  
   if (_portal)
   {
      var _isClick;
      var _preAreaId = me.areaid;
      do
      {
         if (GetDistance(me, _portal) < range && _portal.mode == 2)
         {
            for (var i = 0; i < 40; i++)
            {
               if ((i % 10) == 0)
               {
                  if(NTM_GetCloserInt(_portal))
                     _isClick = NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _portal);
               }
               if (_isClick)
               {
                  NTC_Delay(200);
                  break;
               }
            }
            NTC_PingDelay(1000);
            var j = 0;
            var check = true;
            do
            {
               if (me.areaid != _preAreaId)
               {
                  NTC_PingDelay(500);
                  return true;
                  check = false;
               }
               j++;
            } while(j < 40 && check == true);
         }
      } while (_portal.GetNext());
   }
   return false;
}
function NTR_ClearPosition(range, pickitem, safelevel, failed)
{
   var _orgx, _orgy;
   var _spectype = [0x0A, 0x01, 0x01];
   var _skiplist;
   var _attackcount = 0;
   var _target;
   var _distance, _mingid, _mindistance;
   var _result;
   var _cowKing;
   var _test;

   if(NTConfig_AttackSkill[1] < 1 || NTConfig_AttackSkill[3] < 1)
      return false;

   switch(arguments.length)
   {
   case 0:
      range = 20;
   case 1:
      pickitem = false;
   case 2:
      safelevel = 0;
   default:
      if(NTConfig_CheckSelfSafe < 0x01 && NTConfig_CheckMercSafe < 0x01)
         safelevel = 0;
      break;
   }

   _orgx = me.x;
   _orgy = me.y;

   for(var i = 0 ; i < _spectype.length ; i++)
   {
      _skiplist = new Array();
      while(_attackcount < (i+1)*100)
      {
         _mindistance = 100000;
         _target = NTC_FindUnit(NTC_UNIT_MONSTER);
         if(_target)
         {
            do
            {
               if(_skiplist.indexOf(_target.gid) < 0)
               {
                  if(_target.IsAttackable() && (_target.spectype&_spectype[i]))
                  {
                     if(GetDistance(_orgx, _orgy, _target.x, _target.y) <= range && NTA_IsValidMonster(_target))
                     {
                        _distance = GetDistance(me, _target);

                        if(_distance < _mindistance)
                        {
                           _mingid = _target.gid;
                           _mindistance = _distance;
                        }
                     }
                  }
                  else
                     _skiplist.push(_target.gid);
               }
            } while(_target.GetNext());
         }
         if(_mindistance < 100000)
         {
            _target = NTC_FindUnit(NTC_UNIT_MONSTER, _mingid);

            if(_target)
            {
               _cowKing = GetUnit(NTC_UNIT_MONSTER, GetLocaleString(2850));
               if(_cowKing){
                  return true;
               }
               _result = NTA_Attack(_target, (_attackcount%30) == 0);

               switch(_result)
               {
               case 1:
                  _skiplist.push(_mingid);
                  break;
               case 2:
               case 3:
                  _attackcount++;
                  break;
               default:
                  return false;
               }
            }
         }
         else
            break;
      }
   }
   if(me.classid == NTC_CHAR_CLASS_PALADIN)
   {
       if(_attackcount > 2 && (parseInt(me.hp*100/me.hpmax)  < NTConfig_UseRedemptionHP || parseInt(me.mp*100/me.mpmax) <  NTConfig_UseRedemptionMP))
      {
         if(NTC_PutSkill(124, NTC_HAND_RIGHT))
            NTC_PingDelay(1000);
      }
   }
   _cowKing = GetUnit(NTC_UNIT_MONSTER, GetLocaleString(2850));
   if(_cowKing){
      return true;
   }
   if(_NTR_CHEST_AND_ROCKS && failed == false)
   {
      _target = NTR_GetChest();
      if(_target){
         do
         {
         if(_target && GetDistance(_orgx, _orgy, _target.x, _target.y) <= range)
         {  
               if(NTC_OpenChest(_target))
                  NTSI_PickItems();
            
         }
         }while(_target.GetNext());
      }
      _target = NTR_GetObj(174);
      if(_target){
         do
         {
            if(_target && GetDistance(_orgx, _orgy, _target.x, _target.y) <= range)
            {
               if(NTM_MoveTo(me.areaid, _target.x, _target.y))
               {
                  if(NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _target))
                  {
                     Delay(200);
                     NTSI_PickItems();
                  }
               }
            }
         }while(_target.GetNext());
      }
      _target = NTR_GetObj(175);
      if(_target){
         do
         {
            if(_target && GetDistance(_orgx, _orgy, _target.x, _target.y) <= range)
            {
               if(NTM_MoveTo(me.areaid, _target.x, _target.y))
               {
                  if(NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _target))
                  {
                     Delay(200);
                     NTSI_PickItems();
                  }
               }
            }
         }while(_target.GetNext());
      }
      _target = NTR_GetObj(159);
      if(_target){
         do
         {
            if(_target && GetDistance(_orgx, _orgy, _target.x, _target.y) <= range)
            {
               if(NTM_MoveTo(me.areaid, _target.x, _target.y))
               {
                  if(NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _target))
                  {
                     Delay(200);
                     NTSI_PickItems();
                  }
               }
            }
         }while(_target.GetNext());
      }
      _target = NTR_GetObj(155);
      if(_target){
         do
         {
            if(_target && GetDistance(_orgx, _orgy, _target.x, _target.y) <= range)
            {
               if(NTM_MoveTo(me.areaid, _target.x, _target.y))
               {
                  if(NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _target))
                  {
                     Delay(200);
                     NTSI_PickItems();
                  }
               }
            }
         }while(_target.GetNext());
      }
   }
   if(pickitem && _attackcount > 0)
      NTSI_PickItems();
   switch(safelevel)
   {
   case 1:
      return NTTMGR_CheckSafe(0x00, NTConfig_CheckMercSafe&0x01);
   case 2:
      return NTTMGR_CheckSafe(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe);
   }
   return true;
}
function NTR_ClearRooms()
{
   var failcount = 0, precount = 0, x, y, offx = 0, offy = 0, goalx = 0, goaly = 0, cowoffx = 0, cowoffy = 0;
   var toggle = true;
   var _cowKing;
   var _faillast;
  
   x = me.x;
   y = me.y;
  
   //NTC_PingDelay(5000);
   while (failcount <= _NTR_FAIL_CHECKS)
   {
      if(toggle == true && offx == goalx){
         if(goaly < 0){
            goaly=(0-(goaly-20));
         }else{
            goaly=(0-(goaly+20));
         }
         toggle = false;
      }
      if(toggle == false && offy == goaly){
         if(goaly < 0){
            goalx=(0-(goalx-20));
         }else{
            goalx=(0-(goalx+20));
         }
         toggle = true;
      }
      if(offy > goaly){
         offy-=20;
         y-=20;
      }
      if(offy < goaly){
         offy+=20;
         y+=20;
      }
      if(offx < goalx){
         offx+=20;
         x+=20;
      }
      if(offx > goalx){
         offx-=20;
         x-=20;
      }
      _cowKing = GetUnit(NTC_UNIT_MONSTER, GetLocaleString(2850));
      if(!_cowKing){
         NTR_ClearPosition(20, true, 0, _faillast);
         if(((GetTickCount()-precount)/1000) >= _NTR_PRE_EVERY && _NTR_PRE_EVERY >= 0){
            NTP_DoPrecast();
            precount = GetTickCount();
         }
      }
      if(!NTM_MoveTo(me.areaid, x, y)){
         failcount++;
         _faillast = true;
      }else{
         _faillast = false;
      }
   }
   return true;
}
function NTT_SecondTomeTP(npc, type, amount)
{
   var _items;
   var _counter = 0;

   if(arguments.length < 1)
      return false;

   if(arguments.length < 2)
      type = 0;

   if(arguments.length < 0)
      amount = 1;

   if(amount == 0)
      return false;

   if(type)
      _items = npc.GetItems("tbk");

   if(_items)
   {
      if(_items.length > 0)
      {
         for(var i = 0 ; i < amount ; i++)
         {
            if(NTT_ShopItem(_items[0], npc, 2))
               _counter++;
         }
      }
   }
   return (_counter > 0);
}
function NTR_GetChest()
{
   var _chest;

   _chest = NTC_FindUnit(NTC_UNIT_OBJECT, "chest");
    if(_chest)
    {
      return _chest;
    }

   return null;
}
function NTR_GetObj(num)
{
   var _chest;

   _chest = NTC_FindUnit(NTC_UNIT_OBJECT, num);
    if(_chest)
    {
      return _chest;
    }

   return null;
}