SOLVED: Stranded In The Dunes - it gets stuck at the end

It all goes well until I get to the Skeleton King then after maybe two of his skeleton waves and around the time of the first or second potion drop from the bird the level stops working. The it isn’t frozen exactly, animations like flags waving and the skulls over my zombie escort continue to move, and I can place flags but nothing responds to them. No errors are shown at any point.

Here is my code. I’m basically just using a black flag to walk across the map avoiding yaks and summoning undead the whole time. Then I get to the skeleton king and ideally will barricade myself in behind the pyramid.

edit: I put in the references to Skeleton King recently, after noticing it was sticking there, hoping maybe it had something to do with him but those references have made no difference. Same outcome.

# Go to the far right edge of the level to find new areas.
# Check the guide for more details.

def blackFlagCheck():
    bFlag = self.findFlag("black")
    if bFlag:
        flagTarget = {'x': bFlag.pos.x, 'y': bFlag.pos.y}
            if self.distanceTo(flagTarget) > 3:
            if bFlag:
                flagTarget = {'x': bFlag.pos.x, 'y': bFlag.pos.y}
def violetFlagCheck():
    vFlag = self.findFlag("violet")
    if vFlag:
        flagTarget = {'x': vFlag.pos.x, 'y': vFlag.pos.y}
        if > self.costOf("soldier"):

def greenFlagCheck():
    gFlag = self.findFlag("green")
    if gFlag:
        flagTarget = {'x': gFlag.pos.x, 'y': gFlag.pos.y}
        self.buildXY("fence", flagTarget.x, flagTarget.y)

def pickUpCoins():
    coins = self.findItems()
    bestCoin = None
    bestRating = 0
    for coin in coins:
        coinDist = self.distanceTo(coin)
        coinValue = coin.value
        coinRating = coinValue / coinDist
        if coinRating > bestRating:
            bestCoin = coin
            bestRating = coinRating
    if bestCoin:

def undeadArmy():
    corpseNumReq = 3
    corpseDistReq = 20
    if self.isReady("summon-undead"):
    if self.isReady("raise-dead"):
        corpses = self.findCorpses()
        nearCorpses = []
        for corpse in corpses:
            if self.distanceTo(corpse) < corpseDistReq:
        if len(nearCorpses) > corpseNumReq:

def doDrain():
    enemies = self.findEnemies()
    enemy = self.findNearest(enemies)
    if enemy:
        if self.distanceTo(enemy) < 15 or enemy is "Skeleton King":
            if self.isReady("drain-life"):
                self.cast("drain-life", enemy)

def penderAllAttacks():
    enemy = self.findNearest(self.findEnemies())
    if enemy and != "neutral" or enemy is "Skeleton King" and self.distanceTo(enemy) < 10:
        if self.isReady("electrocute"):
        if self.isReady("throw"):
            if self.distanceTo(enemy) < self.throwRange and self.distanceTo(enemy) > 8:
        if self.isReady("poison-cloud"):
            self.cast("poison-cloud", enemy)

def deflectMissiles():
    missiles = self.findEnemyMissiles()
    if len(missiles) > 0:
        nearMissile = self.findNearest(missiles)
        if nearMissile and self.distanceTo(nearMissile) < 20:

def doManaBlastMultipleTroops():
    #currently set to look at sand-yak
    manaNum = 4
    enemies = self.findEnemies()
    nearEnemies = []
    if len(enemies) > 0:
        for enemy in enemies:
            if self.distanceTo(enemy) < 15:
        if len(nearEnemies) > manaNum:
    if self.isReady("mana-blast"):
        nearEnemy = self.findNearest(self.findEnemies())
        if nearEnemy and nearEnemy.type is "sand-yak":
def confuseSomeone():
    someoneList = self.findByType("sand-yak")
    if len(someoneList) > 0:
        for i in range(len(someoneList)):
            thisGuy = someoneList[i]
            if self.isReady("confuse"):
                self.cast("confuse", thisGuy)
            if self.distanceTo(thisGuy) > 22:
            if thisGuy.hasEffect("confuse"):

