Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function NTMain()
- {
- Include("libs/common/NTCommon.ntl");
- NTC_IncludeLibs();
- NTC_IncludeConfig("NTBot/char_configs");
- NTSI_LoadNIPFiles("NTBot/item_configs");
- NT_LoadConfig();
- NTA_Initialize();
- var ask_tp_done = false;
- DBGPRT("SimonSayz loaded..");
- while(GetLeaderObj() == null) {
- GotoTown(false);
- Print("leader not in game yet! checking again in 5 sec...");
- Delay(5000);
- }
- while (true) {
- var leader = GetLeaderObj();
- var leader_area = GetLeaderArea();
- if (leader_area == 0) {// leader area not found
- GotoTown(false);
- Print("leader not found! checking again in 2.5 sec...");
- Delay(2500);
- } else {
- if (leader_area != me.areaid) {
- Print("leader is not in my area, trying to get to him...");
- if (NTC_InTown()) {
- NTTM_TownMove("portalspot");
- if (!NTM_UsePortal("BluePortal", leader_area, NTConfig_Simon_Leader)) {
- if (!NTM_TakeWaypoint(leader_area) && !ask_tp_done) {
- Say("please create a TP, i dont got a waypoint to your area");
- ask_tp_done = true;
- }
- }
- } else {
- if (GetDistance(me, leader) < 100) { // should be a "walkable" area change
- if (NTM_MoveTo(leader_area, leader.x, leader.y))
- continue;
- }
- var portal = NTM_FindPortalAreaInt(leader_area);
- if (portal != -1 && GetDistance(me, portal) < 15 && ClickPlayerPortal(portal))
- continue;
- if (!MoveToStair(3, me.areaid, leader_area)) {
- if (!GotoTown(true)) {
- Say("im stuck somehow..");
- NTC_SendMsgToScript("NTBotGame.ntj", "GotoTown()");
- break;
- }
- } else if (!NTM_TakeStair(leader_area)) {
- if (!GotoTown(true)) {
- Say("im stuck somehow..");
- NTC_SendMsgToScript("NTBotGame.ntj", "GotoTown()");
- break;
- }
- if (!ask_tp_done) {
- Say("please create a TP, i cant follow you to this area");
- ask_tp_done = true;
- }
- }
- }
- } else {
- ask_tp_done = false;
- if (NTC_InTown()) {
- NTTMGR_TownManager(true);
- Delay(1000);
- } else {
- NTM_MoveTo(leader.areaid, leader.x, leader.y);
- }
- }
- }
- Delay( 100 );
- }
- NTC_SendMsgToScript("NTBotGame.ntj", "SCRIPT_END");
- }
- function DBGPRT(msg)
- {
- if (NTConfig_Simon_Debug)
- Print("�c8" + msg);
- }
- function GetLeaderArea()
- {
- var find = NTC_FindUnit(NTC_UNIT_PLAYER, NTConfig_Simon_Leader);
- if (find != null)
- return find.areaid;
- var player = GetPlayerUnit();
- while(player.GetNext())
- {
- if (player.name == NTConfig_Simon_Leader)
- return player.areaid;
- }
- return 0;
- }
- function GetLeaderObj()
- {
- var player = GetPlayerUnit();
- while(player.GetNext())
- {
- if (player.name == NTConfig_Simon_Leader)
- return player;
- }
- return null;
- }
- function GotoTown(portal_spot)
- {
- var i = 0;
- for (; i <= 5; i++) {
- if (!NTTM_CheckAct())
- continue;
- if(portal_spot && !NTTM_TownMove("portalspot"))
- continue;
- break;
- }
- return (i != 5);
- }
- function MoveToStair(trys, cur, nxt)
- {
- for(var i = 0; i < trys; i++) {
- if (NTM_MoveToStair(cur, nxt))
- return true;
- }
- return false;
- }
- function ClickPlayerPortal(object, dest)
- {
- for(var i = 0 ; i < 20 ; i++)
- {
- if((i % 5) == 0)
- {
- if(i == 10)
- NTM_MoveTo(me.areaid, me.x+6, me.y+6);
- if(NTM_GetCloserInt(object))
- NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, object);
- }
- NTC_Delay(200);
- if(me.areaid == 0 || me.areaid == dest)
- break;
- }
- while(me.areaid == 0)
- NTC_Delay(50);
- return (me.areaid == dest);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement