Code:
/**
* This file was modified by [Only registered and activated users can see links. Click Here To Register...]
* Check the programming section for updates and further scripts
* Last Update: 09:50 10.05.2011
*/
var _NTNihlathak_Locations = new Array(8, 4);
_NTNihlathak_Locations[0] = [12519, 5203, 12522, 5227]; // Top Left
_NTNihlathak_Locations[1] = [12704, 5019, 12692, 5022]; // Top Right
_NTNihlathak_Locations[2] = [12705, 5391, 12723, 5413]; // Bottom Right
_NTNihlathak_Locations[3] = [12889, 5206, 12898, 5228]; // Bottom Left
_NTNihlathak_Locations[4] = [12519, 5203, 12522, 5196]; // Top Left
_NTNihlathak_Locations[5] = [12704, 5019, 12692, 5413]; // Top Right
_NTNihlathak_Locations[6] = [12705, 5391, 12727, 5022]; // Bottom Right
_NTNihlathak_Locations[7] = [12889, 5206, 12898, 5192]; // Bottom Left
const _NTN_DAMAGE_TYPE = NTA_DAMAGE_LIGHTNING;
const _NTN_MAX_RESISTANCE = 99;
function NTMain()
{
Include("libs/common/NTCommon.ntl");
NTC_IncludeLibs();
NTC_IncludeConfig("NTBot/char_configs");
NT_LoadConfig();
NTSI_LoadNIPFiles("NTBot/item_configs");
MWC_Initialize();
var _location, _nihla;
if(!NTTM_CheckAct(me.act, true))
{
NTC_SendMsgToScript("MWBotGame.ntj", NTTM_CheckAct, 31, me.act, true);
return;
}
NTTMGR_TownManager();
if(!NTTM_TownMove("waypoint"))
{
NTC_SendMsgToScript("MWBotGame.ntj", NTTM_TownMove, 39, "waypoint");
return;
}
if(!NTM_TakeWaypoint(123))
{
NTC_SendMsgToScript("MWBotGame.ntj", NTM_TakeWaypoint, 45, 123);
return;
}
NTP_DoPrecast(true);
if(!NTM_MoveToStair(me.areaid, 124))
{
NTC_SendMsgToScript("MWBotGame.ntj", NTM_MoveToStair, 53, me.areaid, 124);
return;
}
if(!NTM_TakeStair(124))
{
NTC_SendMsgToScript("MWBotGame.ntj", NTM_TakeStair, 59, 124);
return;
}
if(!MWConfig_SkipOnTombVipers || !NTC_FindUnit(NTC_UNIT_MONSTER, 597))
{
_location = NT_FindNihlathakInt();
if(_location == -1)
{
NTC_SendMsgToScript("MWBotGame.ntj", NT_FindNihlathakInt, 67);
return;
}
if(!NTM_MoveTo(me.areaid, _NTNihlathak_Locations[_location][2], _NTNihlathak_Locations[_location][3]))
{
NTC_SendMsgToScript("MWBotGame.ntj", NTM_MoveTo, 75, me.areaid, _NTNihlathak_Locations[_location][2], _NTNihlathak_Locations[_location][3]);
return;
}
if(!NTTMGR_CheckSafe(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe))
{
NTC_SendMsgToScript("MWBotGame.ntj", NTTMGR_CheckSafe, 81, NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe);
return;
}
_nihla = NTC_FindUnit(NTC_UNIT_MONSTER, 526, 3);
if(_nihla && NTA_GetResistance(_nihla, _NTN_DAMAGE_TYPE) <= _NTN_MAX_RESISTANCE)
{
Print("ÿc1Skipping Nihlatak due to immunity...");
_nihla = null;
}
if(_nihla && NTA_KillMonster(526))
{
if(NTConfig_ClearPosition)
NTA_ClearPosition();
NTSI_PickItems();
}
else if(!NTConfig_PindleskinExtension)
{
NTC_SendMsgToScript("MWBotGame.ntj", NTA_KillMonster, 94, 526);
return;
}
}
else
Print("ÿc1Tomb Vipers detected - Skipping Nihlatak...");
if(NTConfig_PindleskinExtension)
{
for(var i = 0; i < 2; i++)
{
if(!NTM_MoveToStair(me.areaid, 123 - i))
{
NTC_SendMsgToScript("MWBotGame.ntj", NTM_MoveToStair, 107, me.areaid, 123 - i);
return;
}
if(!NTM_TakeStair(123 - i))
{
NTC_SendMsgToScript("MWBotGame.ntj", NTM_TakeStair, 113, 123 - i);
return;
}
}
if(!NTM_MoveToStair(me.areaid, 121))
{
NTC_SendMsgToScript("MWBotGame.ntj", NTM_MoveToStair, 120, me.areaid, 121);
return;
}
if(!NTTMGR_CheckSafe(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe))
{
NTC_SendMsgToScript("MWBotGame.ntj", NTTMGR_CheckSafe, 126, NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe);
return;
}
NTP_DoPrecast(false);
if(!NTM_TakeStair(121))
{
NTC_SendMsgToScript("MWBotGame.ntj", NTM_TakeStair, 134, 121);
return;
}
if(!NTM_MoveTo(me.areaid, 10061, 13234))
{
NTC_SendMsgToScript("MWBotGame.ntj", NTM_MoveTo, 140, me.areaid, 10061, 13234);
return;
}
if(!NTA_KillMonster(GetLocaleString(22497)))
{
NTC_SendMsgToScript("MWBotGame.ntj", NTA_KillMonster, 146, GetLocaleString(22497));
return;
}
if(NTConfig_ClearPosition)
NTA_ClearPosition();
NTSI_PickItems();
MWL_FindItem();
}
NTC_SendMsgToScript("MWBotGame.ntj", "SCRIPT_END");
}
// Internal function
function NT_FindNihlathakInt()
{
var i, x, y;
var _nihlathak;
var _mindist = 999999;
var _currdist;
var _location = -1;
_nihlathak = GetPresetUnits(me.areaid, NTC_UNIT_OBJECT, 462);
if(!_nihlathak || _nihlathak.length < 1)
return _location;
x = _nihlathak[0].roomx*5 + _nihlathak[0].x;
y = _nihlathak[0].roomy*5 + _nihlathak[0].y;
for(i = 0 ; i < 8 ; i++)
{
_currdist = GetDistance(_NTNihlathak_Locations[i][0], _NTNihlathak_Locations[i][1], x, y);
if(_currdist < _mindist)
{
_mindist = _currdist;
_location = i;
}
}
return _location;
}