View Full Version : D2BS - Script Help Plz


cipek
06-24-2004, 03:43 PM
Ok Guys I Give A Script...
Whats Wrong Here????
/*
cCountess v1.0 By Cipek
Cipek125@wp.pl
Description:
This bot simulates killing Ice Countess and collecting the loot.
It will pathfind to the chamber, then destroy her.

Credits:
Cipek
D2BS Team
*/
include("BotOS\\Pathing\\BotOS.Pathing.d2l");
var TestLogger = new BotOS.Logging.Log("output\\maptest.log", 0, 0);
include("imove.d2l");
include("mAndyLibs.dbl");
TestLogger.InitializeLog();
function main()
{
print("˙c3:: ˙c0Running ˙c4MyCountess v1.0. ˙c0Created by: ˙c2Cipek");
delay(rnd(500,1000));
if (me.act != 1)
{
GotoWaypoint();
}
print("˙c3:: ˙c0Going to heal.");
GoHeal();
print("˙c3:: ˙c0Time to head to the Black Marsh.");
GoMarsh();
delay(rnd(1000,5000));
print("˙c3:: ˙c0Time to head to the Forgotten Tower.");
GoTower();
delay(rnd(500,1000));
print("˙c3:: ˙c0Time to head to the Tower Cellar Level 1.");
Tower();
delay(rnd(500,1000));
print("˙c3:: ˙c0Time to head to the Tower Cellar Level 1.");
Cellar1();
delay(rnd(500,1000));
print("˙c3:: ˙c0Time to head to the Tower Cellar Level 2.");
Cellar2();
delay(rnd(500,1000));
print("˙c3:: ˙c0Time to head to the Tower Cellar Level 3.");
Cellar3();
delay(rnd(500,1000));
print("˙c3:: ˙c0Time to head to the Tower Cellar Level 4.");
Cellar4();
delay(rnd(500,1000));
print("˙c3:: ˙c0Time to kill Countess.");
KillCountess();
}
function GotoWaypoint()
{
iMove_Initiate();
iMove_GoToArea(me.act,iMove_WP);
delay(rnd(1750,2000));
iMove_GoToAct(1);
if(me.act == 1)
{
print("˙c3:: ˙c0Arrived in act one...");
}
}
function GoHeal()
{
iMove_Initiate();
iMove_GoToArea(me.act,iMove_HEAL);
npc = getUnit(1, "Akara");
npc.move();
npc.interact();
delay(rnd(250,500));
npc.interact(3);
}
function GoMarsh()
{
iMove_Initiate();
iMove_GoToArea(me.act,iMove_WP);
wp = getUnit(2, "Waypoint");
if (wp)
{
wp.move();
delay(rnd(1750,2000));
wp.interact(1,5);
delay(250);
}
else
{
print("˙c3:: ˙c0Error, can't find the waypoint.");
delay(250);
print("˙c1ABORTING GAME.");
quit();
}
}
function GoTower()
{
delay(5000)
me.overhead("˙c0 Looking For Tower");
delay(100)
try
{
var Area = new BotOS.Pathing.Map({Area:me.area, Name:"MATTSMAP"});
Area.Initialize();
var Pather = new BotOS.Pathing.Pather({Pathable:Area, PathToMap:true});
Pather.FindPathToArea(D2JSP_AREA_FORGOTTEN_TOWER, me.x, me.y, 15, mlREDUCESORC, mlASTAR, mlFHDIAGSHORTCUT, 1.4);
var Mover = new BotOS.Linear.Mover({Pather:Pather});
print("˙c3:: ˙c0Moving to Forgotten Tower.");
Mover.PathMove();
}
catch(e)
{
print("˙c3:: ˙c0Error, can't do pathfinding.");
delay(250);
print("˙c1ABORTING GAME.");
quit();
}
delay(500);
UnitTower = getUnit(5);
if (UnitTower) { UnitTower.interact(); }
else { AbortGame("Couldn't locate stairs"); }
}
function Tower() //in tower
{
try
{
var Area = new BotOS.Pathing.Map({Area:me.area, Name:"MATTSMAP"});
Area.Initialize();
var Pather = new BotOS.Pathing.Pather({Pathable:Area, PathToMap:true});
Pather.FindPathToArea(D2JSP_AREA_TOWER_CELLAR_LEVE L_1, me.x, me.y, 15, mlREDUCESORC, mlASTAR, mlFHDIAGSHORTCUT, 1.4);
var Mover = new BotOS.Linear.Mover({Pather:Pather});
print("˙c3:: ˙c0Moving to Tower Cellar Level 2.");
Mover.PathMove();
}
catch(e)
{
print("˙c3:: ˙c0Error, can't do pathfinding.");
delay(250);
print("˙c1ABORTING GAME.");
quit();
}
delay(500);
ClickStairs();
}
function Cellar1()
{
try
{
var Area = new BotOS.Pathing.Map({Area:me.area, Name:"MATTSMAP"});
Area.Initialize();
var Pather = new BotOS.Pathing.Pather({Pathable:Area, PathToMap:true});
Pather.FindPathToArea(D2JSP_AREA_TOWER_CELLAR_LEVE L_2, me.x, me.y, 15, mlREDUCESORC, mlASTAR, mlFHDIAGSHORTCUT, 1.4);
var Mover = new BotOS.Linear.Mover({Pather:Pather});
print("˙c3:: ˙c0Moving to Tower Cellar Level 3.");
Mover.PathMove();
}
catch(e)
{
print("˙c3:: ˙c0Error, can't do pathfinding.");
delay(250);
print("˙c1ABORTING GAME.");
quit();
}
delay(500);
ClickStairs();
}
function Cellar2()
{
try
{
var Area = new BotOS.Pathing.Map({Area:me.area, Name:"MATTSMAP"});
Area.Initialize();
var Pather = new BotOS.Pathing.Pather({Pathable:Area, PathToMap:true});
Pather.FindPathToArea(D2JSP_AREA_TOWER_CELLAR_LEVE L_3, me.x, me.y, 15, mlREDUCESORC, mlASTAR, mlFHDIAGSHORTCUT, 1.4);
var Mover = new BotOS.Linear.Mover({Pather:Pather});
print("˙c3:: ˙c0Moving to Tower Cellar Level 4.");
Mover.PathMove();
}
catch(e)
{
print("˙c3:: ˙c0Error, can't do pathfinding.");
delay(250);
print("˙c1ABORTING GAME.");
quit();
}
delay(500);
ClickStairs();
}
function Cellar3()
{
try
{
var Area = new BotOS.Pathing.Map({Area:me.area, Name:"MATTSMAP"});
Area.Initialize();
var Pather = new BotOS.Pathing.Pather({Pathable:Area, PathToMap:true});
Pather.FindPathToArea(D2JSP_AREA_TOWER_CELLAR_LEVE L_4, me.x, me.y, 15, mlREDUCESORC, mlASTAR, mlFHDIAGSHORTCUT, 1.4);
var Mover = new BotOS.Linear.Mover({Pather:Pather});
print("˙c3:: ˙c0Moving to Tower Cellar Level 4.");
Mover.PathMove();
}
catch(e)
{
print("˙c3:: ˙c0Error, can't do pathfinding.");
delay(250);
print("˙c1ABORTING GAME.");
quit();
}
delay(500);
ClickStairs();
}
function Cellar4()
{
try
{
var Area = new BotOS.Pathing.Map({Area:me.area, Name:"MATTSMAP"});
Area.Initialize();
var Pather = new BotOS.Pathing.Pather({Pathable:Area, PathToMap:true});
Pather.FindPathToArea(D2JSP_AREA_TOWER_CELLAR_LEVE L_5, me.x, me.y, 15, mlREDUCESORC, mlASTAR, mlFHDIAGSHORTCUT, 1.4);
var Mover = new BotOS.Linear.Mover({Pather:Pather});
print("˙c3:: ˙c0Moving to Tower Cellar Level 5.");
Mover.PathMove();
}
catch(e)
{
print("˙c3:: ˙c0Error, can't do pathfinding.");
delay(250);
print("˙c1ABORTING GAME.");
quit();
}
delay(500);
ClickStairs();
}
function ClickStairs()
{
UnitStairs = getUnit(5,3);
if (UnitStairs) { UnitStairs.interact(); }
else { AbortGame("Couldn't locate stairs"); }
}
function KillAndy()
{
while(me.mp >= me.maxmp/2)
{
delay(1000)
}
var Area = new BotOS.Pathing.Map({Area:me.area, Name:"MATTSMAP"});
Area.Initialize();
var Pather = new BotOS.Pathing.Pather({Pathable:Area, PathToMap:true});
Pather.FindPath(me.x, me.y, 22548,9550, 15, mlREDUCESORC, mlASTAR, mlFHDIAGSHORTCUT, 1.4);
var Mover = new BotOS.Linear.Mover({Pather:Pather});
print("˙c3:: ˙c0Moving To Countess.");
Mover.PathMove();
countess = getUnit(1,"The Countess");
print("˙c3:: ˙c0Killing Countess.");
while(countess.hp != 0)
{
me.setSkill(LeftSkill,1);
clickMap(3, 0,countess);
clickMap(5, 0,countess);
delay(100);


me.setSkill(RightSkill,0);
clickMap(3,0,UnitMephisto);
clickMap(5,0,UnitMephisto);
delay(100);
}
print("˙c3:: ˙c0Countess dead, collecting drops.");
delay(2250);
print("˙c3:: ˙c0Run ˙c2Completed ˙c1Exiting.");
quit();
}
function CheckRepairs()
{
var lowestitem = 100;
var check = getUnit(4);
var checkitem;
if (check) do
{
var owner = check.getParent();
if (owner && owner.name == me.name && check.mode == 1)
{
if(check.getStat(73) > 0)
{
if (check.getStat(75) > 0)
{
currentitem = parseInt(((check.getStat(72) * check.getStat(75)) / check.getStat(73)) * 100);
print(currentitem);
}
}
else
{
currentitem = parseInt((check.getStat(72) / check.getStat(73)) * 100);
print(currentitem);
}
if (currentitem < lowestitem)
{
lowestitem = currentitem;
}
if (currentitem <= 22)
{
print("end checkforrepair");
return true;
}
}
}
while (check.getNext());
return false;
} I Know Bad Is Something While Entering Tower Cellar Level1
Plz Help