Author Topic: [D2NT] Bow/Java zon Script  (Read 2529 times)

swiftboy36

  • Guest
[D2NT] Bow/Java zon Script
« on: November 04, 2010, 06:41:04 PM »
NOTES BOWZON:
* MAKE SURE YOUR BOW IS ON THE LEFT WEAPON SLOT.
* Make sure on weapon swap (CTA) the left skill is on attack and on bow switch (Main) left skill is NOT attack. This is in case bot leaves on wrong weapon switch and cannot equip arrows.
* It would be best to start with no arrows in weapon slot or in inventory.
* If you are worried that for some strange reason the bot will drop the bow then you shouldn't use this script.
* Bot will only buy arrows/bolts if multiple shot is at least level 1. This is to prevent javazon from buying arrows. If Javazon has 1 into multiple shot then you are screwed lol
* While attacking, if the bot reaches low arrows/bolts it will TP and either buy new ones
* Crossbow/bolts supported

NOTES JAVAZON:
* Bot will repair javelins if they break while attacking


Step [1]: Open NTAttack. At the top change:
Quote
for(var i = 0 ; i < 7 ; i++)
[/color]

to:
Quote
for(var i = 0 ; i < 8 ; i++)
[/color]

Now add these case codes for spell range:
Quote
case 6:  //Magic Arrow
         case 7:  //Fire Arrow
            _NTA_SkillRange = 15;
            break;
         case 10: //Jab
            _NTA_SkillRange = 3;
            break;
         case 11: //Cold Arrow
         case 12: //Multiple Shot
         case 16: //Exploding Arrow
         case 21: //Ice arrow
         case 22: //Guided arrow
            _NTA_SkillRange = 20;
            break;
         case 24: //Charged Strike
            _NTA_SkillRange = 3;
            break;
         case 25: //Plague jav
            _NTA_SkillRange = 10;
            break;
         case 26://Strafe
         case 27://Immolation Arrow
            _NTA_SkillRange = 15;
            break;
         case 30: //Fend
            _NTA_SkillRange = 3;
            break;
         case 31: //Freezing arrow
            _NTA_SkillRange = 15;
            break;
         case 35: //Lightning Fury
            _NTA_SkillRange = 12;
            break;
[/color]

Step [2]: Copy this code and paste it above these lines :

Quote
// Internal function
function NTA_AmazonAttackPatternInt()
[/color]

Step [3]: Now, replace these functions:

Quote
function NTA_AmazonAttackPatternInt(), function NTA_AmazonAttackInt(target, firstorder), function NTA_AmazonCastSkillInt(index, target)
[/color]

with this
Quote
function NTA_AmazonAttackPatternInt()
{
   
   var _maxindex, _maxskill;
   var _avgskilllevel = new Array();

   _avgskilllevel[0]  = me.GetSkill(35, false);
   _avgskilllevel[1]  = parseInt((me.GetSkill(31, false) + me.GetSkill(11, false) + me.GetSkill(21, false)) /3 );
   _avgskilllevel[2]  = me.GetSkill(26, false);


   _maxindex = -1;
   _maxskill = 0;

   for(var i = 0 ; i < _avgskilllevel.length ; i++)
   {
      if(_avgskilllevel > _maxskill)
      {
         _maxindex = i;
         _maxskill = _avgskilllevel;
      }
   }

   switch(_maxindex)
   {
   case 0: // Lightning Fury for Javazon
      
      NTConfig_AttackSkill[1] = 35;
      NTConfig_AttackSkill[2] = 35;
      NTConfig_AttackSkill[3] = 35;
      NTConfig_AttackSkill[4] = 35;
      NTConfig_AttackSkill[5] = 35;
      NTConfig_AttackSkill[6] = 35;
      NTConfig_AttackSkill[7] = 24;
      break;

   case 1: // Freezing Arrow for Bowzon
      
      NTConfig_AttackSkill[1] = 31;
      NTConfig_AttackSkill[2] = 31;
      NTConfig_AttackSkill[3] = 31;
      NTConfig_AttackSkill[4] = 31;
      NTConfig_AttackSkill[5] = 31;
      NTConfig_AttackSkill[6] = 31;
      NTConfig_AttackSkill[7] = 31;
      break;
   
   case 2: // Cold Arrow + Strafe for Bowzon
   
      NTConfig_AttackSkill[0] = 11;
      NTConfig_AttackSkill[1] = 26;
      NTConfig_AttackSkill[2] = 26;
      NTConfig_AttackSkill[3] = 26;
      NTConfig_AttackSkill[4] = 26;
      NTConfig_AttackSkill[5] = 26;
      NTConfig_AttackSkill[6] = 26;
      NTConfig_AttackSkill[7] = 22;
      break;
   }

   return (NTConfig_AttackSkill[1] && NTConfig_AttackSkill[3]);
}


function NTA_AmazonAttackInt(target, firstorder)
{
   var _primaryindex;
   
   if(NTTMGR_CheckCurse(NTConfig_CheckSelfSafe&0x10, NTConfig_CheckMercSafe&0x10))
   {
      if(!NTTMGR_VisitTown())
         return 0;
   }
   
   
   if(me.GetSkill(12, false) > 1)
      NTA_HaveArrows();
   else
      NTA_IsWeaponBroken();
   

   if(firstorder && NTConfig_AttackSkill[0] > 0 && NTA_GetResistance(target, _NTA_SkillDamage[0]) < 100)
   {
      if(GetDistance(me, target) > _NTA_SkillRange[0] || !CheckCollision(me, target, 4))
      {
         var _pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, _NTA_SkillRange[0], 4);

         if(_pos)
            NTM_MoveTo(target.areaid, _pos[0], _pos[1], 0);
      }

      if(!NTC_CastSkill(NTConfig_AttackSkill[0], _NTA_SkillHand[0], target))
         return 2;

      return 3;
   }

   _primaryindex = (target.spectype&0x0A) ? 1 : 3;

   switch(target.classid)
   {
      case 243://Diablo
      case 544://Baal
      case 242:
         if(!NTA_AmazonCastSkillInt(7, target))
            return 2;

         return 3;
      default:
         break;
   }

   if(NTA_GetResistance(target, _NTA_SkillDamage[_primaryindex]) <= 90)
   {
      if(!NTA_AmazonCastSkillInt(_primaryindex, target))
         return 2;

      return 3;
   }
   
   
   if(NTConfig_AttackSkill[5] > 0  && NTA_GetResistance(target, _NTA_SkillDamage[5]) > 80)
   {
      if(!NTA_AmazonCastSkillInt(5, target))
         return 2;

      return 3;
   }
   
   if(NTA_GetResistance(target, _NTA_SkillDamage[_primaryindex]) < 100 || (_primaryindex == 1 && NTC_GetMerc()))
   {
      if(!NTA_AmazonCastSkillInt(_primaryindex, target))
         return 2;

      return 3;
   }

   return 1;
}

function NTA_AmazonCastSkillInt(index, target)
{

   if(GetDistance(me, target) > _NTA_SkillRange[index] || !CheckCollision(me, target, 4))
   {
      var _pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, _NTA_SkillRange[index], 4);

      if(_pos)
         NTM_MoveTo(target.areaid, _pos[0], _pos[1], 0);
   }
 
   return NTC_CastSkill(NTConfig_AttackSkill[index], NTC_HAND_LEFT, target);
   
   if(NTConfig_AttackSkill[index+1] > 0)
   {
      if(GetDistance(me, target) > _NTA_SkillRange[index+1] || !CheckCollision(me, target, 4))
            {
               var _pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, _NTA_SkillRange[index+1], 4);

               if(_pos)
                     NTM_MoveTo(target.areaid, _pos[0], _pos[1], 0);
           }

             return NTC_CastSkill(NTConfig_AttackSkill[index+1], _NTA_SkillHand[index+1], target);
        } 
   
}
[/color]

Save and close NTAttack.

If you don't plan to use a bowzon you can skip to Step 11

Step [5][A]: Open NTTown, copy this code and paste it at the end of NTTown

Quote
function NTT_FillArrows(npc)
{
   var _arrows;
   var _items;
   var _weapon;
   var _name;
   var _bow =false;

   if(arguments.length < 1)
      return false;

   _weapon = me.GetItems();

   if(_weapon)
      for(var i = 0 ; i < _weapon.length ; i++)
           if(_weapon.mode == 1 && _weapon.itemloc == 4)
         switch(_weapon.classid)
         {
            case 68:   //Short Bow
            case 69:   //Hunter's Bow
            case 70:   //Longbow
            case 71:   //Composite Bow
            case 72:   //Short Battle Bow
            case 73:   //Long Battle Bow
            case 74:   //short war bow
            case 75:   //Long War Bow
            case 161:  //Edge Bow
            case 162:  //Razor Bow
            case 163:  //Cedar Bow
            case 164:  //Double Bow
            case 165:  //Short Siege Bow
            case 166:  //Large Siege Bow
            case 167:  //Rune Bow
            case 168:  //Gothic Bow
            case 264:  //Spider Bow
            case 265:  //Blade Bow
            case 266:  //Shadow Bow
            case 267:  //Great Bow
            case 268:  //Diamond Bow
            case 269:  //Crusader Bow
            case 270:  //Ward Bow
            case 271:  //Hydra Bow
            case 281:  //Stag Bow
            case 282:  //Reflex Bow
            case 291:  //Ashwood Bow
            case 292:  //Cermonial Bow
            case 301:  //Matriarchal Bow
            case 302:  //Grand Matron Bow
               _bow = true;
               _name = _weapon.name.split("\n")[0];
               break;

            default:
               _bow = false;
               _name = _weapon.name.split("\n")[0];
               break;
         }
   if(_bow)
   {
      Print("?c8Buying Arrows for my " + _name);
      Print(" ");
      _items = npc.GetItems(526);
   
         if(_items && _items.length > 0)
         {   
            NTT_ShopItem(_items[0], npc, 2);
         return;
         }
   }

   else
   {
      Print("?c8Buying Bolts for my " + _name);
      Print(" ");         
         _items = npc.GetItems(528);
   
         if(_items && _items.length > 0)
         {
            NTT_ShopItem(_items[0], npc, 2);
         return;
            
           }
   }

   return false;
}

