Register for your free account! | Forgot your password?

You last visited: Today at 18:36

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



tele switch

Discussion on tele switch within the Diablo 2 Programming forum part of the Diablo 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Mar 2009
Posts: 16
Received Thanks: 0
tele switch

ich bräuchte eine tele switch funktion für meinen barb hat jemand eine ahnund wie ich die in meine move datei einbauen kann? hier mal die datei. vielen dank im vorraus
Code:
function NTM_MoveTo(areaid, x, y, retry, clearpath)
{
var i, n;
var _teleport;
var _path;
var _retry = 0;

if(x == me.x && y == me.y)
return true;

if(arguments.length < 4)
retry = 3;

if(arguments.length < 5)
clearpath = false;

if(NTC_InTown() || NTC_GetSkillLevel(54) < 1)
_teleport = false;
else
_teleport = true;

_path = GetPath(areaid, me.x, me.y, x, y, _teleport);

if(!_path)
return false;

for(i = 0 ; i < _path.length ; i++)
{
for(n = 0 ; n < 2 ; n++)
{
if(_teleport)
{
if(NTM_TeleportTo(_path[i][0]+Random(-n, n), _path[i][1]+Random(-n, n)))
break;
}
else
{
if(NTC_InTown()) {
if(NTM_WalkTo(_path[i][0], _path[i][1]))
break;
}
else {
NTC_SendLogToOOG(NTC_LOG_COMMON, "ÿc8" + "Enigmabug - quit game");
ExitGame();
}
}
}

if(n < 2)
{
if(clearpath)
{
if(!NTA_ClearPosition(20, true, 2))
return false;

NTP_DoPrecast(false);

NTM_MoveTo(me.areaid, _path[i][0], _path[i][1], 1);
}
}
else if(_retry < retry)
{
_path = GetPath(areaid, me.x, me.y, x, y, _teleport);

if(!_path)
return false;

i = -1;
_retry++;
}
else
return false;
}

return true;
} 

function NTM_MoveToPresetUnit(areaid, unittype, classid, offsetx, offsety, clearpath)
{
	var i, n;
	var _unit;

	if(arguments.length < 4)
	{
		offsetx = 0;
		offsety = 0;
	}

	if(arguments.length < 6)
		clearpath = false;

	for(i = 0 ; i <= 2 ; i++)
	{
		_unit = GetPresetUnits(areaid, unittype);

		if(_unit)
		{
			for(n = 0 ; n < _unit.length ; n++)
			{
				if(_unit[n].id == classid)
					return NTM_MoveTo(areaid, _unit[n].roomx*5+_unit[n].x+offsetx, _unit[n].roomy*5+_unit[n].y+offsety, 3, clearpath);
			}
		}

		if(i < 2)
			NTC_Delay(500);
	}

	return false;
}

function NTM_MoveToStair(areaid, subareaid, offsetx, offsety, clearpath)
{
	var i, n;
	var _unit;

	if(arguments.length < 3)
	{
		offsetx = 0;
		offsety = 0;
	}

	if(arguments.length < 5)
		clearpath = false;

	for(i = 0 ; i <= 2 ; i++)
	{
		_unit = GetPresetUnits(areaid, NTC_UNIT_TILE);

		if(_unit)
		{
			for(n = 0 ; n < _unit.length ; n++)
			{
				if(_unit[n].subareaid == subareaid)
					return NTM_MoveTo(areaid, _unit[n].roomx*5+_unit[n].x+offsetx, _unit[n].roomy*5+_unit[n].y+offsety, 3, clearpath);
			}
		}

		if(i < 2)
			NTC_Delay(500);
	}
 
	return false;
}

function NTM_TeleportTo(x, y)
{
	NTC_CastSkill(54, NTC_HAND_RIGHT, x, y);

	for(var i = 0 ; i < 15 ; i++)
	{
		if(Math.abs(me.x-x) < 4 && Math.abs(me.y-y) < 4)
			return true;

		NTC_Delay(NTC_DELAY_FRAME);
	}

	return false;
}

