Jump to content
DrizzyBot

Get interval between attacks

Recommended Posts

So I'm making an AIO fighter and one feature I want to add in is prayer flicking. This of course means I need to figure out the interval between attacks so I can know when to flick prayer. Seems simple enough, but there are a lot of roadblocks I've come across and I'm out of ideas. Here's what I've tried:

*Determining attack animation ID and use that. This won't work because:

1) I'd need to somehow differentiate the block animation ID and the attack ID

2) The NPC doesn't always show the attack animation due to maybe blocking or for some other reason.

 

*Use hitsplats on my player. Unfortunately, for some reason, there isn't any hitsplats API anymore so this isn't possible. An alternative I was thinking of is taking the time between HP changes. This won't work because an NPC might not do damage each attack, leading to an inaccurate interval.

 

Anyone have any other ideas or alternatives I could use? I'd greatly appreciate it.

Link to comment
Share on other sites

12 minutes ago, El_Maestro said:

Have you considered looking into monitoring game ticks? The majority, if not all (correct me if I am wrong), monsters seem to attack at the same rate. If they do then their attack speed is not necessary. 

There is a huge variety of attack speeds that NPCs have. Having a static value wouldn't work out very well.

13 minutes ago, HeyImJamie said:

I'd assume you use a cycle to figure out when you were last hit and then with that info decide which tick to activate prayer, Too much thinking for me though :boge: 

That's what I'm asking how to do. How could I figure out time between I get hit?

Link to comment
Share on other sites

20 minutes ago, DeadPk3r said:

Im interested in this as well curious how you could go about that only script i've seen with that feature is @FrostBug FrostCaves script but could be wrong may others have it :think:

The vast majority of all monsters attack at a 4-tick rate. Though a general assumption can't be made since some do break the norm (trolls are slower, for example).
For my script I could simply hardcode their attackspeeds (all of them are 4 ticks except for jad on 8 ticks).

I don't think there's a particularly good way to do it without analyzing the enemy over time. The best approach is probably to make a suggestion to the dev team about hooking hitsplats again.

Edited by FrostBug
  • Like 2
Link to comment
Share on other sites

17 minutes ago, FrostBug said:

The vast majority of all monsters attack at a 4-tick rate. Though a general assumption can't be made since some do break the norm (trolls are slower, for example).
For my script I could simply hardcode their attackspeeds (all of them are 4 ticks except for jad on 8 ticks).

I don't think there's a particularly good way to do it without analyzing the enemy over time. The best approach is probably to make a suggestion to the dev team about hooking hitsplats again.

OK, let's say I want to implement to flick every 4 ticks. How do I know when to start the tick count? Won't I still need to determine when I get attacked so I can starting counting ticks?

Link to comment
Share on other sites

1 hour ago, DrizzyBot said:

OK, let's say I want to implement to flick every 4 ticks. How do I know when to start the tick count? Won't I still need to determine when I get attacked so I can starting counting ticks?

You can look out for his first attack animation.

It's true that animations can hide/cancel eachother, but you should be able to see their first attack.
1. If the monster is aggressive and attacks first, there you have it.
2. If the monster is passive and the player attacks first, in order for its first animation to be cancelled, you would have to attack twice before his first attack (unlikely).

In rare cases where you attack an aggressive monster (who is about to hit you) first, you should still be able to see an attack animation eventually.

EDIT: If you do get hitsplat API added, you can use the timestamp of the first hitsplat on you for melee enemies.

Edited by FrostBug
Link to comment
Share on other sites

1 hour ago, FrostBug said:

You can look out for his first attack animation.

It's true that animations can hide/cancel eachother, but you should be able to see their first attack.
1. If the monster is aggressive and attacks first, there you have it.
2. If the monster is passive and the player attacks first, in order for its first animation to be cancelled, you would have to attack twice before his first attack (unlikely).

In rare cases where you attack an aggressive monster (who is about to hit you) first, you should still be able to see an attack animation eventually.

EDIT: If you do get hitsplat API added, you can use the timestamp of the first hitsplat on you for melee enemies.

How would you differentiate between an attack animation and defense animation?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...