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


#1

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}
        self.removeFlag(bFlag)
        loop:
            if self.distanceTo(flagTarget) > 3:
                self.move(flagTarget)
            else:
                break
            if bFlag:
                flagTarget = {'x': bFlag.pos.x, 'y': bFlag.pos.y}
                self.removeFlag(bFlag)
            
def violetFlagCheck():
    vFlag = self.findFlag("violet")
    if vFlag:
        flagTarget = {'x': vFlag.pos.x, 'y': vFlag.pos.y}
        self.removeFlag(vFlag)
        if self.gold > self.costOf("soldier"):
            self.summon("soldier")

def greenFlagCheck():
    gFlag = self.findFlag("green")
    if gFlag:
        flagTarget = {'x': gFlag.pos.x, 'y': gFlag.pos.y}
        self.removeFlag(gFlag)
        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:
        self.move(bestCoin.pos)

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

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 enemy.team != "neutral" or enemy is "Skeleton King" and self.distanceTo(enemy) < 10:
        
        if self.isReady("electrocute"):
            self.electrocute(enemy)    
        if self.isReady("throw"):
            if self.distanceTo(enemy) < self.throwRange and self.distanceTo(enemy) > 8:
                self.throw(enemy)
        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:
            self.cast("windstorm")

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:
                nearEnemies.append(enemy)
        if len(nearEnemies) > manaNum:
            self.manaBlast()
    if self.isReady("mana-blast"):
        nearEnemy = self.findNearest(self.findEnemies())
        if nearEnemy and nearEnemy.type is "sand-yak":
            self.manaBlast()
            
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)
            else:
                continue
            if self.distanceTo(thisGuy) > 22:
                continue
            if thisGuy.hasEffect("confuse"):
                continue

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 enemy.team != "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 enemy.team != "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)

loop:
    blackFlagCheck()
    greenFlagCheck()
    violetFlagCheck()
    undeadArmy()
    commandSoldiers()
    #pickUpCoins()
    doDrain()
    doManaBlastMultipleTroops()
    #doDrain()
    confuseSomeone()
    #doDrain()
    scareSpecific()
    doChainLightning()
    penderAllAttacks()

#2

SOLVED.

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.


#3

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…


#4

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.


#5

So I should probably wait for cloudrip to beat this level


How do you defeat clash of clones?
#6

If you prefer to, you could.


#8

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.


#9

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.


#10

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 “?”:
self.attack(enemy)
I don’t know what to put in these --> “” to attack the King


#11

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.


#12

ok thanks for the information.


#13

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


#14

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.


#15

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:

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

This is the code that did not work.


#16

"sand-yak"
Check the first desert in the desert, you are doing exactly the same thing there:


#18

Should this post not be taken down?


#19

Yes I will have it taken down