function NTM_WalkTo(x, y)
{
	var i;
	var _prex1, _prey1;
	var _prex2, _prey2;

	if(me.runwalk == 0)
		me.runwalk = 1;

	for(i = 0 ; i < 480 ; i++)
	{
		if((i % 10) == 0)
		{
			if((i % 60) == 0)
			{
				_prex1 = me.x;
				_prey1 = me.y;

				if((i % 120) == 0)
				{
					_prex2 = me.x;
					_prey2 = me.y;
				}
			}

			ClickMap(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, x, y);
		}

		NTC_Delay(NTC_DELAY_FRAME);

		if(Math.abs(me.x-x) < 2 && Math.abs(me.y-y) < 2)
			break;

		if((i % 10) == 9)
		{
			ClickMap(NTC_CLICK_LUP, NTC_SHIFT_NONE, null);
			NTC_Delay(NTC_DELAY_FRAME);

			if((i % 60) == 59)
			{
				if(me.x == _prex1 && me.y == _prey1 && !NTC_InTown())
				{
					NTA_ClearPosition(2);

					NTP_DoPrecast(false);
				}

				if((i % 120) == 119 && me.x == _prex2 && me.y == _prey2)
					return false;
			}
		}
	}

	ClickMap(NTC_CLICK_LUP, NTC_SHIFT_NONE, null);
	NTC_Delay(NTC_DELAY_FRAME);

	return (i < 480);
}

function NTM_TakeUnit(unittype, classid)
{
	var _unit;
	var _prearea;

	_unit = NTC_FindUnit(unittype, classid, 5);

	if(!_unit)
		return false;

	_prearea = me.areaid;

	for(var i = 0 ; i < 20 ; i++)
	{
		if((i % 5) == 0)
		{
			if(i == 10)
				NTM_MoveTo(_prearea, me.x+6, me.y+6);

			if(NTM_GetCloserInt(_unit))
				NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _unit);
		}

		NTC_Delay(200);

		if(me.areaid != _prearea)
			break;
	}

	while(me.areaid == 0)
		NTC_Delay(200);

	if(me.areaid == _prearea)
		return false;

	NTC_PingDelay(NTConfig_AreaDelay);

   	return true;
}

function NTM_TakeStair(areaid)
{

	var _unit;
	var _prearea;

	_unit = NTM_GetStairInt(areaid);

	if(!_unit)
		return false;

	_prearea = me.areaid;

	for(var i = 0 ; i < 20 ; i++)
	{
		if((i % 5) == 0)
		{
			if(i == 10)
				NTM_MoveTo(_prearea, me.x+6, me.y+6);

			if(NTM_GetCloserInt(_unit))
				NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _unit);
		}

		NTC_Delay(200);

		if(me.areaid != _prearea)
			break;
	}

	while(me.areaid == 0)
		NTC_Delay(200);

	if(me.areaid == _prearea)
		return false;

	NTC_PingDelay(NTConfig_AreaDelay);


   	return true;
}

function NTM_TakeWaypoint(areaid)
{
	var _unit;

	if(me.areaid == areaid)
		return true;

	_unit = NTM_GetWaypointInt();

	if(!_unit)
		return false;

	if(NTC_InTown())
		me.Cancel(1);

	for(var i = 0 ; i < 20 ; i++)
	{
		if((i % 10) == 0)
		{
			if(NTM_GetCloserInt(_unit))
				NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _unit);
		}

		NTC_Delay(200);

		if(GetUIState(0x14))
		{
			if(me.TakeWaypoint(areaid))
			{
				NTC_PingDelay(NTConfig_AreaDelay);
				return true;
			}

			break;
		}
	}

	return false;
}

function NTM_UsePortal(how, dest, ownername, portal)
{
	if(me.areaid == dest)
		return true;

	if(NTC_InTown())
		me.Cancel(1);

	if(NTM_ChangeAreaInt(how, dest, ownername, portal))
	{
		NTC_PingDelay(NTConfig_AreaDelay);
		return true;
	}

	return false;
}

function NTM_MakeTP(dest)
{
	var _usetp = true;
	var _portal;
	var _portalname;

	if(NTC_InTown())
		return true;

	if(arguments.length < 1)
		_usetp = false;

	if(!NTC_CastSkill(220, NTC_HAND_RIGHT))
		return false;

	NTC_PingDelay(500);

	_portalname = GetLocaleString(3226);

	for(var i = 0 ; i <= 2 ; i++)
	{
		_portal = NTC_FindUnit(NTC_UNIT_OBJECT, _portalname);

		if(_portal)
		{
			do
			{
				if(_portal.mode == 2 && NTC_CheckOwner(_portal))
				{
					if(_usetp)
						return NTM_UsePortal("BluePortal", dest, me.name, _portal);

					return true;
				}
			} while(_portal.GetNext());
		}

		if(i < 2)
			NTC_Delay(500);
	}

	return false;
}

