Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

Deadly Dungeon Rescue Help?!


The player has made this level almost impossible because you cannot do if(enemy.type == "Vault Door 1")
and if statements are just useless.


By the player I assume you mean Sotonin, who created the level.

If if-statesments are one thing not, than useless (sounds better in german).
Without if-statesments, we could only write static code, which does every time the same thing. if-statesments allow us react to different situations.

Despite from that, maybe the error is on your side. Maybe there simply is no enemy.type == "Vault Door 1". Remember the first levels where you killed ogres? You attacked them by name!.

Try this.attack("Vault Door 1");


Vault Door 1 is not it’s type, it’s the name.

If you insist on using type, the type for all the doors is simply “door”. nothing impossible about it. You just need to get creative and debug stuff. You can easily find out anything’s type by having your hero say enemy.type. That simple.


WHOOHOO I beat the level Deadly Dungeon Rescue!!!


congrats! :slight_smile: i hope it presented a challenge and overcoming it was satisfying


look here. This is ending… But for those of you who need help can come


The say command is a great debugging tool. Definitely something people may overlook.


What is the exact syntax for the say command to return the name of an item like a door or chest? I can’t find it in my panel.

Deadly Dungeon Rescue doors?

Door is your enemy :smile:

self.moveXY(150, 28)


On this level “chests” aren’t actual objects . . . so you have to use a flag or the x,y location of the image on the map.

doors are enemies, so:

enemy = <insert find enemy command here>
if enemy:

That will actually say the name of any enemy.

doors are of type door, so:

if enemy.type == "door":

will only “say” if the enemy is a door

But as juraj suggests, you don’t need to know its name if you’re happy/safe attacking whatever is closest.


When i complete this level i hasnt any problem with identify doors as the enemy without naming. i think you can atack it without enemy.type naming


You can just make your guy not attack munchkins, since the guards are munchkins.

    if (enemy) {
        if (enemy != "munchkin") {

My hero still killed the guard, so not attacking Munchkins doesn’t solve failing the mission with kills.


Well, enemy returns the name of the nearest enemy, I assume, and as far as I know, there is no ogre named “munchkin.” Try if (enemy.type != "munchkin") {.


Perhaps there is more than 1 type? I have to check and see.


Chests are type “chest” and called “Treasure Chest 1” / “Treasure Chest 2” / “Treasure Chest 3” / “Treasure Chest 4” by name


I have another problem: after cracking one chest (any of four) hero don’t want to do anything more. What’s wrong? Is it just me?


That sounds like a problem with your code…


Tried different ways. Action stops even with:

self.moveXY(150, 28)
self.attack("Vault Door 1")
self.attack("Vault Door 1")
self.attack("Treasure Chest 1")
self.attack("Treasure Chest 2")

and chest 2 never was attacked, hero didn’t any step more…

PS and yes, I’m already know, that there is no need to crack chest, but…


I don’t see you telling the hero to do anything after:

self.attack(“Treasure Chest 2”)

so why do you expect that it will?