def scareSpecific():
    if self.isReady("fear"):
        enemies = self.findEnemies()
        specific = "Skeleton King"
        if len(enemies) > 0:
            for enemy in enemies:
                if enemy.type is specific:
                    if != "humans" and self.distanceTo(enemy) < 5:
                        self.cast("fear", enemy)

def doChainLightning():
    if self.isReady("chain-lightning"):
        enemies = self.findEnemies()
        enemy = self.findNearest(enemies)
        if enemy and != "neutral" and self.distanceTo(enemy) < 25:
            self.cast("chain-lightning", enemy)

def commandSoldiers():
        enemies = self.findEnemies()
        mySolders = self.findByType("soldier")
        if len(mySolders) > 0:
            for i in range(len(mySolders)):
                soldier = mySolders[i]
                enemy = soldier.findNearest(enemies)
                if enemy:
                    self.command(soldier, "attack", enemy)



I did it without using “summon-undead” or “raise-dead” and it played right through.

All of this is code I’ve used successfully in other levels. In fact I just copy/pasted it to beat Sarven Brawl.

1 Like

I have a question and this DEFINITELY sounds really dumb. Concretely, I’ve been trying to beat the level Stranded in the Dunes over and over again, and after having investigated on the internet, everyone seems to be using soldiers. Problem is, I have no idea how to get them…

1 Like

Soldiers can be summoned by a Boss Star, which is not available until Cloudrip Mountain. Soldiers are definitely an asset in Stranded in the Dunes, but are not required to beat it.

1 Like

So I should probably wait for cloudrip to beat this level

1 Like

If you prefer to, you could.

1 Like

I for one beat it without summoning; however, I waiting util I had really good equipment on the character before doing this level and steered him carefully with the flag.

1 Like

Hi, Im currently still having this same issue with this level, not because my code is broken or anything, by the time i get to the skeleton king and go through the first 3-4 rounds, it freezes up… once i’ve even killed the skeleton king, but just had two more minions to kill in the back ground when it froze, but its done it every time, and i’m not summoning anything.

As you can see, i’ve even tried LoS’ing the skeletons.
As a side note, i’ve noticed that going through the map, you could charge right toward the yaks as long as you don’t attack them they will still target you and bump past you but not inflict dmg, meaning you could walk to the middle of the map to stop them from re-spawning, hit a regen and then kill the skeletons that weren’t trampled.

Anyway, was just wondering if there was any other fixs out there, didn’t want to start another post about this as I see many people have, but I don’t see the resolution.

1 Like

What I don’t get is how to actually kill the Skeleton King. I have gotten all the way to the part where I battle the Skeleton King but then I can’t find out how to kill it with my if statement:

if enemy and enemy.type is “?”:
I don’t know what to put in these --> “” to attack the King

1 Like

Well, when you initially encounter the king he is not attackable, he attacks you for a few seconds and then steps back and summons a few waves of skeleton minions. After killing those waves he will start attacking you again, at that time is when he will be attackable. Also, he will be the only enemy left, so you don’t have to specify a particular enemy.type, just use enemy and you will attack him.

1 Like

ok thanks for the information.

1 Like

what code would you use after you kill all of his minions so that you could kill the king?

1 Like

Just use find nearest enemy, attack nearest enemy (as long it is not an “sand-yak” :stuck_out_tongue:)

If you survive up to the king area you’ll get healing potions after every wave, you can’t die.

1 Like

The thing is, I can’t do that. I’ve already tried that and I still attack the yaks.

Here is the code that I used:

enemy = self.findNearest(self.findEnemies())
flag = self.findFlag(“black”)
if flag:
if enemy and enemy.type is not “yak”:

This is the code that did not work.

1 Like

Check the first desert in the desert, you are doing exactly the same thing there:

1 Like

Should this post not be taken down?

1 Like

Yes I will have it taken down

1 Like