
Originally Posted by
hoodz
im close to perfect this script, but i want to make a better in combat function for the reflection version.
mines a little something like this if it helps
Simba Code:
function AttackTheMonster: Boolean;
var
TheMonster: TNPC;
MonsterLocation : Tpoint;
CurrentCompassAngle: Extended;
begin
Result := False;
CurrentCompassAngle := rs_GetCompassAngleDegrees;
if R_FindNpc(AttackMonster, TheMonster) then
begin
if ((TheMonster.InCombat) or (R_InFight) or (R_IsAnimating)) then
Exit;
//if (sqrt(sqr(MonsterLocation.x + StartingTile.x) + sqr(MonsterLocation.y + StartingTile.y)) > SearchRadius) then
// Exit;
MonsterLocation := TheMonster.Tile;
MonsterLocation := R_TileToMs(TileLocation);
if (MonsterLocation := (-1,-1) then
begin
TileLocation := R_TiletoMM(MonsterLocation);
R_BlindWalk(TileLocation);
FFlag(2);
wait(50 + random (100, 300));
Exit;
end;
//SMART_DrawDotsEx(True, [MonsterLocation], clGreen);
MMouse(MonsterLocation.x, MonsterLocation.y, 0, 0);
if (R_WaitUpText(['Attack', AttackMonster], 350)) then
begin
if(R_IsUpTextMulti(['Attack', AttackMonster])) then
begin
case random(10) of
0..5: ClickMouse2(mouse_left);
6..9: begin
ClickMouse2(mouse_right);
HumanWait;
if R_OptionExists('Attack') then
R_ChooseOption('Attack') else
begin
R_WaitChooseOption('Cancel',750);
wait(500 + random(250));
Exit;
end;
end;
end;
FFlag(0);
wait(1500 + random(250,750);
end;
end; (*else
begin
MakeCompass(CurrentCompassAngle + randomrange(45,70));
Exit;
end;*)
if (R_InFight) then
begin
Result := True;
while (TheMonster.HitPoints > 0) do
begin
EatFood;
end;
end;
Exit;
end;
end;
edit: AttackMonster is the Global Constant the user defines and the CurrentCompassAngle is used to rotate the camera incase theres a tree or something between the player and the monster when it moves the mouse
edit2: if your having troubles with it trying to click another monster while it just clicked one monster its cause the R_InFight doesnt indicate ur in a fight until you have a splash on the monster i believe, i think elfyyy said the R_InFight was updated in a recent update but i havent checked if this issue was fixed