Help on Cloudroip treasure

Ok so here’s my code

It worked the first time, but now for some reason the peasants are getting stuck at about 236 gold.

Its also lagging a bit for some reason.

Any help?

Part of the reason for the lag may be the fact that you are running two for loops inside of one another: the for loop with the items array and the one with the friends array. You don’t need the items for loop; just have the for loop commanding the friends seperate. Also, the place where you define “items” will just return a singular item, so use hero.findItems() instead of hero.findNearestItem(). It probably stops at a certain point when it returns null instead of an empty array.

1 Like

Ok so it worked once (I changed the hero.findNearestItem to hero.findItems()) but for some reason it won’t work the second time (at least not correctly for some reason)

help plz?

Are your peasants getting killed or stuck at a certain point? Or are you running out of time?

Ok now its working, but even though by running the code it works, for some reason submitting doesn’t.

My hero gets killed

I guess its my gear right?

Oh each time you submit you will get a different seed, some are better than others and may be the difference between winning and losing. Improving your gear and strategy will definitely get you farther.