Jump to content
  • Create New...

[FREE] AutoFightCaves | Fire Cape | Jad Pet | Slayer Task


Recommended Posts

  • Moderators


I'm in the process of working on a fight cave / fire cape script.

Figured I'd document my journey along the way.


So it initially started back on PowerBot when I was (still am) playing legit. Got my first Jad slayer task and had only done the fight caves a few times. And yeah, I'll admit, I bought my first firecape when I was like 10, so it's not like I even really learned it. But fast forward some years and I'm on a near maxed combat account and a decent bank, so I figured why not try to learn it..

Well that took a dive when I realised that unlike Zulrah, the fightcaves have 15 (+1 dupe) different rotations and as you all know, 63 waves. So if I were to 'learn' it like Zulrah, that would be 945 spawns to remember. I looked around and did some research for other plugins, and while the RuneLite plugin will tell you what is coming next or on the current wave etc, that's not really all that useful if I don't know where they are.

I continued doing some research into spawn predictors, found the wiki's rotation guides* and sites like OSRSBox** but they all rely on the user working out where everything spawned and tracking it that way.


So anyway I saw on the wiki that the fightcave spawns can be predicted by the time of day that you enter the caves. At the time, the info was outdated and useless, I reached out to the wiki team and they weren't bothered that it was wrong. (until a month or two ago, I noticed it was finally updated) However this gave me something to work on..

If you don't already know, NPC's aren't loaded in as far as objects, something like 18 tiles or something minimal away from the player, they get deloaded. So tracking where something has spawned can be unreliable and expects specific conditions from the user, such as, stand in the middle upon starting the cave run.. Not what I wanted to do.

I took a couple accounts, manually worked out the rotation I was on based on the spawns and recorded the time I started and eventually, I built extrapolatable set of data to fill in the rest of the rotations and times.

At this point, I now know all the spawn locations for every eventuality, so surely I can now prepare for those? That's where my plugin was born.


Anyway, fast forward some more and I decided that if I have the information on where everything spawns, surely making a fully automated fight cave script can't be that difficult?

My knowledge of other similar scripts out there use the 'Airplane' method, taking 1 step at a time out of the safe zone to draw in npcs, as they increase in size the higher their combat. However I also believe this was taken down due to extremely high ban rates/reports of bans. Which when using something methodical like that, doesn't surprise  me.

So I followed the ye'old saying of 'make it human like'. So I figured that if someone is supposed to sit and look at the wiki to work out where is best to stand, standing in that place would be the best thing to do!


  • Pathing & safespots done.
    • Proved a little annoying as the caves are instanced, thus you have to derive your location from a static constant, in this case, the cave entrance.

Used this map to help keep track of where the safespots are and give them a numbered system.



  • From the safespots and pathing, I was able to determine the most likely threat at the start of each wave.
    • I know where I'm going to be & where the threats will be, so I was able to loop all scenarios and determine what I should pray against based on what is and isn't likely to be trapped.


  • From here I worked on the attacking of the monsters
    • This is still a work in progress, there are many unique scenarios per rotation so further testing will pick these up.
    • Prioritising monsters, such as the birds first, then whatever you're praying against, until/unless you have a bigger threat nearby and/or if moving into range to kill what you're praying against will break your safespot trap of other threats.


  • At this point, I had a move to spot, kill stuff, move to spot, kill stuff routine going on. Great... however I needed to work out what to do if I hadn't trapped the monsters with the safespot.
    • here I moved onto adding some more shit to my map



  • the outer circles highlight the trapping rocks and the inner dots are where I should stand.
    • This is based on the npc's tiles and their origin tile which either will or won't pass by the game object obstacle.


  • After working out the tiles and locations, I figured out the logic of the players range and the npcs being in that range


the last thing you want to do is spend time/prayer/run energy/resources getting your npcs into a safespot/trapped, to then ruin it by attacking something out of range. I've also added running to the next safespot if your last npc of the wave is on low hp, means you can prep for the next wave and not potentially lure out the npcs from the safespot running across the map.

  • this is still a work in progress, I'm getting OOB exceptions on my array of current npcs. I've not got round to investigating that though.


  • I've added eating and prayer restore - just a basic task while I test, cause I don't want to have to keep interrupting it to drink a ppot etc..
    • I'll expand on these when the script is more stable and is able to handle more waves 


  • Prayer flick timers were added in my plugin version so ported it to a fully automated version and it works great while not needing to do anything else, I'm still looking into this to get a good trade off between starting the flicking process and blocking out the rest VS still completing the required tasks and then stopping flicking.

Will endeavour to keep this updated!


  • Like 3
Link to post
Share on other sites

  • Moderators

So yesterday I added a task to re-trap the melee npc. Re-trap, or generally just trap if it's in the 'safe' area that I'm in.

So figured that if I run into the center, then run back to the safespot at either 2, 5 or 6 indicated on the maps above, as they trap the npc's on the outside of the rock coming from the middle.

implemented and tested, however didn't quite work as expected, when running into the middle, if the npc isn't dragged inline with the desired safespot rock, it won't get caught when you run back. 