// Internal function
function NTM_GetStairInt(areaid)
{
	var _tile;

	for(var i = 0 ; i <= 2 ; i++)
	{
		_tile = NTC_FindUnit(NTC_UNIT_TILE);

		if(_tile)
		{
			do
			{
				if(!areaid || _tile.subareaid == areaid)
					return _tile;
			} while(_tile.GetNext());
		}

		if(i < 2)
			NTC_Delay(500);
	}

	return null;
}

function NTM_GetWaypointInt()
{
	var _waypoint;
	var _classid;

	for(var i = 0 ; i <= 2 ; i++)
	{
		_waypoint = NTC_FindUnit(NTC_UNIT_OBJECT);

		if(_waypoint)
		{
			do
			{
				_classid = _waypoint.classid;

				if(_classid == 119 || _classid == 145 || _classid == 156 || _classid == 157
					|| _classid == 237 || _classid == 238 || _classid == 288 || _classid == 323
					|| _classid == 324 || _classid == 398 || _classid == 402 || _classid == 429
					|| _classid == 494 || _classid == 496 || _classid == 511 || _classid == 539)
					return _waypoint;
			} while(_waypoint.GetNext());
		}

		if(i < 2)
			NTC_Delay(500);
	}

	return null;
}

function NTM_ChangeAreaInt(how, dest, ownername, myportal)
{
	var _portal;
	var _playerportal = false;
	var _prearea;

	if(how == "BluePortal")
	{
		if(!ownername)
			ownername = me.name;

		_playerportal = true;
	}

	if(arguments.length > 3 && myportal)
		_portal = myportal;
	else
	{
		_portal = NTM_FindCorrectPortalInt(_playerportal, ownername);

		if(_portal < 0)
			_portal = NTM_FindPortalAreaInt(dest);

		if(_portal == -1)
			return false;
	}

	if(!_portal)
		return false;

	_prearea = me.areaid;

	for(var i = 0 ; i < 20 ; i++)
	{
		if((i % 5) == 0)
		{
			if(i == 10)
				NTM_MoveTo(_prearea, me.x+6, me.y+6);

			if(NTM_GetCloserInt(_portal))
				NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _portal);
		}

		NTC_Delay(200);

		if(me.areaid != _prearea)
			break;
	}

	while(me.areaid == 0)
		NTC_Delay(200);

	return (me.areaid == dest);
}

function NTM_FindCorrectPortalInt(blueportal, ownername)
{
	var _portal;
	var _portalname;

	_portalname = GetLocaleString(3226);

	if(blueportal)
	{
		for(var i = 0 ; i <= 2 ; i++)
		{
			_portal = NTC_FindUnit(NTC_UNIT_OBJECT, _portalname);

			if(_portal)
			{
				do
				{
					if(_portal.mode == 2 && NTC_CheckOwner(_portal, ownername) && GetDistance(me, _portal) <= 30)
						return _portal;
				} while(_portal.GetNext());
			}

			if(i < 2)
				NTC_Delay(500);
		}

		return -2;
	}
	else
	{
		for(var i = 0 ; i <= 2 ; i++)
		{
			_portal = NTC_FindUnit(NTC_UNIT_OBJECT, _portalname);

			if(_portal)
			{
				do
				{
					if(_portal.mode == 2 && !_portal.GetParent())
						return _portal;
				} while(_portal.GetNext());
			}

			if(i < 2)
				NTC_Delay(500);
		}
	}

	return -3;
}

function NTM_FindPortalAreaInt(dest)
{
	var _portal;
	var _portalname;

	_portalname = GetLocaleString(3226);

	for(var i = 0 ; i <= 2 ; i++)
	{
		_portal = NTC_FindUnit(NTC_UNIT_OBJECT, _portalname);

		if(_portal)
		{
			do
			{
				if(_portal.mode == 2 && _portal.subareaid == dest)
				{
					if(_portal.GetParent())
					{
						if(NTC_CheckOwner(_portal) || NTC_InMyParty(_portal.GetParent()))
							return _portal;
					}
					else
						return _portal;
				}
			} while(_portal.GetNext());
		}

		if(i < 2)
			NTC_Delay(500);
	}

	return -1;
}

function NTM_GetCloserInt(unit)
{
	if(GetDistance(me, unit) > 2)
		return NTM_MoveTo(unit.areaid, unit.x, unit.y);

	return true;
}

// vector class
function vector()
{
	if(arguments.length == 2)
	{
		this.x = arguments[0];
		this.y = arguments[1];
	}
	else if(arguments.length == 1)
	{
		this.x = arguments[0].x;
		this.y = arguments[0].y;
	}
	else
	{
		this.x = 0;
		this.y = 0;
	}
	
	this.rotate = vector_rotate;
	this.normalize = vector_normalize;
	this.length = vector_length;
	this.setlength = vector_setlength;
	this.toString = vector_toString;
	this.set = vector_set;
	this.angle = vector_angle;
}

function vector_rotate(degree)
{
	if(!degree)
		return true;

	l = this.length();
	if(!l)
		return false;

	this.normalize();

	rad = degree * (Math.PI/180);

	nx = this.x * Math.cos(rad) - this.y * Math.sin(rad);
	ny = this.x * Math.sin(rad) + this.y * Math.cos(rad);

	this.x = nx;
	this.y = ny;

	this.normalize();
	if(l != 1)
		this.setlength(l);

	return true;
}

function vector_angle(v)
{
	rad_degree = 180 / Math.PI;

	return Math.acos((this.x*v.x) + (this.y*v.y)) * rad_degree;
}

function vector_length()
{
	return Math.sqrt((this.x*this.x) + (this.y*this.y));
}

function vector_setlength(length)
{
	this.normalize();
	this.x *= length;
	this.y *= length;
}

function vector_normalize()
{
	l = this.length();
	if(!l)
		return false;

	this.x /= l;
	this.y /= l;

	return true;
}

function vector_toString()
{
	str = "(";
	str += Math.round(this.x*1000)/1000;
	str += " , ";
	str += Math.round(this.y*1000)/1000;
	str += ") : ";
	str += Math.round(this.length()*1000)/1000;

	return str;
}

function vector_set(tx, ty)
{
	if(arguments.length == 1)
	{
		this.x = tx.x;
		this.y = tx.y;
	}
	else if(arguments.length == 2)
	{
		this.x = tx;
		this.y = ty;
	}
}

// coord class
function coord()
{
	this.data = null;

	if(arguments.length == 3)
	{
		this.x = arguments[0];
		this.y = arguments[1];
		this.data = arguments[2];
	}
	else if(arguments.length == 2)
	{
		this.x = arguments[0];
		this.y = arguments[1];
	}
	else if(arguments.length == 1)
	{
		this.x = arguments[0].x;
		this.y = arguments[0].y;
	}
	else
	{
		this.x = 0;
		this.y = 0;
	}

	this.dist = coord_dist;
	this.dist2 = coord_dist2;
	this.dir = coord_dir;
	this.move = coord_move;
	this.set = coord_set;
	this.toString = coord_toString;
}

function coord_set(tx, ty, d)
{
	if(arguments.length == 1)
	{
		this.x = tx.x;
		this.y = tx.y;

		if(tx.data)
			this.data = tx.data;
		else
			this.data = null;
	}
	else if(arguments.length == 2)
	{
		this.x = tx;
		this.y = ty;
		this.data = null;
	}
	else if(arguments.length == 3)
	{
		this.x = tx;
		this.y = ty;
		this.data = d;
	}
}

function coord_dist(tx, ty)
{
	if(arguments.length == 1)
	{
		vx = this.x - tx.x;
		vy = this.y - tx.y;

		return Math.round(Math.sqrt((vx*vx) + (vy*vy)));	
	}
	else if(arguments.length == 2)
	{
		vx = this.x - tx;
		vy = this.y - ty;

		return Math.round(Math.sqrt((vx*vx) + (vy*vy)));
	}
}

function coord_dist2(tx, ty)
{
	if(arguments.length == 1)
	{
		vx = this.x - tx.x;
		vy = this.y - tx.y;

		return Math.floor((vx*vx) + (vy*vy));
	}
	else if(arguments.length == 2)
	{
		vx = this.x - tx;
		vy = this.y - ty;

		return Math.floor((vx*vx) + (vy*vy));
	}
}

function coord_dir(tx, ty)
{
	if(arguments.length == 1)
	{
		v = new vector(tx.x-this.x, tx.y-this.y);
		v.normalize();

		return v;
	}
	else if(arguments.length == 2)
	{
		v = new vector(tx-this.x, ty-this.y);
		v.normalize();

		return v;
	}
}

