Would like for a character to automatically join game an hunt for an experience shrine an then just to tp at the shrine rather than taking it for themselves. (I can do the rest if tp is up as I will be playing manual)
2nd if possible would love for this character to hit all gem shrines on the way an then tp an stop at the es.
Set the last argument of getShrinesInArea to false. You could do something like that for example:
Pather.useWaypoint(4);
Precast.doPrecast(true);
for (i = 4; i > 1; i -= 1) {
if (Misc.getShrinesInArea(i, 15, false)) {
break;
}
}
if (i === 1) {
Town.goToTown();
Pather.useWaypoint(5);
Precast.doPrecast(true);
for (i = 5; i < 8; i += 1) {
if (Misc.getShrinesInArea(i, 15, false)) {
break;
}
}
}
And just before break you could announce something like say("es found"); or return true/false if itâs in a function.
hmm, I tried changing them to false, an then I deleted and copied yours. He still grabs the xp shrine immediately for himself. Tried the alert function like say (âes foundâ); and he doesnât say anything either. (granted prior is on him not taking the shrine)
I also noticed running the âBaalAssistant scriptâ it is making him go to act 5 at the start of the game, where I assume it will crash on bnet, as on single player it is just going straight to act 5 even though it is classic.
if (!ShrineStatus) {
Pather.useWaypoint(4);
Pather.useWaypoint(4);
Precast.doPrecast(true);
for (i = 4; i > 1; i -= 1) {
if (Misc.getShrinesInArea(i, 15, false)) {
break;
}
}
if (i === 1) {
Town.goToTown();
Pather.useWaypoint(5);
Precast.doPrecast(true);
for (i = 5; i < 8; i += 1) {
if (Misc.getShrinesInArea(i, 15, false)) say("Esfound") { say("Esfound")
break;
}
}
}
//I hope it doesnât double post I wanted to reply that way it may notify you, as you seem very knowledgeable and helpful. I appreciate it!
Yeah you could make a standalone script like this (i did not test it):
function EsSearch() {
Pather.useWaypoint(4);
Precast.doPrecast(true);
for (i = 4; i > 1; i -= 1) {
if (Misc.getShrinesInArea(i, 15, false)) {
say("es found");
return;
}
}
Town.goToTown();
Pather.useWaypoint(5);
Precast.doPrecast(true);
for (i = 5; i < 8; i += 1) {
if (Misc.getShrinesInArea(i, 15, false)) {
say("es found");
return;
}
}
}
Rename it EsSearch.js and put it in the bot folder. And if the sorc takes shrines be sure you didnt put es in Config.ScanShrines.
â this is how ShrineFinder works (we can use it in different locations with different order and with n characters).
But NOW I have trouble with getting exp shrine with character/bot which needs / should take shrine.
For âbaseâ of taking exp shrine I took BaalAssistant.js.
I found part of code that answers for âbaalCheckâ (itâs excatly after killing 5th wave [minions of desctruction with Lister]).
Here it is:
Iâm not a professional programmer and even not guru of programming, but by example of codes from other scripts I wrote such part of code:
The problem is in that, when bot enters portal to shrine (âPather.usePortal(null, null, portal);â), he doesnât take shrine.
So:
He enters portal.
He doesnât take shrine.
He continue to perform other actions (from saying âTook ESâ etc).
This happens SOMETIMES. Not always. But really often.
In my subjective opinion (iâm not sure in this positio), bot tries to take shrine, but when there are monsters around (even at far from shrine) he canât take it.
I tried different variants of this part:
I added delay:
I added multiple âgetShrineâ:
I tried to combine delay with multiple âgetShrineâ:
I tried to use multiple delay:
Of course I tried to enlarge delay time:
And I tried other actions that didnât work with corresponding error messages:
(error message: âMisc.click: Third arg must be a Unit.â)
Misc.getShrine wonât do anything. To call a function you need to add parenthesis at the end, like Misc.getShrine()
But first you need to make sure the function actually exists and check if it needs parameters. So you open Misc.js, look for âgetShrineâ and find that it needs a shrine unit as parameter.
Now that you got this information you can try something like that:
let shrine = getUnit(2); // find a shrine
if (shrine) {
do {
if(shrine.objtype === 15 && getDistance(shrine) < 15) { // make sure it's an es and that it's not too far away
Misc.getShrine(shrine); // take the es
break;
}
} while (shrine.getNext())
}
Yeah thatâs because Misc.getShrinesInArea() donât recognize any shrine past act 1. Each âshrine modelâ has a different id and only the ids corresponding to act 1 shrines are used in the function.
So you need to get the shrine ids from act 2, either from the mpq or directly in game, and add them here
The problem is that:
Bot visits area (at A2), takes FIRST shrine (if true â Misc.getShrinesInArea(I, 15, TRUE)), opens TP and leaves it.
Or visits area, opens TP at FIRST shrine (if false â Misc.getShrinesInArea(i, 15, FALSE)) and leaves it.
In act 1 bot acts differently â he always searches excatly expirience shrine.
Can this be fixed?
Did you edit anything else than the ids array ? You can add print statements in the getShrinesInArea function to know which shrine the bot is taking, it should only stops when shrine.objtype === 15 which as far as I know is only be valid with exp shrine.