DrizzyBot Posted January 4, 2018 Share Posted January 4, 2018 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. Quote Link to comment Share on other sites More sharing options...
HeyImJamie Posted January 4, 2018 Share Posted January 4, 2018 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 1 Quote Link to comment Share on other sites More sharing options...
DeadPk3r Posted January 4, 2018 Share Posted January 4, 2018 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 1 Quote Link to comment Share on other sites More sharing options...
DrizzyBot Posted January 4, 2018 Author Share Posted January 4, 2018 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 That's what I'm asking how to do. How could I figure out time between I get hit? Quote Link to comment Share on other sites More sharing options...
FrostBug Posted January 4, 2018 Share Posted January 4, 2018 (edited) 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 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 January 4, 2018 by FrostBug 2 Quote Link to comment Share on other sites More sharing options...
DrizzyBot Posted January 4, 2018 Author Share Posted January 4, 2018 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? Quote Link to comment Share on other sites More sharing options...
FrostBug Posted January 4, 2018 Share Posted January 4, 2018 (edited) 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 January 4, 2018 by FrostBug Quote Link to comment Share on other sites More sharing options...
DrizzyBot Posted January 5, 2018 Author Share Posted January 5, 2018 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? Quote Link to comment Share on other sites More sharing options...
FrostBug Posted January 5, 2018 Share Posted January 5, 2018 6 hours ago, DrizzyBot said: How would you differentiate between an attack animation and defense animation? They're most likely consistent in their relativity. Eg. Attack is always higher ID than defense or the other way around Quote Link to comment Share on other sites More sharing options...
DrizzyBot Posted January 5, 2018 Author Share Posted January 5, 2018 14 hours ago, FrostBug said: They're most likely consistent in their relativity. Eg. Attack is always higher ID than defense or the other way around Didn't even think about that! You're probably right, going to take a look at that. Thanks for being helpful! Quote Link to comment Share on other sites More sharing options...