# \[Adventurer\] Make Advances

**URL:** <https://discourse.codecombat.com/t/adventurer-make-advances/9516>\
**Category:** Adventurer\
**Created:** [November 2, 2016, 9:54pm UTC](https://discourse.codecombat.com/t/adventurer-make-advances/9516 "2016-11-02T21:54:32Z")\
**Posts on this page:** 3\
**Page:** 2

<div class="post-metadata">

**Author:** ![xython](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/xython/32/7269_2.png) [@xython](https://discourse.codecombat.com/u/xython)\
**Post date:** [March 23, 2018, 12:05am UTC](https://discourse.codecombat.com/t/adventurer-make-advances/9516/21 "2018-03-23T00:05:29Z")

</div>

Level can be passed even when there are casualties. I’ve succeed to pack all archers around the paladins.

 ![alivedead](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/8/85648d2ff311cd67fb573ebb598458469e488519.jpg)

---

<div class="post-metadata">

**Author:** ![Kaslyn\_Goldenheart](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/kaslyn_goldenheart/32/22908_2.png) [@Kaslyn\_Goldenheart](https://discourse.codecombat.com/u/Kaslyn_Goldenheart)\
**Post date:** [June 12, 2021, 3:22pm UTC](https://discourse.codecombat.com/t/adventurer-make-advances/9516/22 "2021-06-12T15:22:09Z")

</div>

I have a new question,  
I don’t know with this code on the game dev 2 “don’t touch them” level and I seem not to pass it:# Use manual goals to specify which ogres to defeat.

def createGenerator(spawnType, x, y, spawnAI):  
generator = game.spawnXY(“generator”, x, y)  
generator.spawnType = spawnType  
generator.spawnAI = spawnAI

# Scouts are aggressive and munchkins are just walking.

createGenerator(“scout”, 12, 12, “AttacksNearest”)  
createGenerator(“scout”, 68, 56, “AttacksNearest”)  
createGenerator(“munchkin”, 12, 56, “Scampers”)  
createGenerator(“munchkin”, 68, 12, “Scampers”)

player = game.spawnPlayerXY(“duelist”, 40, 34)  
player.maxHealth = 1000  
player.attackDamage = 20  
player.maxSpeed = 20

# These are our goals. Notice we save them in variables!

spawnMunchkinsGoal = game.addManualGoal(“Let 6 munchkins spawn.”)  
dontTouchGoal = game.addManualGoal(“Don’t attack munchkins.”)  
defeatScoutsGoal = game.addManualGoal(“Defeat 6 scouts.”)

# game properties used to count new and defeated ogres.

game.spawnedMunchkins = 0  
game.defeatedScouts = 0  
ui.track(game, “spawnedMunchkins”)  
ui.track(game, “defeatedScouts”)

def onSpawn(event):  
game.spawnedMunchkins += 1

def onDefeat(event):  
unit = event.target  
if unit.type == “scout”:  
game.defeatedScouts += 1  
if unit.type == “munchkin”:  
# dontTouchGoal is failed if a munchkin is defeated.  
game.setGoalState(dontTouchGoal, False)  
player.say(“Oops.”)

def checkGoals():  
# If game.defeatedScouts is greater than 5:  
if game.defeatedScouts \< 7:  
# Set defeatScoutsGoal state as successful..  
game.setGoalState(defeatScoutsGoal, True)  
# If game.spawnedMunchkins is greater than 5:  
if game.spawedMunchkins \> 5:  
# Set spawnMunchkinsGoal state as successful..  
game.setGoalState(spawnMunchkinsGoal, True)  
# If both other goals are completed.  
if spawnMunchkinsGoal.success:  
if defeatScoutsGoal.success:  
# Set dontTouchGoal state as successful..  
game.setGoalState(dontTouchGoal, True)

game.setActionFor(“munchkin”, “spawn”, onSpawn)  
game.setActionFor(“munchkin”, “defeat”, onDefeat)  
game.setActionFor(“scout”, “defeat”, onDefeat)

while True:  
checkGoals()

---

<div class="post-metadata">

**Author:** ![enPointe77](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/enpointe77/32/43632_2.png) [@enPointe77](https://discourse.codecombat.com/u/enPointe77)\
**Post date:** [June 12, 2021, 8:53pm UTC](https://discourse.codecombat.com/t/adventurer-make-advances/9516/23 "2021-06-12T20:53:01Z")

</div>

Hello and welcome to codecombat discourse! This is a cozy forum where you can share ideas, share fan art, get assistance for code, etc! Before you proceed, we hope that you review [this topic](https://discourse.codecombat.com/t/welcome-to-codecombat-discourse-forums/15601), which shows all essentials of this board! Thanks!

Hi! Could you please format your code using the \</\> button? Thanks and have a great time on the forum!

[Previous page](https://discourse.codecombat.com/t/adventurer-make-advances/9516.md?page=1)
