function main() { MoveToWPAndTakeIt(6); MoveToCountess(); _Countess = getUnit(2, "Countess"); if(_Countess) { print("ÿc1Detected Countess!"); TeleTo(_Countess.x, _Countess.y); } } function MoveToCountess() { me.setSkill(54, 1); var Tiles = [10,12,9,9,9,9]; for(i=0; i < Tiles.length; i++) { DoTile(Tiles[i], true); } DoObj(580); } function DoObj(id) { obj = getPresetUnits(me.area, 2, id)[0]; if(!obj) return false; _x = obj.roomx * 5 + obj.x; _y = obj.roomy * 5 + obj.y; TeleTo(_x,_y); _unit = getUnit(2, id); } function DoTile(id, interact) { entracetile = getPresetUnits(me.area, 5, id)[0]; if(!entracetile) return false; _x = entracetile.roomx * 5 + entracetile.x; _y = entracetile.roomy * 5 + entracetile.y; TeleTo(_x,_y); _unit = getUnit(5, id); if(interact) { oldarea = me.area; while(me.area == oldarea) { _unit.interact(); delay(250); } } } function MoveToWPAndTakeIt(id) { var wpids = [ 119, 156, 237, 398, 429 ]; wp = getPresetUnits(me.area, 2, wpids[me.act - 1])[0]; wpx = wp.roomx * 5 + wp.x; wpy = wp.roomy * 5 + wp.y; if(!WalkTo(wpx, wpy)) return false; var b = false; while(!b) { _wp = getUnit(2, wpids[me.act - 1]); delay(100); if(_wp) b=true; } oldarea = me.area; while(oldarea == me.area) { print("Attempt to take wp!"); _wp.interact(id); delay(250); } print("New area:" + me.area); return true; } function TeleTo(x,y) { var _time = 0; var i = 0; _path = getPath(me.area, me.x, me.y, x,y); while(i < _path.length) { if(me.mode != 1) { delay(100); continue; } if(_time == 0) { clickMap(3,0, _path[i][0], _path[i][1]); clickMap(5,0, _path[i][0], _path[i][1]); } else if(_time >= 7 && me.mode == 1) { _path = getPath(me.area, me.x, me.y, x,y); if(!_path) return false; _time = 0; i = 0; continue; } if(getDistance(me.x, me.y, _path[i][0], _path[i][1]) <= 2) { i++; _time = 0; continue; } _time ++; delay(100); } return true; } function WalkTo(x,y) { var _time = 0; var i = 0; _path = getPath(me.area, me.x, me.y, x,y); while(i < _path.length) { if(me.mode != 5) { delay(100); continue; } if(_time == 0) { clickMap(0,0, _path[i][0], _path[i][1]); clickMap(1,0, _path[i][0], _path[i][1]); } else if(_time >= 13 && me.mode == 5) { clickMap(0,0, me.x+1, me.y); clickMap(1,0, me.x+1, me.y); while(me.mode != 5) delay(100); _path = getPath(me.area, me.x, me.y, x,y); if(!_path) return false; i = 0; _time = 0; continue; } if(getDistance(me.x, me.y, _path[i][0], _path[i][1]) <= 2 && me.mode == 5) { i++; _time = 0; continue; } _time ++; delay(100); } return true; }