Пользователь
Регистрация: 20.05.2008
Адрес: Arg.
Сообщений: 35
Сказал Спасибо: 2
Имеет 3 спасибок в 2 сообщенях
|
Hello
Цитата:
Сообщение от QaK
charly911, if you use Script by Voron ("Бот кач локомотив") there is o lot of errrs in this script,because olny Voron (as I known) use and test this script, so if something did'nt work correct - try to fix by yourself.
Put there a code of the function to calculate distance, and example, where and how do you use it?
|
Here is the code i tried to use to calculate the nearest Mob in the area:
delphi Код:
---------------------------------------------------------------------
const PJname='UlTrApLeX';
var r,i,j,jMax,Listo,KNpcID,MoveID,MoveX,MoveY,MoveZ,PJID,PJY,PJX,PJZ,PJlvl,PJMaxHP,PJCurHP,PJMaxMP,PJCurMP,IDTemp:integer;
NpcNameStr,PJNames:string;
frm:TForm;
m:TMemo;
penel:TPanel;
button:TButton;
Label1:TLabel;
NpcID: array[1..100] of integer;
NpcName: array[1..100] of string;
NpcX: array[1..100] of integer;
NpcY: array[1..100] of integer;
NpcZ: array[1..100] of integer;
DisNpc: array[1..100] of integer;
{MoveX: array[1..100] of integer;
MoveY: array[1..100] of integer;
MoveZ: array[1..100] of integer;}
procedure Init; //Вызывается при включении скрипта
begin
frm := TForm.Create(nil);
frm.Caption := 'NPC Info - '+PJName+' - by ..::Charly::..';
frm.BorderStyle := bsSizeable;
frm.Position := poScreenCenter;
frm.Width:=360;
frm.Height:=900;
m:=TMemo.Create(frm);
m.parent:=frm;
m.align:=alClient;
m.ReadOnly:=true;
m.ScrollBars:=ssBoth;
penel:=TPanel.Create(frm);
penel.parent:=frm;
penel.align:=alBottom;
penel.Width:=150;
penel.height:=30;
button:=tbutton.Create(penel);
button.parent:=penel;
button.align:=alLeft;
button.Width:=45;
button.caption:='Buscar';
button.onClick:=@buscar;
button.hint:='busca el bicho mas cercano.';
Label1:=TLabel.Create(penel);
Label1.parent:=penel;
Label1.align:=alRight;
Label1.Width:=50;
Label1.Caption:=' 0 ';
i:=1;
j:=1;
jMax:=1;
Listo:=0;
frm.Show;
for i:=1 to 100 do
begin
NpcID[i]:=0;
NpcName[i]:='';
NpcX[i]:=0;
NpcY[i]:=0;
NpcZ[i]:=0;
end;
end;
procedure Free;
begin
frm.Free;
end;
procedure buscar;
begin
IDTemp:=999999999;
for i:=1 to 100 do
begin
if (DisNpc[i] > 0) and (DisNpc[i] < IDTemp) then
begin
IDTemp:=i;
end;
end;
if (DisNpc[IDTemp]>0) and (DisNpc[IDTemp]<>999999999) then
begin
buf:=#$01;
WriteD(NpcX[i]);
WriteD(NpcY[i]);
WriteD(NpcZ[i]);
WriteD(PJX);
WriteD(PJY);
WriteD(PJZ);
SendToServerEx(PJName);
m.Lines.Add('@%@% El bicho mas cercanos es: '+inttostr(IDTemp));
Label1.Caption:=' '+inttostr(i);
end;
end;
begin
if FromServer and (ConnectName=PJName) and (pck[1]=#$04) then
begin
PJX:=ReadD(2);
PJY:=ReadD(6);
PJZ:=ReadD(10);
PJID:=ReadD(18);
PJNames:=ReadS(22);
PJlvl:=ReadD(54);
PJMaxHP:=ReadD(86);
PJCurHP:=ReadD(90);
PJMaxMP:=ReadD(94);
PJCurMP:=ReadD(98);
m.Lines.Add('Nombre:'+(PJNames)+'.');
m.Lines.Add('->Coordenadas: X:'+inttostr(PJX)+' - Y:'+inttostr(PJY)+' - Z:'+inttostr(PJZ)+'.');
m.Lines.Add('->ID:'+inttostr(PJID)+'.');
m.Lines.Add('->lvl:'+inttostr(PJlvl)+'.');
m.Lines.Add('->MaxHP:'+inttostr(PJMaxHP)+'.');
m.Lines.Add('->CurHP'+inttostr(PJCurHP)+'.');
m.Lines.Add('->MaxMP'+inttostr(PJMaxMP)+'.');
m.Lines.Add('->CurMP'+inttostr(PJCurMP)+'.');
end;
//******************** -Pck-16- -NPC Info-***********************
if FromServer and (ConnectName=PJName) and (pck[1]=#$16) then
begin
listo:=0;
i:=1;
Repeat
i:=i+1;
if (NpcID[i]=0)and (Listo=0) then
begin
NpcID[i]:=ReadD(2);
NpcX[i]:=ReadD(14);
NpcY[i]:=ReadD(18);
NpcZ[i]:=ReadD(22);
DisNpc[i]:=((PJX-NpcX[i])*(PJX-NpcX[i]));
Listo:=1;
m.Lines.Add('-->NpcID: '+inttostr(NpcID[i]));
m.Lines.Add('-->NpcX: '+inttostr(NpcX[i])+' - NpcY: '+inttostr(NpcY[i])+' - NpcZ: '+inttostr(NpcZ[i]));
m.Lines.Add('-->Posicion: '+inttostr(i));
m.Lines.Add('-->Distancia del PJ: '+inttostr(DisNpc[i]));
m.Lines.Add('');
end;
if i=100 then Listo:=1;
until Listo=1;
end;
//**********************************************************
//********************* -Pck-12- -NPC Delete-***************
if FromServer and (ConnectName=PJName) and (pck[1]=#$12) then
begin
KNpcID:=ReadD(2);
listo:=0;
i:=0;
Repeat
i:=i+1;
if (NpcID[i]=KNpcID)and (Listo=0) then
begin
NpcID[i]:=0;
NpcX[i]:=0;
NpcY[i]:=0;
NpcZ[i]:=0;
DisNpc[i]:=0;
Listo:=1;
m.Lines.Add('-----> Posicion '+inttostr(i)+' liberada.');
m.Lines.Add('');
end;
if i=100 then Listo:=1;
until Listo=1;
end;
//*******************************************************
//******************** -Pck-01- -NPC Move- **************
if FromServer and (ConnectName=PJName) and (pck[1]=#$01) then
begin
MoveID:=ReadD(2);
MoveX:=ReadD(18);
MoveY:=ReadD(22);
MoveZ:=ReadD(26);
listo:=0;
i:=0;
if MoveID<>PJID then
begin
Repeat
i:=i+1;
if (MoveID<>0) and (NpcID[i]=MoveID)and (Listo=0) then
begin
NpcX[i]:=MoveX;
NpcY[i]:=MoveY;
NpcZ[i]:=MoveZ;
DisNpc[i]:=((PJX-NpcX[i])*(PJX-NpcX[i]));
Listo:=1;
m.Lines.Add('> NPC '+inttostr(NpcID[i])+' actualizado.');
m.Lines.Add('> X:'+inttostr(NpcX[i])+' - Y:'+inttostr(NpcY[i])+' - Z:'+inttostr(NpcZ[i])+'.');
m.Lines.Add('> Posicion:'+inttostr(i)+'.');
end;
if i=100 then Listo:=1;
until Listo=1;
end;
end;
if FromServer and (ConnectName=PJName) and (pck[1]=#$01) then
begin
MoveID:=ReadD(2);
MoveX:=ReadD(18);
MoveY:=ReadD(22);
MoveZ:=ReadD(26);
if MoveID=PJID then
begin
PJX:=MoveX;
PJY:=MoveY;
PJZ:=MoveZ;
m.Lines.Add('## Mi pos actualizada.')
end;
end;
end.
--------------------------------------------------------------------------
This is just a test i made, its all a mess :P
What i wanted to do was to create a data base of Mobs position, determine the nearest, and when i pressed the button, the PJ (Player) run to that location. Result: only some times worked, why? i don't know. :'(
I have to re-write it, but i have not enought time as i am working and i have to study.
Maybe this weekend i'll do it, with the corresponding explanation.
I made this script to add it into another, that worked. This is the main working script:
delphi Код:
--------------------------------------------------------------------------
{This is very stupid bot, that works fine :D
The way it search mobs is very simple.
He moves to one of four secific points, and all the time uses /targetnext
When he finaly targets a mob, he atacks, until mod is dead.
Then he try to target another, and if no mob is targeted he goes to another position.
If his HP goes less than 55%, he drinks a greater Healing Pot, and if it is lower than 10% he dispears (not log off, but mobs cant atack)
until his HP goes more than 1/2.
He also try to use skills every time he can.
To select the four positions, the only thing that must be made, is to clic one button (Pos1/2/3/4), an then clic on the place you want
to set it.
}
const PJName='UlTrApLeX';
var act,PotID1,PotID2,PotID3,PotID4:integer; me1:char; me2:char; me3:char; me4:char; nm:integer; t1:char; t2:char; t3:char; t4:char; nt:integer; shade:integer; mz:integer; pz:integer; tz:integer; hz:integer; MaxHP,CurHP,MaxMP,Shadow,CurMP,MaxCP,CurCP,ATT,TS,MyCorX,MyCorY,MyCorZ,CoordPpalX,CoordPpalY,CoordPpalZ,Contador,Posicion,Coord,Activo,Activo2,CoordX,CoordY,CoordZ,i: integer;
CoordX1,CoordX2,CoordX3,CoordY1,CoordY2,CoordY3,CoordZ1,CoordZ2,CoordZ3,CoordX4,CoordY4,CoordZ4,Espera,Esperando,AutoSelect,AutoSelect2,PJInfoAct,PJInfoAct2,p,RaceID,SexID,ClassID,MoveOK,MoveOK2,UsandoPot:integer;
m,m2,m3:TMemo; frm,frm2,frm3:TForm; Message,NombreDelPJ,Name,Sex,Race, Class: string;
button: tbutton;
etext3: TEdit;
IDdelPJ,VerificarID,Accuracy,Vicio,ShadowEterno,BichosMuertos:integer;
timer1,timer2,timer3: TTimer;
MiID,IDObtenida,IDTemporal,IDActualizable,NeedLoc,Comienzo:integer;
UltimaX,UltimaY,UltimaZ,UltimaXa,UltimaYa,UltimaZa,Memorizar,LocX1,LocX2,LocX3,LocX4,LocY1,LocY2,LocY3,LocY4,LocZ1,LocZ2,LocZ3,LocZ4:integer;
penel,penel2,penel3:TPanel;
ProgressBar1: TProgressBar;
Label1: TLabel;
penel4,penel0: TPanel;
statusBar: TStatusbar;
//
//000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
//
procedure Init;
begin
frm := TForm.Create(nil);
frm.Caption := 'Movimiento';
frm.BorderStyle := bsSizeable;
frm.Position := poScreenCenter;
frm.Width:=210;
frm.Height:=900;
m:=TMemo.Create(frm);
m.parent:=frm;
m.align:=alClient;
m.ReadOnly:=true;
m.ScrollBars:=ssBoth;
penel:=TPanel.Create(frm);
penel.parent:=frm;
penel.align:=alBottom;
penel.Width:=150;
penel.height:=30;
penel2:=TPanel.Create(frm);
penel2.parent:=frm;
penel2.align:=alBottom;
penel2.Width:=150;
penel2.height:=30;
penel3:=TPanel.Create(frm);
penel3.parent:=frm;
penel3.align:=alBottom;
penel3.Width:=150;
penel3.height:=30;
penel4:=TPanel.Create(frm);
penel4.parent:=frm;
penel4.align:=alBottom;
penel4.Width:=150;
penel4.height:=17;
{penel0:=TPanel.Create(frm);
penel0.parent:=frm;
penel0.align:=alBottom;
penel0.Width:=150;
penel0.height:=30;
StatusBar:=TStatusBar.Create(penel0);
StatusBar.parent:=penel0;
StatusBar.Width:=200; }
button:=tbutton.Create(penel);
button.parent:=penel;
button.align:=alLeft;
button.Width:=25;
button.caption:='ID';
button.onClick:=@VerifID;
button.hint:='Verifica ID del PJ.';
button:=tbutton.Create(penel);
button.parent:=penel;
button.align:=alLeft;
button.Width:=30;
button.caption:='1';
button.onClick:=@Memo1;
button.hint:='Memoriza ubicacion 1.';
button:=tbutton.Create(penel);
button.parent:=penel;
button.align:=alLeft;
button.Width:=30;
button.caption:='2';
button.onClick:=@Memo2;
button.hint:='Memoriza ubicacion 2.';
button:=tbutton.Create(penel);
button.parent:=penel;
button.align:=alLeft;
button.Width:=30;
button.caption:='3';
button.onClick:=@Memo3;
button.hint:='Memoriza ubicacion 3.';
button:=tbutton.Create(penel);
button.parent:=penel;
button.align:=alLeft;
button.Width:=30;
button.caption:='4';
button.onClick:=@Memo4;
button.hint:='Memoriza ubicacion 4.';
button:=tbutton.Create(penel);
button.parent:=penel;
button.align:=alLeft;
button.Width:=55;
button.caption:='Contador';
button.onClick:=@ContBichos;
button.hint:='Verifica ID del PJ.';
button:=tbutton.Create(penel2);
button.parent:=penel2;
button.align:=alLeft;
button.Width:=50;
button.caption:='Ir a 1';
button.onClick:=@IrMemo1;
button.hint:='Ir a ubicacion 1.';
button:=tbutton.Create(penel2);
button.parent:=penel2;
button.align:=alLeft;
button.Width:=50;
button.caption:='Ir a 2';
button.onClick:=@IrMemo2;
button.hint:='Ir a ubicacion 2.';
button:=tbutton.Create(penel2);
button.parent:=penel2;
button.align:=alLeft;
button.Width:=50;
button.caption:='Ir a 3';
button.onClick:=@IrMemo3;
button.hint:='Ir a ubicacion 3.';
button:=tbutton.Create(penel2);
button.parent:=penel2;
button.align:=alLeft;
button.Width:=50;
button.caption:='Ir a 4';
button.onClick:=@IrMemo4;
button.hint:='Ir a ubicacion 4.';
button:=tbutton.Create(penel3);
button.parent:=penel3;
button.align:=alLeft;
button.Width:=50;
button.caption:='On / Off';
button.onClick:=@ActDes;
button.hint:='Activa / Desactiva el BOT.';
button:=tbutton.Create(penel3);
button.parent:=penel3;
button.align:=alLeft;
button.Width:=70;
button.caption:='Auto Target';
button.onClick:=@AutoSel;
button.hint:='Auto Target On/Off.';
button:=tbutton.Create(penel3);
button.parent:=penel3;
button.align:=alLeft;
button.Width:=60;
button.caption:='Movimiento';
button.onClick:=@PMoveOK;
button.hint:='Movimiento automatico.';
button:=tbutton.Create(penel3);
button.parent:=penel3;
button.align:=alLeft;
button.Width:=20; ////////////////////////////////////
button.caption:='R';
button.onClick:=@Reset;
button.hint:='Resetea contador de Bichos matados.';
Label1:=TLabel.Create(penel4);
Label1.parent:=penel4;
Label1.align:=alLeft;
Label1.Width:=20;
Label1.Caption:=' HP: ';
Progressbar1:= tprogressbar.create(penel4);
Progressbar1.parent:=penel4;
Progressbar1.align:=alLeft;
Progressbar1.Width:=175;
Progressbar1.Height:=20;
Progressbar1.Step:=1;
Progressbar1.Max:=100;
Progressbar1.Min:=0;
//ProgressBar1.PbColor:=Red;
frm.Show; // Initialice Variables
MiID:=0;
Activo:=0;
Activo2:=1;
PjinfoAct:=0;
PJInfoAct2:=1;
AutoSelect:=0;
AutoSelect2:=1;
MoveOK:=0;
MoveOK2:=1;
ShadowEterno:=1;
UsandoPot:=0;
BichosMuertos:=0;
Progressbar1.Position:=0;
//******************
timer1:=TTimer.Create(nil);
timer1.OnTimer:=@OnTimer1;
timer1.enabled:=true;
timer1.interval:=500;
//*****************
timer2:=TTimer.Create(nil);
timer2.OnTimer:=@OnTimer2;
timer2.enabled:=true;
timer2.interval:=500;
//******************
timer3:=TTimer.Create(nil);
timer3.OnTimer:=@OnTimer3;
timer3.enabled:=true;
timer3.interval:=1000;
//******************
end;
procedure Free;
begin
m.Free;
frm.Free;
timer1.Free;
timer2.Free;
timer3.Free;
end;
procedure VerifID; // verify if i got my player ID
begin
if (IDObtenida=1) and (MiID<>0) then m.Lines.Add('ID obtenida correctamente. ID: '+inttostr(MiID));
end;
procedure Memo1;
begin
Memorizar:=1;
NeedLoc:=1;
end;
procedure Memo2;
begin
Memorizar:=2;
NeedLoc:=1;
end;
procedure Memo3;
begin
Memorizar:=3;
NeedLoc:=1;
end;
procedure Memo4;
begin
Memorizar:=4;
NeedLoc:=1;
end;
procedure IrMemo1; // move to memory location 1
begin
buf:=#$01;
WriteD(LocX1);
WriteD(LocY1);
WriteD(LocZ1);
WriteD(UltimaXa);
WriteD(UltimaYa);
WriteD(UltimaZa);
SendToServerEx(PJName);
m.Lines.Add('Ir Loc 1.');
end;
procedure IrMemo4; // move to memory location 4
begin
buf:=#$01;
WriteD(LocX4);
WriteD(LocY4);
WriteD(LocZ4);
WriteD(UltimaXa);
WriteD(UltimaYa);
WriteD(UltimaZa);
SendToServerEx(PJName);
m.Lines.Add('Ir Loc 4.');
end;
procedure IrMemo2; // move to memory location 2
begin
buf:=#$01;
WriteD(LocX2);
WriteD(LocY2);
WriteD(LocZ2);
WriteD(UltimaXa);
WriteD(UltimaYa);
WriteD(UltimaZa);
SendToServerEx(PJName);
m.Lines.Add('Ir Loc 2.');
end;
procedure IrMemo3; // move to memory location 3
begin
buf:=#$01;
WriteD(LocX3);
WriteD(LocY3);
WriteD(LocZ3);
WriteD(UltimaXa);
WriteD(UltimaYa);
WriteD(UltimaZa);
SendToServerEx(PJName);
m.Lines.Add('Ir Loc 3.');
end;
procedure ActDes; // Bot On/Off
begin
if Activo=1 then
begin
Activo:=0;
Activo2:=0;
Message:='Bot desactivado';
m.Lines.Add(Message);
end;
if (Activo=0) and (Activo2=1) then
begin
Activo:=1;
Message:='Bot activado';
m.Lines.Add(Message);
end;
Activo2:=1;
end;
procedure Reset; //not use :P
begin
end;
procedure PMoveOK; // Automatic movement On/Off
begin
if MoveOK=1 then
begin
MoveOK:=0;
MoveOK2:=0;
Message:='Movimiento automatico desactivado.';
m.Lines.Add(Message);
end;
if (MoveOK=0) and (MoveOK2=1) then
begin
MoveOK:=1;
Message:='Movomiento automatico activado.';
m.Lines.Add(Message);
end;
MoveOK2:=1;
end;
procedure AutoSel; // Auto Target On/Off
begin
if AutoSelect=1 then
begin
AutoSelect:=0;
AutoSelect2:=0;
Message:='Auto Select desactivado';
m.Lines.Add(Message);
end;
if (AutoSelect=0) and (AutoSelect2=1) then
begin
AutoSelect:=1;
Message:='Auto Select activado';
m.Lines.Add(Message);
end;
AutoSelect2:=1;
end;
//**********************************************************************
// SKILL
//
procedure OnTimer1(Sender: TObject); // Skill use
begin
if (TS=1) and (ATT=1) then
begin
{buf:=Hstr('2F 10 00 00 00 00 00 00 00 00 ');
SendToServer;
buf:=Hstr('45 02 00 00 00');
SendToServer;}
buf:=Hstr('2F 07 01 00 00 00 00 00 00 00');
SendToServerEx(PJName);
buf:=Hstr('45 02 00 00 00');
SendToServerEx(PJName);
end;
end;
//*************************************************
// AUTO SELECT
//
procedure OnTimer2(Sender: TObject); // Targetnext
begin
if (TS=0) and (AutoSelect=1) {and (Espera=0)} then
begin
buf:=Hstr('45 04 00 00 00'); // Selecciona.
SendToServerEx(PJName);
end;
end;
//*************************************************
// ATACAR!!!
//
procedure OnTimer3(Sender: TObject); // Atackkk
begin
if (Ts=1) then
begin
buf:=Hstr('45 02 00 00 00'); // Ataca.
SendToServerEx(PJName);
ATT:=1;
end;
end;
//*********************************************
procedure ContBichos; // Shows number of killed mobs
begin
m.lines.Add('.........................');
m.lines.Add('Total de Bichos matados: '+inttostr(BichosMuertos));
m.lines.Add('.........................');
end;
//
//000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
//
begin
// Obtener ID del PJ - Obtain Players ID
if FromServer and (ConnectName=PJName) and (pck[1]=#$04) then
begin
MiID:=ReadD(18);
IDObtenida:=1;
end;
// *****************************************************************************
if FromServer and (ConnectName=PJName) and (pck[1]=#$01) then // Update Pos
begin
IDTemporal:=ReadD(2);
if IDTemporal=MiID then
begin
UltimaXa:=ReadD(6);
UltimaYa:=ReadD(10);
UltimaZa:=ReadD(14);
UltimaX:=ReadD(18);
UltimaY:=ReadD(22);
UltimaZ:=ReadD(26);
{m.Lines.Add('Recibido correctamente...');
m.Lines.Add('Coordenadas:');
m.Lines.Add(' Xa:'+inttostr(UltimaXa));
m.Lines.Add(' Ya:'+inttostr(UltimaYa));
m.Lines.Add(' Za:'+inttostr(UltimaZa));
m.Lines.Add(' X:'+inttostr(UltimaX));
m.Lines.Add(' Y:'+inttostr(UltimaY));
m.Lines.Add(' Z:'+inttostr(UltimaZ));}
IDActualizable:=1;
if NeedLoc=1 then
begin
if Memorizar=1 then // Updates memory Loc1
begin
LocX1:=UltimaXa;
LocY1:=UltimaYa;
LocZ1:=UltimaZa;
Memorizar:=0;
m.Lines.Add('Memoria 1 actualizada.');
end;
if Memorizar=2 then // Updates memory Loc2
begin
LocX2:=UltimaXa;
LocY2:=UltimaYa;
LocZ2:=UltimaZa;
Memorizar:=0;
m.Lines.Add('Memoria 2 actualizada.');
end;
if Memorizar=3 then // Updates memory Loc3
begin
LocX3:=UltimaXa;
LocY3:=UltimaYa;
LocZ3:=UltimaZa;
Memorizar:=0;
m.Lines.Add('Memoria 3 actualizada.');
end;
if Memorizar=4 then // Updates memory Loc4
begin
LocX4:=UltimaXa;
LocY4:=UltimaYa;
LocZ4:=UltimaZa;
Memorizar:=0;
m.Lines.Add('Memoria 4 actualizada.');
end;
end;
end;
end;
//******************************************************************************
if Activo=1 then
begin
// Guarda valores de HP y MP - Update HP and MP Values
// -----------------------------
if FromServer and (ConnectName=PJName) and (pck[1]+pck[6]=#$0E#$04) then
begin
CurHP:=ReadD(14);
MaxHP:=ReadD(22);
CurCP:=ReadD(30);
MaxCP:=ReadD(38);
if (CurHP<MaxHP/8) then // Me queda muy poca HP - If very little HP, Disapear!!
begin
Shadow:=1;
end;
if (CurHP<MaxHP/1.8) and (UsandoPot=0) and (Shadow<>10) then // Little HP, Drink Pot
begin
buf:=Hstr('14 54 D6 13 40 00 00 00 00'); // Poco HP ---- CAMBIAR CAMBIAR CAMBIAR CAMBIAR CAMBIAR
SendToServerEx(PJName);
//Message:='Menos de 66% de HP, tomo Pot';
m.Lines.Add('Tengo '+inttostr(CurHP)+'HP, tomo pot..');
UsandoPot:=1;
end;
if (CurHP=MaxHP) then // Tengo todo el HP - Full HP :D
begin
Message:='HP al 100%';
m.Lines.Add(Message);
end;
if (CurCP<MaxCP/2) then // Me quieren PKear - Player ataks me, Desapear!!
begin
Shadow:=3;
end;
Progressbar1.Position:=trunc((CurHP/MaxHp)*100);
end;
//****************************************************
//********************************************************************
// Muy poca vida
// -----------------------
if Shadow=1 then // Disapear!!
begin
buf:=Hstr('14 54 D6 13 40 00 00 00 00'); // Poco HP ---- CAMBIAR CAMBIAR CAMBIAR CAMBIAR CAMBIAR
SendToServerEx(PJName);
shade:=1;
buf:=#$48#$00#$00#$FE#$FF#$7F#$AB#$03#$00#$E9#$F1#$FF#$FF#$88#$D4#$00#$00#$00#$00#$00#$00;
SendToServerEx(PJName);
Message:='Menos del 10% de HP, desaparezco!';
m.Lines.Add(Message);
TS:=0;
ATT:=0;
Shadow:=10;
end;
//------------------------------------------------------------
if Shadow=10 then // Return
begin
if (CurHP>MaxHP/2) then Shadow:=2;
end;
//*************************************************************************
// Volver de Shadowmelt
// --------------------------
if Shadow=2 then // Return
begin
shade:=0;
buf:=#$30#$00#$00;
SendToServerEx(PJName);
Message:='REcupere HP, volvi!';
m.Lines.Add(Message);
Shadow:=0;
Shadoweterno:=1;
end;
//****************************************************************************
// Me PKean
// ------------
if Shadow=3 then // Player atackss
begin
buf:=#$38;
WriteS('Chau PT!!!');
WriteD(0);
SendToServerEx(PJName);
shade:=1;
buf:=#$48#$00#$00#$FE#$FF#$7F#$AB#$03#$00#$E9#$F1#$FF#$FF#$88#$D4#$00#$00#$00#$00#$00#$00;
SendToServerEx(PJName);
Message:='Me ataco otro PJ y desapareci.';
m.Lines.Add(Message);
TS:=0;
ATT:=0;
delay (10000);
Shadow:=10;
end;
//**************************************************************************
//*******************************************************************
// Muerte
// ----------------
if FromServer and (ConnectName=PJName) and (pck[1]=#$06) then // Mob died
begin
ATT:=0; // No ataca
TS:=0; // No tiene nada seleccionado
buf:=Hstr('45 05 00 00 00'); // Levantar drop
SendToServerEx(PJName);
m.Lines.Add('------------ Bicho muerto.........');
BichosMuertos:=BichosMuertos+1;
end;
//***********************************************************************
// Selecciono?????
// ----------------------
if FromServer and (ConnectName=PJName) and (pck[1]=#$A6) then // Target selected
begin
TS:=1;
end;
//*********************************************************************
// Unselected???
// ----------------
if FromServer and (ConnectName=PJName) and (pck[1]=#$A2) then //Target not selected, Select!!
begin
TS:=0;
ATT:=0;
buf:=Hstr('45 04 00 00 00'); // selecciona. (Target Next)
SendToServerEx(PJName);
end;
if TS=0 then
begin
buf:=Hstr('45 04 00 00 00'); // selecciona. (Target Next)
SendToServerEx(PJName);
buf:=Hstr('45 05 00 00 00'); // Levantar drop
SendToServerEx(PJName);
end;
if MoveOK=1 then
begin
if (Contador=1) and (TS=0) then IrMemo1; // Move to locations...
if (Contador=100) and (TS=0) then IrMemo2;
if (Contador=200) and (TS=0) then IrMemo3;
if (Contador=300) and (TS=0) then IrMemo4;
end;
Contador:=Contador+1;
IF Contador>400 then Contador:=0;
if shade = 1 then
begin
if FromClient and (pck[1]=#$30) then pck:='';
end;
//if FromServer and (pck[1]+pck[2]+pck[3]=#$7f#$00#$00) then UsandoPot:=0;
if FromServer and (ConnectName=PJName) and (pck[1]+pck[2]+pck[3]+pck[4]+pck[5]+pck[6]+pck[7]+pck[8]+pck[9]+pck[10]+pck[11]+pck[12]+pck[13]+pck[14]+pck[15]+pck[16]+pck[17]+pck[18]+pck[19]+pck[20]+pck[21]=Hstr('64 5C 00 00 00 01 00 00 00 04 00 00 00 F5 07 00 00 01 00 00 00')) then UsandoPot:=0;
if FromServer and (ConnectName=PJname)and (pck[1]=#$27) and (pck[12]=#$03) and (pck[13]=#$06)then
begin
PotID1:=ReadC(6);
PotID2:=ReadC(7);
PotID3:=ReadC(8);
PotID4:=ReadC(9);
m.Lines.Add('Greater Healing Potion');
m.Lines.Add('ObjectID='+inttostr(PotID1)+inttostr(PotID2)+inttostr(PotID3)+inttostr(PotID4));
end;
end;
end.
--------------------------------------------------------------------------
I know it is a dissaster but it finished like that because it started as a little simple script, but then i added some lines, then other and other and other... I have to re-write it also, but it requires time, that i don't have...
Maybe some parts are useful to some body, that is why i posted it...
If some one have some question about the scripts, just ask
Charly.
P.S.: i entered the code using CODE between [], and at the end /CODE, also between [], but the reserved words as "procedure" didn't appeared highlighted, am i doing it well???
--> Edited, now it's ok
--> New edit, i added some explanations of the code....
Последний раз редактировалось charly911, 25.08.2008 в 02:20.
|