Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
can someone put this in code format so its easier for people to get
#1
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_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_Tristram)
      {
         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:43 AM ---------- Previous post was at 08:41 AM ----------

[/COLOR]NTConfig_Script.push("NTCows.ntj"); NTConfig_KillRakanishu = true; NTConfig_Tristram = true;

put this line in ur char config under boss configuration. if u set tristram to false u should just get leg, set at true and u will clear trist before getting leg. (good for mf) when i ran this script my hdin did NOT kill cow king
Reply
#2
Done. Smile
[Image: nyyzok.gif]
Reply
#3
ty blue
Reply
#4
what would i save this in for it the bot to recignise it cuz i saved it as a text document and all my bot did was stand there any help plz??
Reply
#5
rachet205 Wrote:what would i save this in for it the bot to recignise it cuz i saved it as a text document and all my bot did was stand there any help plz??
it has to be saved as an ntj file for the bot to recognize it.As far asI know you cant make one without a special program,but you can make a copy of one of the existing ntj files
and rename it,then empty it and fill it with this script.
[SIGPIC][/SIGPIC]Well I’m not there all the time you know Some people, some people, some people, Call it insane, yeah they call it insane, (sugar) I play russian roulette everyday, a man’s sport, With a bullet called life, yeah called life,(sugar)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  can't find this piece of code Tacos 1 122 09-06-2012, 03:28 PM
Last Post: comper
  Is there a way to code d2nt to only pick unique etheral items and not ID them? Kratess 2 360 09-27-2011, 03:35 AM
Last Post: Grimtrooper
  Question about what this script/code means != impuls351 2 189 07-02-2011, 05:23 AM
Last Post: impuls351
  need help adding socket pickit code Bosx 4 340 02-12-2011, 06:39 AM
Last Post: Bosx
  Need help adding code for LLD items jfish360 3 262 01-30-2011, 11:14 AM
Last Post: Jammer74
  Random room name code ImBr 0 242 01-30-2011, 05:42 AM
Last Post: ImBr
  Random room name code ImBr 0 145 01-30-2011, 05:41 AM
Last Post: ImBr
  D2NT Attack Code Problem HuevoPicante 5 2,113 12-01-2010, 08:48 AM
Last Post: Jammer74
  what map hack are people currently using? Aeox 1 671 09-09-2010, 09:24 AM
Last Post: DNA64
  help to create this pickit code for orbs 3 soq or white killpage 1 291 07-31-2010, 10:53 AM
Last Post: Jammer74

Forum Jump:


Users browsing this thread: 3 Guest(s)