[B.]Now find this code:
Quote
if(!_havespace)
   {   
      if(NTT_CheckSpace(item.xsize, item.ysize))
         _havespace = true;
   }

Change it to this:
Quote
if(!_havespace)
   {   
      if(item.classid == 526 || item.classid == 528)
         _havespace = true;
      else if(NTT_CheckSpace(item.xsize, item.ysize))
         _havespace = true;
   }
Save and close NTTown

Step [6]: Open NTTownManager, add this variable to the top:
Quote
var _NTTMGR_BuyArrows;

Step [8][A]: Copy this code:
Quote
if(me.GetSkill(12, false) > 1)
{
   _NTTMGR_BuyArrows = true;
   if(NTC_InTown())
      NTTMGR_CheckAmazonBow();
}

Paste it under:
Quote
NTC_PutSkill(115, NTC_HAND_RIGHT);

[B.] Copy this code:

Quote
function NTTMGR_CheckAmazonBow()
{
   if(me.GetSkill(NTC_HAND_LEFT) == 0 || me.GetSkill(NTC_HAND_RIGHT) == 149 || me.GetSkill(NTC_HAND_RIGHT) == 155)
      NTC_SwapWeapons();

   var _weapon = me.GetItems();

     if(_weapon)
     {
             for(var i = 0 ; i < _weapon.length ; i++)
           {
         if(_weapon.classid == 526 || _weapon.classid == 528)
                  {
                        if(_weapon.GetStat(70) <= 350 && _weapon.itemloc == 5 && _weapon.mode == 1)
                        {
                           SetUIState(0x01, true);
                           NTC_PingDelay(200);
                           NTC_ItemToCursor(_weapon);
                           NTC_PingDelay(200);
                           NTC_ClearCursor();
                           NTC_PingDelay(200);
                           me.Cancel(1);
                           break;   
                        }
                     }         
            }
         }
}
And paste it at the end of NTTownManager

Step [9]: Add the red:
Quote
if(_NTTMGR_DoRepair || _NTTMGR_BuyArrows)
NTTMGR_VisitCharsi();
Quote
if(_NTTMGR_DoHeal || _NTTMGR_RemoveCurse || _NTTMGR_DoRepair || _NTTMGR_BuyArrows)
NTTMGR_VisitFara();
Quote
if(_NTTMGR_DoRepair || _NTTMGR_BuyKey || _NTTMGR_BuyArrows)
NTTMGR_VisitHratli();
Quote
if(_NTTMGR_DoRepair || _NTTMGR_BuyArrows)
NTTMGR_VisitHalbu();
Quote
if(_NTTMGR_DoRepair || _NTTMGR_BuyArrows)
NTTMGR_VisitLarzuk();

Step [10]: Add the red:
Quote
function NTTMGR_VisitCharsi()
{
var _npc;

NTTM_TownMove("charsi");

_npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_CHARSI, 5);

if(_npc)
{
if(NTT_DoInteract(_npc))
{
if(_NTTMGR_DoRepair || _NTTMGR_BuyArrows)

if(NTT_DoTrade(_npc))
if(_NTTMGR_DoRepair)
NTT_RepairItems(_npc);
if(_NTTMGR_BuyArrows)
NTT_FillArrows(_npc);

me.Cancel(1);
}
}
}

Quote
function NTTMGR_VisitFara()
{
var _npc;

NTTM_TownMove("fara");

_npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_FARA, 5);