function coord_move(vec, d)
{
	if(d)
	{
		this.x += Math.round(vec.x*d);
		this.y += Math.round(vec.y*d);

		return true;
	}
	else if(vec.length())
	{
		this.x += Math.round(vec.x);
		this.y += Math.round(vec.y);

		return true;
	}

	return false;
}

function coord_toString()
{
	return "( " + this.x + " , " + this.y + " ) " + this.data;
}
minxx is offline  
Old 05/09/2011, 07:09   #2
 
elite*gold: 0
Join Date: Aug 2009
Posts: 435
Received Thanks: 159
das nächste mal bitte in [.code] [./code] ohne die Punkte davor. erhöht die Lesbarkeit enorm und macht deinen Beitrag nicht so elend lang...

erhöht auch die Chancen dass sich das überhaupt jemand durchliest und versucht zu helfen
DeathFromHeaven is offline  
Thanks
1 User
Old 05/09/2011, 08:54   #3
 
elite*gold: 0
Join Date: Mar 2009
Posts: 16
Received Thanks: 0
dank dir ich mach nen neues auf
minxx is offline  
Old 05/09/2011, 12:24   #4
 
elite*gold: 0
Join Date: Aug 2009
Posts: 435
Received Thanks: 159
den "Thanks"-Button zu drücken hat noch niemandem geschadet

so nun aber zu deinem Problem:

welchen Bot nutzt du denn? Bei Sternenlooper und auch Muddys ist meiner Meinung nach ein Tele-switch dabei, aslo dass er zum Telen den Waffenslot wechselt.

Kannst es dir da ja mal angucken, falls du aber was ganz anderes meinst, dann habsch dich wohl falsch verstanden^^

LG
DeathFromHeaven is offline  
Thanks
1 User
Reply

Tags
tele switch


Similar Threads Similar Threads
Dss switch rek
05/10/2011 - Metin2 - 10 Replies
Wollte mal wissen was ihr für erfahrung gemacht habt mit dss switch vom rek. zB habe ein rek mit 15%dss und eins mit 27%dss und bin am überlegen ob ich meine dr (drachenmünzen) für "Gegenstand verzaubern" mal investieren sollte. Das Rek sollte dann schon 41dss habe und mehr:rolleyes:. Hat jemnd damit schon erfahrung gemacht? Und wenn ja wieviel "Gegenstand verzaubern" musstest du investieren?
DSS Switch Bot?!
02/01/2011 - Metin2 Private Server - 10 Replies
Hallo Liebe Com. Da ich schon gesehen habe das es einer hinbekommen hat, einen Bot zu Skripten der die bonies solange switcht bis z.b. etwas zwischen 30-39 dss heraus kommt und dann aufhört. Aber dieser funzt bei fast keinem.. Und geht nur mit Waffen die 3 Steinslots bestizen also nur Nun ist meine Frage ob es villeicht jemand schaft einen solchen Bot richtig zu skripten das dieser voll funktionstüchtig ist. Und auch oder nur VMS switchen kann, und man einstellen kann das er erst dann...
Switch in C++
01/14/2011 - C/C++ - 4 Replies
Hi ich hab ein Problem bei der Switch-Funktion: // Quadratzahlengenerator.cpp : Definiert den Einstiegspunkt für die Konsolenanwendung. // #include "stdafx.h" #include <string> #include <iostream> #include <Windows.h>
NT BOT cd key switch
03/30/2009 - Diablo 2 - 1 Replies
also hab jetzt ne MPQ datei erstellt in den diablo 2 ordner also mein zweiter cd key meine frage jetzt hab ich ein cd key installiert und von ein cd key eine mpq datei erstellt wie muss ich das beim ntbot manager eingeben da steht jetzt an der seite wie viele cd keys man benutzt soll ich jetzt 2 keys eingeben oder 1 ??? weil hab jetzt 1 cd key angegeben und in die leiste CDKEY!.mpq reingeschrieben aber wenn er jetzt ein game gemacht hat restartet er diablo 2 wieso ??
FB and SS switch?
02/05/2006 - Conquer Online 2 - 8 Replies
Hey guys, I was just wondering if there was anyway to change the FB image with the SS image. I know it sounds weird but i can aim better with the ss image..Please help me or PM me. Thanks guys. btw...I love all your guys work.Ill start to post more. lolx :bandit: :bandit: :bandit: :bandit:



All times are GMT +2. The time now is 18:36.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.