So in my task to run into the middle, I've changed the tile to a derivative of the center depending on which safespot I'm running to, this way, it will drag the npc into the path of the object on returning to the safespot.

Link to post
Share on other sites

  • Moderators

It turns out, when an npc is not loaded but it moving towards you, when it suddenly becomes loaded, it returns not in motion and a speed of 0.

Thus I needed to adjust my 'move closer to npc' methods as when they load in, I'm running to them and ruining my potential safespot.

Also, I was calling a task to activate from the message listener (looking for the next wave) but was causing some race conditions between the rest of the tasks looping, as while I called suspend() before the msgListener task activated, it was still caught in it's loop. Instead, I now set a flag which activates inside the regular tasks now and is working much smoother/more reliable.

Other than that, today was just some general code tweaks with the attacking methods, removing unnecessary delays etc.

Link to post
Share on other sites

  • Moderators

So yesterday I looked into what features FrostCaves used to offer before it was taken down and he had multi-way pray flicking... So I kind of decided I needed to re-add this as a feature back into the script. As I said above, I had the timings down, I just needed to make sure I found a good trade off between doing the flicks safely and making sure the rest of the actions get completed too.

That's what I did.. It again was only tested in isolation so I don't know if it works yet through the rest of the script, as in whilst it's doing everything else but I'll test it further and make sure it's a safe feature... Nobody wants to spend 45 minutes to just die..

Link to post
Share on other sites

  • Moderators

So prayer flicking is now tested and re-added!

I'm nowhere near finished but I'm working on the paint at the minute, just to give me a break from the monotony of testing 👌

  • Like 1
Link to post
Share on other sites

  • Moderators

Not really much to update;

Paint has now changed, more informative.

Chance of success is based on your supplies, so if you're out of supplies, it'll be 0.

Other changes include internal code tidying up; I'm now at 50+ files and counting so the last few days  I've just been tidying it all up, moving things out of the main class file where possible to keep it nice and neat.

I also  tweaked prayer flicking to activate it a little longer. For those who don't know, monsters in the fight caves attack every 4 ticks (2400 ms || 2.4 seconds) as long as your prayer is active before the animation starts (that's when the damage is calculated) then you're safe. I was veering on the edge of caution and I was turning the prayer on @ around tick 2 so it was on for 2 ticks before I turned it off. In reality, that's unnecessary, so I've updated it to be ~2.75 ticks on and then off when animation starts.

This way you conserve more prayer as sometimes it won't even drain with the correct timings.

Link to post
Share on other sites

  • Moderators

So today I dun goofed..


I was watching it perfectly switching between mage and range prayers so I wanted to clip it but I forgot I had enabled input, so as I moved my mouse across the screen, I moved it just before it was about to click the prayers on, thus missing the prayers and I died..

However, that's the longest test so far without any interaction at all. 

Another issue I uncovered here was when working out the next safespot, I don't take into account where I'm currently standing, thus, I'm using an awful lot of run energy and quickly which isn't really sustainable. So I'm going to look into including best spot to stand from my current location.

Link to post
Share on other sites

  • Moderators
On 12/17/2020 at 8:18 PM, Dan said:

So I'm going to look into including best spot to stand from my current location.

So I've got a new location, essentially, I'll stay in 1 place and deal with all the threats while multi-way flicking..

Starting to hit a bit of a wall though, to test the higher waves, it obviously takes time to get there and then when the prayer flicking messes up, I'm dead before I can intervene. I guess I knew I'd hit the wall but was hoping it might not suck so much lmao.

Will keep trying and see where we get.

Link to post
Share on other sites

  • Dan locked this topic
  • Dan unlocked this topic
  • Moderators

I forgot about this thread...

Well I started again.

Some updates to the client allowed me to change the way I do things.

While still in early development I'm testing out some doAction methods with prayer. For those who don't know, doAction is where it sends the action to the server rather than completing the action in game.  This is used in some popular clients such as OPRS and a few other botting clients.

This allows me to worry less about the time and/or the script using the mouse to do something else and then missing a prayer flick for example.

Also, there was a game tick listener implemented which now fires on every game tick. Previously,  I had a thread which calculated the average time between start & finish and then worked out the loops to 600ms. Which was a shit plan but it worked.. ish.

Anywho, the tick listener now allows me to flick properly as I can turn on before tick 4 starts (monsters in the caves are 4 tick attack speed). This then means I can work on multi style flicking much better than with the thread as mentioned above. Combining this with the new prayer doAction stuff, makes it much more solid.

Speaking of prayer flicking; I was using animations to time the flick, considering the start of the animation is when the damage is calculated, you need to be praying before that tick starts. However the npc's aren't loaded when at their max range so can attack you whilst not having an npc loaded in game.. I think I mentioned it more previously so I won't go into more details. 

Although with that in mind, I was able to adjust the animation finder to a projectile finder and start my trigger for prayer flicking based on the projectile creation rather than npc as this partly loads in where the npc doesnt.


So other than that, it's just test test test 👍

Link to post
Share on other sites