# Chest Mania no attack

**URL:** <https://blizzhackers.discourse.group/t/chest-mania-no-attack/517>\
**Category:** Support\
**Created:** [January 7, 2020, 5:09pm UTC](https://blizzhackers.discourse.group/t/chest-mania-no-attack/517 "2020-01-07T17:09:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Casper](https://avatars.discourse-cdn.com/v4/letter/c/b4bc9f/32.png) [@Casper](https://blizzhackers.discourse.group/u/Casper)\
**Post date:** [January 7, 2020, 5:09pm UTC](https://blizzhackers.discourse.group/t/chest-mania-no-attack/517/1 "2020-01-07T17:09:03Z")

</div>

Is there a setting I can add or change to the chestmania that will force the bot to attack enemies around the chest? As it is now the bot goes to the chest, opens, the chest, scans the ground for pikit items, and moves on. Many times I am surrounded by hoards, and end up chicken exit because the bot is not fighting or killing monsters near the chest area.

---

<div class="post-metadata">

**Author:** ![mf22](https://yyz2.discourse-cdn.com/free1/user_avatar/blizzhackers.discourse.group/mf22/32/18_2.png) [@mf22](https://blizzhackers.discourse.group/u/mf22)\
**Post date:** [January 7, 2020, 7:53pm UTC](https://blizzhackers.discourse.group/t/chest-mania-no-attack/517/2 "2020-01-07T19:53:19Z")

</div>

maybe you could insert a new line in this part of [Misc.openChestsInArea](https://github.com/kolton/d2bot-with-kolbot/blob/master/d2bs/kolbot/libs/common/Misc.js#L932-L933) (which is called in line 17 of Chestmania.js), like the 2nd line:

```javascript
			Pather.moveToUnit(coords[0], 1, 2);
			Attack.clear(20, false, false, false, true);
			this.openChests(20);

```

---

<div class="post-metadata">

**Author:** ![Casper](https://avatars.discourse-cdn.com/v4/letter/c/b4bc9f/32.png) [@Casper](https://blizzhackers.discourse.group/u/Casper)\
**Post date:** [January 7, 2020, 8:19pm UTC](https://blizzhackers.discourse.group/t/chest-mania-no-attack/517/3 "2020-01-07T20:19:47Z")

</div>

error in chestmania.  
coords is not defined

---

<div class="post-metadata">

**Author:** ![Casper](https://avatars.discourse-cdn.com/v4/letter/c/b4bc9f/32.png) [@Casper](https://blizzhackers.discourse.group/u/Casper)\
**Post date:** [January 7, 2020, 9:59pm UTC](https://blizzhackers.discourse.group/t/chest-mania-no-attack/517/4 "2020-01-07T21:59:27Z")

</div>

this works

function ChestMania() {  
var prop, i;

```
Town.doChores();

for (prop in Config.ChestMania) {
	if (Config.ChestMania.hasOwnProperty(prop)) {
		for (i = 0; i < Config.ChestMania[prop].length; i += 1) {
			Pather.journeyTo(Config.ChestMania[prop][i]);
			Precast.doPrecast(i == 0 ? true : false);
			Misc.openChestsInArea (Config.ChestMania[prop][i]) ;
			Attack.clear(20, false, false, false, true);

		}

		Town.doChores();
	}
}

return true;

```

}

---

<div class="post-metadata">

**Author:** ![mf22](https://yyz2.discourse-cdn.com/free1/user_avatar/blizzhackers.discourse.group/mf22/32/18_2.png) [@mf22](https://blizzhackers.discourse.group/u/mf22)\
**Post date:** [January 8, 2020, 10:23am UTC](https://blizzhackers.discourse.group/t/chest-mania-no-attack/517/5 "2020-01-08T10:23:21Z")

</div>

> [@Casper](#):
>
> this works

ok 👍

> [@Casper](#):
>
> error in chestmania.  
> coords is not defined

Did you try to change the 2nd and 3rd lines between them?

```javascript
			Pather.moveToUnit(coords[0], 1, 2);
			this.openChests(20);
			Attack.clear(20, false, false, false, true);

```

---

<div class="post-metadata">

**Author:** ![Casper](https://avatars.discourse-cdn.com/v4/letter/c/b4bc9f/32.png) [@Casper](https://blizzhackers.discourse.group/u/Casper)\
**Post date:** [January 15, 2020, 11:11am UTC](https://blizzhackers.discourse.group/t/chest-mania-no-attack/517/6 "2020-01-15T11:11:01Z")

</div>

its all working now, but I had to alter the pather because coords were undefined and I couldn’t figure it out. so I just set it to journey to where I wanted it to go.
