Author Topic: D2NT Cow Script  (Read 6686 times)

Offline Justin

  • I run this bitch!
  • Administrator
  • PureKaoz HeRo
  • *****
  • Posts: 780
  • Reputation 3
  • Fck Bnet
    • View Profile
    • PureKaoz.com
D2NT Cow Script
« on: June 03, 2010, 01:39:41 AM »
Yep, thats right... a COW script for D2NT! WOO HOO!
Not safe for hammerdins, potential to kill the king...

Install:
Open notepad.
Copy the script below into notepad
Save the script into your bots folder \\scripts\NTBot\bots and name NTCow.ntj
Open your character config \\scripts\NTBot\char_configs
Add to the config for your character

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

   
Code: [Select]
// Boss configuration
   //------------------------------------------------------------------------------

You may also edit the config in the NTCow.ntj if you would like.


Make a new file in your bots folder, and name it NTCow.ntj; Then, copy and paste the code below to that file and save it. You're then ready to go!

Code: [Select]
// 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;
}
« Last Edit: July 07, 2010, 12:48:01 AM by Justin »

Owner of Cutting Edge Promotions http://CEPromotion.net

Offline TheFreak

  • Just like an admin ;)
  • PK Pro
  • ****
  • Posts: 373
  • Reputation 1
  • I rap and write javascript mutha fucka!
    • View Profile
Re: [D2NT] Cow Script
« Reply #1 on: June 03, 2010, 08:34:35 AM »
I modded this to make tha portal at akara. Lmk if yu want it.


My New function:

function AlbertEinstein()
{
If (A = success in life)
A = x + y + z;
x = Work;
y = Play;
z = Keeping your mouth shut;
}

"Right after the Sam-Frodo suckfest, right before the credits roll, Sam fuckin' flat-out brick's in Frodo's mouth"

Normality

  • Guest
Re: [D2NT] Cow Script
« Reply #2 on: June 04, 2010, 12:24:33 PM »
Suggestion: 

if(!NTR_TakeCowPortal(18))
    {
        NTC_SendMsgToScript("NTBotGame.ntj", "Failed to take Cow Portal.");
        return;
    }

Change the 18 to 25.  I found that the 18 in public cow games kept saying "Failed.." and would exit game.  Putting this too high (40) will take the Stony Field Blue Portal so don't put it too high.  Never had a problem at 25 with 100+ runs now.  I use a FB/Orb sorc.
It's line 231 of the code btw, atleast for me.


Offline TheFreak

  • Just like an admin ;)
  • PK Pro
  • ****
  • Posts: 373
  • Reputation 1
  • I rap and write javascript mutha fucka!
    • View Profile
Re: [D2NT] Cow Script
« Reply #3 on: June 04, 2010, 02:48:17 PM »
This script will open cow portal at akara.

Code: [Select]
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

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

NTTMGR_TownManager();

    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_MoveItemToInventoryInt(_cube)
me.Cancel(1);
NTTM_TownMove("akara");
SetUIState(0x01, true);
NTCU_OpenCubeInt(_cube);
        Transmute();
        NTCU_CloseCubeInt();

var _stash;

    NTTM_TownMove("stash");

    _stash = NTC_FindUnit(NTC_UNIT_OBJECT, NTC_UNIT_STASH, 5);

   
      if(NTT_DoInteract(_stash))
      {
          var _box = me.GetItems();

          if(_box)
         {
            for(var i = 0 ; i < _box.length ; i++)
            {
              if(_box[i].classid == 549)
              {
                  NTC_ItemToCursor(_box[i]);
                  NTC_PingDelay(200);
                  me.ClickItem(0, 0, 0, 4);
                NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _stash);   
me.Cancel(1);
break;
               }
            }
         }
               
      }   

NTTM_TownMove("akara");

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

function NTCU_MoveItemToInventoryInt(item)
{
var x, y, m, n;
var _havespace;

for(y = 0 ; y < 4 ; y++)
{
for(x = 0 ; x < 10 ; x++)
{
_havespace = true;

for(m = 0 ; m < item.ysize ; m++)
{
for(n = 0 ; n < item.xsize ; n++)
{
if(_NTCU_Inventory[y+m][x+n] == 1)
{
_havespace = false;
m = 4;
break;
}
}
}

if(_havespace)
{
if(!NTC_ItemToCursor(item))
return false;

for(m = 0 ; m < 80 ; m++)
{
if((m % 40) == 0)
me.ClickItem(0, x, y, 0);

NTC_Delay(100);

if(!me.itemoncursor)
break;
}

if(m >= 80)
return false;

for(m = 0 ; m < item.ysize ; m++)
{
for(n = 0 ; n < item.xsize ; n++)
_NTCU_Inventory[y+m][x+n] = 1;
}

NTC_PingDelay(200);

return true;
}
}
}

return false;
}


My New function:

function AlbertEinstein()
{
If (A = success in life)
A = x + y + z;
x = Work;
y = Play;
z = Keeping your mouth shut;
}

"Right after the Sam-Frodo suckfest, right before the credits roll, Sam fuckin' flat-out brick's in Frodo's mouth"

Offline Mad-Max

  • Donors
  • PK Novice
  • ***
  • Posts: 126
  • Reputation 5
    • View Profile
Re: [D2NT] Cow Script
« Reply #4 on: June 06, 2010, 03:28:58 PM »
i dunno what im doin wrong but this script just wont work for me bot just sits in town ... d2nt 3.0

Offline TheFreak

  • Just like an admin ;)
  • PK Pro
  • ****
  • Posts: 373
  • Reputation 1
  • I rap and write javascript mutha fucka!
    • View Profile
Re: [D2NT] Cow Script
« Reply #5 on: June 06, 2010, 03:46:23 PM »
Yu sure yu have everything configured right?


My New function:

function AlbertEinstein()
{
If (A = success in life)
A = x + y + z;
x = Work;
y = Play;
z = Keeping your mouth shut;
}

"Right after the Sam-Frodo suckfest, right before the credits roll, Sam fuckin' flat-out brick's in Frodo's mouth"

Offline Mad-Max

  • Donors
  • PK Novice
  • ***
  • Posts: 126
  • Reputation 5
    • View Profile
Re: [D2NT] Cow Script
« Reply #6 on: June 06, 2010, 04:23:28 PM »
Yu sure yu have everything configured right?

doesnt matter now ... noob mistake had ntcows.ntj.ntj as a file name so wouldnt work my mistake  :-[

Danielesplash

  • Guest
Re: [D2NT] Cow Script
« Reply #7 on: June 23, 2010, 02:11:07 AM »
Can I have the script for hammerdin without risk of killing the king of the cows?

Offline TheFreak

  • Just like an admin ;)
  • PK Pro
  • ****
  • Posts: 373
  • Reputation 1
  • I rap and write javascript mutha fucka!
    • View Profile
Re: [D2NT] Cow Script
« Reply #8 on: June 23, 2010, 08:50:32 AM »
Tha one i posted


My New function:

function AlbertEinstein()
{
If (A = success in life)
A = x + y + z;
x = Work;
y = Play;
z = Keeping your mouth shut;
}

"Right after the Sam-Frodo suckfest, right before the credits roll, Sam fuckin' flat-out brick's in Frodo's mouth"