if(_npc)
{
if(NTT_DoInteract(_npc))
{
if(_NTTMGR_DoRepair || _NTTMGR_BuyArrows)

if(NTT_DoTrade(_npc))
if(_NTTMGR_DoRepair)
NTT_RepairItems(_npc);
if(_NTTMGR_BuyArrows)
NTT_FillArrows(_npc);


me.Cancel(1);
}
}
}
Quote
function NTTMGR_VisitHratli()
{
var _npc;

NTTM_TownMove("hratli");

_npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_HRATLI, 5);

if(_npc)
{
if(NTT_DoInteract(_npc))
{
if(NTT_DoTrade(_npc))
{
if(_NTTMGR_DoRepair)
NTT_RepairItems(_npc);
if(_NTTMGR_BuyKey)
NTT_FillKey(_npc);
if(_NTTMGR_BuyArrows)
NTT_FillArrows(_npc);

}

me.Cancel(1);
}
}   
}
Quote
function NTTMGR_VisitHalbu()
{
var _npc;

NTTM_TownMove("halbu");

_npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_HALBU, 5);

if(_npc)
{
if(NTT_DoInteract(_npc))
{
if(_NTTMGR_DoRepair || _NTTMGR_BuyArrows)

if(NTT_DoTrade(_npc))
if(_NTTMGR_DoRepair)
NTT_RepairItems(_npc);
if(_NTTMGR_BuyArrows)
NTT_FillArrows(_npc);

me.Cancel(1);
}
}
}

Quote
function NTTMGR_VisitLarzuk()
{
var _npc;

NTTM_TownMove("larzuk");

_npc = NTC_FindUnit(NTC_UNIT_NPC, NTC_NPC_ID_LARZUK, 5);

if(_npc)
{
if(NTT_DoInteract(_npc))
{
if(NTT_DoTrade(_npc))

if(_NTTMGR_DoRepair || _NTTMGR_BuyArrows)
if(_NTTMGR_DoRepair)
NTT_RepairItems(_npc);
if(_NTTMGR_BuyArrows)
NTT_FillArrows(_npc);


me.Cancel(1);
}   
}
}

Finally, save and close NTTownManager.
Step [11]: Open NTConfig and change:
Quote
var NTConfig_AttackSkill = new Array(7);
to:
quote]var NTConfig_AttackSkill = new Array(8);[/quote]
Save and close NTConfig

Step [12]: Copy a Sorcoress NTConfig and rename it like so:
Quote
NTConfig_Amazon_(YoUrNaMeHeRe)
Step [13]: Open the new config file.
Step [14]:

Quote
//------------------------------------------------------------------------------
// Attack configuration
//------------------------------------------------------------------------------
//6 = Magic Arrow
//7 = Fire Arrow
//10 = Jab
//11 = Cold Arrow
//12 = Multiple Shot
//16 = Exploding Arrow
//21 = Ice Arrow
//22 = Guided Arrow
//24 = Charged Strike
//25 = Plague Jav
//26 = Strafe
//27 = Immolation Arrow
//30 = Fend
//31 = Freezing Arrow
//35 = Lightning Fury

NTConfig_AttackSkill[0] = 0;   // First skill. Maybe slow missiles
NTConfig_AttackSkill[1] = 0;   // Primary skill to super unique/champion.
NTConfig_AttackSkill[2] = 0;   // Primary untimed skill to super unique/champion.

NTConfig_AttackSkill[3] = 0;   // Primary skill to others.
NTConfig_AttackSkill[4] = 0;   // Primary untimed skill to others.
NTConfig_AttackSkill[5] = 0;   // Secondary skill in case monster is immune to primary skill.
NTConfig_AttackSkill[6] = 0;   // Secondary untimed skill.
NTConfig_AttackSkill[7] = 0; // Primary skill to boss (diablo/baal/meph/etc) Not immune to spells I guess.


DONT FORGET TO CONFIG THE REST OF YOUR CHARACTER CONFIG FILE



Credits:
BigApple90 for guide creation code ethics
Swiftboy for minor changes/ fixes and a revamped guide
All others I haven't mentioned deserver full credit as well, if im missing any one let me know and I will add accordingly.
« Last Edit: November 04, 2010, 10:15:31 PM by swiftboy36 »

talon

  • Guest
Re: [D2NT] Bow/Java zon Script
« Reply #1 on: November 04, 2010, 08:54:18 PM »
will these changes afect any of my other chars and how much fg u want and how much u charge to do the changes for me?

talon

  • Guest
Re: [D2NT] Bow/Java zon Script
« Reply #2 on: November 04, 2010, 09:13:56 PM »
also there is a smileyface infront of the new aray number

swiftboy36

  • Guest
Re: [D2NT] Bow/Java zon Script
« Reply #3 on: November 04, 2010, 10:16:36 PM »
Smiley has been fixed :) thanks for the heads up!

Pm'd you talon in regards :)