PDA

View Full Version : [Reflection] Attacking animation ID or PlayerAttacking



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;

kingarabian
01-16-2015, 01:58 AM
Okay I lied, I was able to get the player attacking animation ID(s).

They are 1156 and 390 (I think).

So I'm doing something like this:

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 animation2) then
begin
Writeln('Player is fighting');
result:= true;
end else
Writeln('Player is not fighting');
result:= false;

end;

Always results false.

Player animation is: 1156
Player is not fighting
Player animation is: 1156

Kyle
01-16-2015, 03:06 AM
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;

kingarabian
01-16-2015, 03:24 AM
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;
Yeah I realized that lol.

That -1 sticks around for a few seconds unfortunately.

NKN
01-16-2015, 03:25 AM
Get the ID of the person you're interacting with.

EZPZ

Fitta
01-16-2015, 03:29 AM
Let's throw locPlayer.UnderAttack out the f*cking window already..

Fitta takes a tequila shot



locPlayer.GetInteracting(NPC);
If NPC.Index > 1 then
wiho, we are interacting.


So what does interacting mean?
It means that you're attacking it.


EDIT: You can as NKN mention save the index and see when it dies..

http://gyazo.com/d87e712ab1a910dd33358d832c3c612b


Get the ID of the person you're interacting with.

EZPZ

Index*

NKN
01-16-2015, 03:59 AM
Let's throw locPlayer.UnderAttack out the f*cking window already..

Fitta takes a tequila shot



locPlayer.GetInteracting(NPC);
If NPC.Index > 1 then
wiho, we are interacting.


So what does interacting mean?
It means that you're attacking it.


EDIT: You can as NKN mention save the index and see when it dies..

http://gyazo.com/d87e712ab1a910dd33358d832c3c612b



Index*

NPCArray[Index].ID :shifty::shifty::shifty:

Fitta
01-16-2015, 04:00 AM
NPCArray[Index].ID :shifty::shifty::shifty:

What?

All the NPCs have the same ID, index is what tells them apart. And no, not results var array index.
NPCs[Index] is what makes it unique from all the other monsters with the same ID.

kingarabian
01-16-2015, 08:53 AM
Let's throw locPlayer.UnderAttack out the f*cking window already..

Fitta takes a tequila shot



locPlayer.GetInteracting(NPC);
If NPC.Index > 1 then
wiho, we are interacting.


So what does interacting mean?
It means that you're attacking it.


EDIT: You can as NKN mention save the index and see when it dies..

http://gyazo.com/d87e712ab1a910dd33358d832c3c612b



Index*

Beautiful.

NKN
01-16-2015, 11:41 AM
What?

All the NPCs have the same ID, index is what tells them apart. And no, not results var array index.
NPCs[Index] is what makes it unique from all the other monsters with the same ID.

Sarcasm, mate.