Help shrine hunter

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.

Help would be appreciated :upside_down_face:

Check one of the baal script, I believe there is a function to search for es. To take gem shrines it’s in your config file.

Found in BaalAssistant

if (Leader || autoLeaderDetect(109) || autoLeaderDetect(130) || autoLeaderDetect(131)) {
	print("Ăżc<Leader: " + Leader);
	while (Misc.inMyParty(Leader)) {
		if (!secondAttempt && !safeCheck && !baalCheck && !ShrineStatus && GetShrine && me.area === 109 && me.area !== 131 && me.area !== 132) {

			if (GetShrineWaitForHotTP) {
				for (i = 0; i < Wait; i += 1) {
					if (hotCheck) {
						break;
					}
					delay(1000);
				}

				if (!hotCheck) {
					print("Ăżc1" + "Leader didn't tell me to start hunting for an experience shrine.");
					ShrineStatus = true;
				}

			}

			if (!ShrineStatus) {
				Pather.useWaypoint(4);
				Precast.doPrecast(true);

				for (i = 4; i > 1; i -= 1) {
					if (safeCheck) {
						break;
					}
					if (Misc.getShrinesInArea(i, 15, true)) {
						break;
					}
				}

				if (!safeCheck) {
					if (i === 1) {
						Town.goToTown();
						Pather.useWaypoint(5);
						Precast.doPrecast(true);

						for (i = 5; i < 8; i += 1) {
							if (safeCheck) {
								break;
							}
							if (Misc.getShrinesInArea(i, 15, true)) {
								break;
							}
						}
					}
				}
			}
			Town.goToTown(5);
			ShrineStatus = true;
		}

not sure how to change it so he doesn’t grab shrine though, I just want him to find it an town not take it.

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.

2 Likes

So I went into bots, and made a new document (using javascript) an copied an pasted that script I named it EsSearch in the bots folder.

Then I went into my character and added Config.EsSearch = true; //

it shows an error [strict warning] (162) File(kolbot/libs/config/barbarian.fr.js:144) reference to undefined property Config.EsSearch

so the bots joins game an does nothing.

Config is defined in Config.js, this is a script so you have to set Scripts.EsSearch = true;

Wow, you the man!! it works =)

5noop, If you read this message, please help.

I used your code and it works fine.

I made even two versions of bot:

SHRINEFINDER1 which is:

and

SHRINEFINDER2 which is:

– 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:

  1. He enters portal.
  2. He doesn’t take shrine.
  3. 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.”)

– but no success.

Can you help me with that?

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())
}

Thanks mate. You are real code wizard. :slight_smile:

I’m trying to make A2 shrine finder, but i can’t get logic of it.

I looked areas numbers in Areas.txt:

And specified it as var “i”:

But when bot exits from town to Rocky Waste he’s immediately ends this script and goes to town.

I also tried with 42 (Dry Hills) and WP:

But same “result”'s here.

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

1 Like

You are good not only at coding, but you also know D2 structure. :smiley:

Yep, I found shrines’ IDs in (…\Diablo 2\Data\Global\Excel)Objects.txt.
And seems that they are very useful because at last we can use A5 shrines.


SHRINES:
----A1
Wilderness:
2, 81, 83
Caves:
277
Monastery/Jail/Cathedral/Catacombs:
260, 262, 263, 264, 265
----A2
Desert:
86, 134, 135, 136, 150, 151
“Haram” (Harem):
299, 300
Tombs / Arcane Sanctuary:
116, 133
----A3
Jungle:
184, 190, 191, 197
“Dundeon” (probably: Arachnid Lair, Spider Cavern):
361
“Sewer” (probably: Swampy Pit, Flayer Dungeon):
325
Sewers:
279, 282
“Arcane Sanctuary” (probably: Disused/Forgotten/Ruined Fane/Temple/Reliquary):
303
“Mafisto” (Durance of Hate):
199, 200, 201
----(probably)A4
“OuterShrineHell” (unknown):
226, 231, 232
“InnerShrineHell” (unknown):
97, 123, 124
----A5
Wilderness:
414, 415, 421, 427, 428,
“Snowy” (unknown):
495, 497
(Ice) Caves:
472, 479
“Temple” (probably: Halls of Anguish/Pain/Vaught):
509, 512, 520
WSK:
488, 499, 503

Full list:

Full list:

But I got problem:

I specified in Misc.js different combinations of shrine IDs (and even all of them):

[2, 81, 83]
– exists by default.

[2, 81, 83, 86, 134, 135, 136, 150, 151]
– this contains (or at least should contain) desert shrines.

86 – stele,magic shrine, stone, desert
134 – dshrine2 act 2 shrine
135 – desertshrine3 act 2 shrine
136 – dshrine1 act 2 shrine
150 – dshrine1 act 2, desert
151 – dshrine4 act 2, desert

Here’s the code which I run:

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.