kingarabian
01-16-2015, 12:33 AM
inFight checks for an HP Bar over the users head to detect if player is inFight. Problem is sometimes the monster does not attack back and inFight will return false.
Is that the case for R_inFight? I'm using it in my script but it only results true when the monster attacks back.
So is there a specific animation when the player is attacking a monster? That way I could add that to the R_InFight function. Sorry I'm bad at debugging stuff right now.
Edit: Got it to work (Melee only probably).
function R_IsPlayerAttacking: boolean;
var
animation : integer;
begin
R_WaitForAnimation(2000);
animation := R_GetAnimation;
writeln('Player animation is: '+IntToStr(R_GetAnimation));
if (animation = 1156) then
begin
Writeln('Player is fighting');
result:= true;
end else
if (animation = 390) then
begin
Writeln('Player is fighting');
result:= true;
end else
Writeln('Player is not fighting');
result:= false;
end;
Yeah, that is the reason why in the lape include, I renamed it to "UnderAttack", to more accurately describe the function. It compares the static game loop cycle to your players, which freeze when a hp bar is overhead. I'm not going to add any other specific In fight functions as they should be left up to the scripters. One way is to get the interacting npc's index and compare with our own player. Though that isn't supported in the pascal script version.. Animation checks also work, though not 100% as when we stop attacking after a hit, it goes to "-1" for a couple ticks..
If you are going to use the lape version, i'm sure Fitta; could share his method of detecting when in a fight.
Also, the reason your function keeps returning false is because you need a begin and end after the else..
Simba Code:
function R_IsPlayerAttacking: boolean;
var
animation : integer;
animation2 : integer;
begin
animation := 1156;
animation2:= 390;
writeln('Player animation is: '+IntToStr(R_GetAnimation));
if (R_GetAnimation = animation) or (R_GetAnimation = animation2) then
begin
Writeln('Player is fighting');
result:= true;
end else
begin
Writeln('Player is not fighting');
result:= false;
end;
end;
Is that the case for R_inFight? I'm using it in my script but it only results true when the monster attacks back.
So is there a specific animation when the player is attacking a monster? That way I could add that to the R_InFight function. Sorry I'm bad at debugging stuff right now.
Edit: Got it to work (Melee only probably).
function R_IsPlayerAttacking: boolean;
var
animation : integer;
begin
R_WaitForAnimation(2000);
animation := R_GetAnimation;
writeln('Player animation is: '+IntToStr(R_GetAnimation));
if (animation = 1156) then
begin
Writeln('Player is fighting');
result:= true;
end else
if (animation = 390) then
begin
Writeln('Player is fighting');
result:= true;
end else
Writeln('Player is not fighting');
result:= false;
end;
Yeah, that is the reason why in the lape include, I renamed it to "UnderAttack", to more accurately describe the function. It compares the static game loop cycle to your players, which freeze when a hp bar is overhead. I'm not going to add any other specific In fight functions as they should be left up to the scripters. One way is to get the interacting npc's index and compare with our own player. Though that isn't supported in the pascal script version.. Animation checks also work, though not 100% as when we stop attacking after a hit, it goes to "-1" for a couple ticks..
If you are going to use the lape version, i'm sure Fitta; could share his method of detecting when in a fight.
Also, the reason your function keeps returning false is because you need a begin and end after the else..
Simba Code:
function R_IsPlayerAttacking: boolean;
var
animation : integer;
animation2 : integer;
begin
animation := 1156;
animation2:= 390;
writeln('Player animation is: '+IntToStr(R_GetAnimation));
if (R_GetAnimation = animation) or (R_GetAnimation = animation2) then
begin
Writeln('Player is fighting');
result:= true;
end else
begin
Writeln('Player is not fighting');
result:= false;
end;
end;