DrizzyBot Posted December 31, 2017 Share Posted December 31, 2017 Is there a way to determine what kind of damage you're taking? For example, one monster I'm fighting might use melee while another one might use ranged. Is there a way to determine how you're getting attacked so I can put on the correct prayer? Thanks! Quote Link to comment Share on other sites More sharing options...
Night Posted December 31, 2017 Share Posted December 31, 2017 Nope, you'd have to use the monsters animation ID to determine what attack it is using Quote Link to comment Share on other sites More sharing options...
DrizzyBot Posted January 1, 2018 Author Share Posted January 1, 2018 1 hour ago, Night said: Nope, you'd have to use the monsters animation ID to determine what attack it is using Would it be possible to use projectiles? Of course it wouldn't differentiate ranged/mage, but at least ranged/mage and melee? Quote Link to comment Share on other sites More sharing options...
Chris Posted January 1, 2018 Share Posted January 1, 2018 try projectiles Quote Link to comment Share on other sites More sharing options...
DrizzyBot Posted January 1, 2018 Author Share Posted January 1, 2018 (edited) 19 minutes ago, Chris said: try projectiles Would there be a more efficient way than doing this? Or is there a way to use a filter with projectiles (doubt it, took a quick look). LinkedList<Projectile> allProj = api.projectiles.getAll(); for (Projectile temp : allProj) { if (temp.getTargetEntity().equals(api.myPlayer()) && Variables.usePrayer && !api.getPrayer().isActivated(PrayerButton.PROTECT_FROM_MISSILES)) { return true; } } My thinking is it checks if any projectile is targeted at me, if it is return true (go to the execution method). Edited January 1, 2018 by DrizzyBot Quote Link to comment Share on other sites More sharing options...
TheMcPker Posted January 1, 2018 Share Posted January 1, 2018 what npcs/players are you planning on using this one maby we can give a more accurate help Quote Link to comment Share on other sites More sharing options...
liverare Posted January 1, 2018 Share Posted January 1, 2018 ad hoc api.projectiles.getAll() .stream() .filter(this::isProjectileTargetingMe) .filter(this::isProjectileARangedAttack) .collect(Collectors.toList()); private boolean isProjectileTargetingMe(Projectile p) { return api.myPlayer().equals(p.getTargetEntity()); } private boolean isProjectileARangedAttack(Projectile p) { return p.getId() == -1; // TODO } get projectiles get only projectiles targeting us get only projectiles with certain ID Then you can mess about figuring out whether you're praying the right prayer. Look into Lambda expressions for Java. 1 Quote Link to comment Share on other sites More sharing options...
DrizzyBot Posted January 2, 2018 Author Share Posted January 2, 2018 20 hours ago, TheMcPker said: what npcs/players are you planning on using this one maby we can give a more accurate help It's going to be an AIO fighter, but some areas have multiple monsters with multiple attack types (mountain trolls for example also has thrower trolls that use ranged). 20 hours ago, liverare said: ad hoc api.projectiles.getAll() .stream() .filter(this::isProjectileTargetingMe) .filter(this::isProjectileARangedAttack) .collect(Collectors.toList()); private boolean isProjectileTargetingMe(Projectile p) { return api.myPlayer().equals(p.getTargetEntity()); } private boolean isProjectileARangedAttack(Projectile p) { return p.getId() == -1; // TODO } get projectiles get only projectiles targeting us get only projectiles with certain ID Then you can mess about figuring out whether you're praying the right prayer. Look into Lambda expressions for Java. Perfect, thank you. Quote Link to comment Share on other sites More sharing options...