Blizzard Sector
Weapon/Armor Stands script D2NT? - Printable Version

+- Blizzard Sector (https://www.blizzsector.co)
+-- Forum: Diablo II (https://www.blizzsector.co/forum-4.html)
+--- Forum: Hacks Bots and Editors (https://www.blizzsector.co/forum-16.html)
+--- Thread: Weapon/Armor Stands script D2NT? (/thread-47260.html)



Weapon/Armor Stands script D2NT? - alii - 04-17-2011

I've been using D2NT for a couple weeks now and have been learning a bit about programming and stuff in the process. I've managed to make some custom pickit scripts and edit a couple of the bots and the attack script to my liking. However, something I haven't found is a way to tell the bot to open weapon/armor stands while making runs. So I set off to figure out a way to make a script for it. I first tried to edit the MyShrine configure files to include armor/weapon stands, but I didn't figure it out. So then I tried to edit the Mephisto bot file, and made some progress. I used some of the script from the cow script (from this forum) and managed to make my character TP to and activate the weapon rack and tp back to the middle, but it won't TP to the armor rack like the script suggests (at least I believe it suggests). Could someone look at this script and see where the mistake might be ? Or maybe someone with good scripting skills could make a stand-alone script like MyShrine for all bots, I bet it'd get use!

UPDATE: I figured it out, feel free to copy the updated script below. Some of it is probably redundant, so anyone with knowledge can still correct it. Used some trigonometry to find out how to get the bot to TP to the area of the armor stand, and that seemed to do the trick. You can copy/paste this over your existing meph bot, or I would recommend you make a copy of the original NTMephisto.ntj file, rename it to NTMephisto2.ntj, and then delete the existing code in the new file and replace it with the code below. Then in your character config file, change the bot to NTMephisto2.ntj. Might still have some kinks to fix, but it works fine for my character.

Code:
//Mephisto Bot, armor/weapon stand script. 1.1
//Config
const _NTR_STANDS = true; // Set to true to activate armor&weapon stands
//End Config

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


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();

    if(!NTTM_TownMove("waypoint"))
    {
        NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_TownMove()");
        return;
    }

    if(!NTM_TakeWaypoint(101))
    {
        NTC_SendMsgToScript("NTBotGame.ntj", "NTM_TakeWaypoint()");
        return;
    }

    NTP_DoPrecast(true);

    if(!NTM_MoveToStair(me.areaid, 102))
    {
        NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveToStair()");
        return;
    }

    if(!NTM_TakeStair(102))
    {
        NTC_SendMsgToScript("NTBotGame.ntj", "NTM_TakeStair()");
        return;
    }

    if(!NTTMGR_CheckSafe(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe))
    {
        NTC_SendMsgToScript("NTBotGame.ntj", "NTTMGR_CheckSafe()");
        return;
    }

    if(!NTM_MoveTo(me.areaid, 17564, 8069))
    {
        NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveTo()");
        return;
    }

    NTC_Delay(200);

    if(me.classid != NTC_CHAR_CLASS_PALADIN && me.classid != NTC_CHAR_CLASS_BARBARIAN)
        NTM_MoveTo(me.areaid, 17573, 8071);

    if(!NTA_KillMonster(242))
    {
        NTC_SendMsgToScript("NTBotGame.ntj", "NTA_KillMonster()");
        return;
    }

    if(NTConfig_ClearPosition)
        NTA_ClearPosition();

    NTSI_PickItems();

    if(NTConfig_OpenChest)
    {
        var _chest;

        if(NTM_MoveTo(me.areaid, 17520, 8063))

        _chest = NTC_FindUnit(NTC_UNIT_OBJECT, GetLocaleString(3260), 1);

        if(_chest)
        {
            do
            {
                if(_chest.x == 17513 && _chest.y == 8063)
                {
                    if(NTC_OpenChest(_chest))
                        NTSI_PickItems();

                    break;
                }
            } while(_chest.GetNext());
        }
    }
    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;
    }
      if(_NTR_STANDS)
      {
        _target = NTR_GetObj(106);
        if(_target){
        do
            {
            if(_target && GetDistance(_orgx, _orgy, _target.x, _target.y) >= 5)
            {
                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(107);
        if(_target){
        do
            {
            if(_target && GetDistance(_orgx, _orgy, _target.x, _target.y) >= 5)
            {
                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(!NTM_MoveTo(me.areaid, 17580, 8099))
    {
        NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveTo()");
        return;
    }
      if(_NTR_STANDS)
      {
        _target = NTR_GetObj(104);
        if(_target){
        do
            {
            if(_target)
            {
                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(105);
        if(_target){
        do
            {
            if(_target)
            {
                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());
        }
    }

    Delay(1000)
    NTC_SendMsgToScript("NTBotGame.ntj", "SCRIPT_END");
}

Thanks a ton, happy botting.