Results 1 to 10 of 10

Thread: [Reflection] Attacking animation ID or PlayerAttacking

  1. #1
    Join Date
    Aug 2007
    Location
    Hawaii
    Posts
    3,880
    Mentioned
    7 Post(s)
    Quoted
    152 Post(s)

    Default [Reflection] Attacking animation ID or PlayerAttacking

    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).


    Simba Code:
    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;

    Quote Originally Posted by elfyyy View Post
    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:
    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;
    Last edited by kingarabian; 01-16-2015 at 03:25 AM.
    Faith is an oasis in the heart which will never be reached by the caravan of thinking.

  2. #2
    Join Date
    Aug 2007
    Location
    Hawaii
    Posts
    3,880
    Mentioned
    7 Post(s)
    Quoted
    152 Post(s)

    Default

    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:

    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  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
    Last edited by kingarabian; 01-16-2015 at 02:05 AM.
    Faith is an oasis in the heart which will never be reached by the caravan of thinking.

  3. #3
    Join Date
    Oct 2006
    Posts
    6,752
    Mentioned
    95 Post(s)
    Quoted
    532 Post(s)

    Default

    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:
    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;
    Last edited by Kyle; 01-16-2015 at 03:10 AM.
    “The long-lived and those who will die soonest lose the same thing. The present is all that they can give up, since that is all you have, and what you do not have, you cannot lose.” - Marcus Aurelius

  4. #4
    Join Date
    Aug 2007
    Location
    Hawaii
    Posts
    3,880
    Mentioned
    7 Post(s)
    Quoted
    152 Post(s)

    Default

    Quote Originally Posted by elfyyy View Post
    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:
    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.
    Faith is an oasis in the heart which will never be reached by the caravan of thinking.

  5. #5
    Join Date
    Mar 2012
    Location
    127.0.0.1
    Posts
    3,383
    Mentioned
    95 Post(s)
    Quoted
    717 Post(s)

    Default

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

    EZPZ

  6. #6
    Join Date
    Feb 2013
    Location
    Rimmington
    Posts
    319
    Mentioned
    33 Post(s)
    Quoted
    183 Post(s)

    Default

    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

    Quote Originally Posted by NKN View Post
    Get the ID of the person you're interacting with.

    EZPZ
    Index*





  7. #7
    Join Date
    Mar 2012
    Location
    127.0.0.1
    Posts
    3,383
    Mentioned
    95 Post(s)
    Quoted
    717 Post(s)

    Default

    Quote Originally Posted by Fitta View Post
    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

  8. #8
    Join Date
    Feb 2013
    Location
    Rimmington
    Posts
    319
    Mentioned
    33 Post(s)
    Quoted
    183 Post(s)

    Default

    Quote Originally Posted by NKN View Post
    NPCArray[Index].ID
    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.





  9. #9
    Join Date
    Aug 2007
    Location
    Hawaii
    Posts
    3,880
    Mentioned
    7 Post(s)
    Quoted
    152 Post(s)

    Default

    Quote Originally Posted by Fitta View Post
    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.
    Faith is an oasis in the heart which will never be reached by the caravan of thinking.

  10. #10
    Join Date
    Mar 2012
    Location
    127.0.0.1
    Posts
    3,383
    Mentioned
    95 Post(s)
    Quoted
    717 Post(s)

    Default

    Quote Originally Posted by Fitta View Post
    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •