Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cows in d2nt
#1
can someone figure out how to write a script for cows that doesnt involve killing the king?
Reply
#2
Through my recent research for it this one is the script. Well i don't remember if you change something on NTAttack try it and if it wont work reply here..

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;
}

P.S. #1: You copy/paste this code into a txt file and save it as NTCow.ntj. (Put it in D2NT\scripts\NTBot\bots)
P.S. #2: You go to characters setup and you add this line to Boss configuration.
Code:
    NTConfig_Script.push("NTCow.ntj"); NTConfig_KillRakanishuCows = true; NTConfig_TristExtension = false;
Reply
#3
// 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_KillRakanishu)
{
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;
}[COLOR="Silver"]

---------- Post added at 08:01 AM ---------- Previous post was at 08:00 AM ----------

[/COLOR]i had to change killrakanishucows to just killrakanishu. goes into trist then i get an error msg about tristextension.[COLOR="Silver"]

---------- Post added at 08:04 AM ---------- Previous post was at 08:01 AM ----------

[/COLOR]\NTCOWS.ntj (71) : ReferenceError: NTConfig_TristExtension is not defined[COLOR="Silver"]

---------- Post added at 08:36 AM ---------- Previous post was at 08:04 AM ----------

[/COLOR]i got it working. thanks man
Reply
#4
im having one problem i set ip up but whe is cow time he wont do nothing after trist he just satnds by the portal doing nothign can i get some help with thast
Reply
#5
First off, thanks for the script. I got it working with the given instructions. Couple caveats-

The code has some safety measure to ensure that the king stays safe, but it looks like it only specifically addresses paladins, and generally supports sorceresses. I ran this on my blizzard sorceress for about 20 runs and the script successfully avoided the king. I would be weary about trying anything but a sorceress or paladin, I haven't tried a Barbarian, but anything with a melee attack should be fine.

Secondly, while the script works, it is horribly inefficient at clearing the cow level. It focuses on chests and clearing cows is just a secondary survival method. Moreover, I have found that it makes my sorceress teleport all over the place and often covering the same area it has already been to. This wastes an extraordinariness amount of mana, so if you aren't using insight on your merc, you will be sucking down a lot of mana pots.

Other than those things, great script and thanks goes to the creator for their work. I personally was looking for a cow script that could help me level up my low level chars to 25, and this was not good at solving that, but it is a great script for MFing for HR by doing hell cow runs.

EDIT: Scratch what I said about it not killing king. After 50 runs with my sorceress, I found that the King had been killed at some point and now I cannot run the script (for obvious reasons), making it essentially useless.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [D2NT Release] Druid Script skidude 20 17,266 08-25-2012, 01:20 AM
Last Post: comper
  D2NT BoT Gh0sT17 52 2,056 07-31-2012, 11:10 PM
Last Post: comper
  D2nt need help on some stuff wishyq 3 169 07-22-2012, 12:44 PM
Last Post: comper
  Little Help Please? (D2NT) pnsmcgraw 12 271 07-16-2012, 02:46 PM
Last Post: Mythosis
  MasivB's D2NT Simple Unique PickIt masivb 1 118 07-03-2012, 05:03 AM
Last Post: comper
  D2nt - how do i stay in game when sojs sell? brianwalter86 5 354 07-01-2012, 02:02 PM
Last Post: comper
  Nooby D2NT Questions Kieran Wilson 0 129 06-25-2012, 04:35 PM
Last Post: Kieran Wilson
  [D2NT Release]Item Logging with XML 3.0+ skidude 76 14,554 06-25-2012, 01:27 PM
Last Post: masivb
  D2nt Bot jewel pickit/godly item pickit Nightwish 3 232 06-23-2012, 04:18 AM
Last Post: comper
  someone please help my d2nt bot wont kill any bosses mcmullenp4 2 178 06-19-2012, 10:18 AM
Last Post: comper

Forum Jump:


Users browsing this thread: 1 Guest(s)