Grim-determination issue


#1

in the level grim-determination i wanted to attack the warlock but my units cant reach it . any advise


#2

I originally passed the level without attacking the warlock. Just command your paladins to keep healing the one with lowest health and make them shield when not healing. Let the griffin riders do all the damage.

Something that can improve the output of the griffin riders would be to use a better coin collecting strategy. I did not do it at the time, but splitting the field into a half for each peasant could be helpful.


#3

yes this is another point , i want to kill him to finish the level faster but i cant reach him . is this normal

and this is my code

loop:
    # Summon griffin riders!
    if self.gold > self.costOf("griffin-rider"):
        self.summon("griffin-rider")
    enemies =self.findByType("warlock")
    for enemy in enemies:
        if enemy.type == "warlock":
            for friend  in self.findByType("griffin-rider"):
                self.command(friend, "attack", enemy)
        else:  
            commandFriends()     

#4

Maybe it’s a problem of range on your glasses or such.

On a separate note. If I remember correctly, more warlocks will spawn if you kill the first one, so killing the first one will actually get you in even deeper trouble.


#5

i don’t think so .but i want to know why this code is not working . paladins are so close from the bombs and i want them far from the bombs

i used this code

def lowestHealthPaladin():
    lowestHealth = 99999
    lowestFriend = None
    friends = self.findFriends()
    for friend in friends:
        if friend.type != "paladin":
            continue
        if friend.health < lowestHealth and friend.health <friend.maxHealth:
            lowestHealth = friend.health
            lowestFriend = friend
    return lowestFriend
    
for friend in self.findByType("paladin"):
    x2= friend.pos.x +10
    y2= friend.pos.y+10
    self.command(friend, "move", {"x":x2 ,"y":y2})   
loop:
    friends = self.findFriends()
    items = self.findItems()
    if self.costOf("griffin-rider") < self.gold:
        self.summon("griffin-rider")
    for friend in friends:
        if friend.type == "peasant":
            self.command(friend, "move", friend.findNearest(items).pos)
        elif friend.type == "griffin-rider":
            self.command(friend, "move", {"x":80 , "y":40})
            self.command(friend, "defend", {"x":80 , "y":40})
        elif friend.type == "paladin": 
            target = lowestHealthPaladin()
            if target:
                self.command(friend, "cast","heal", target)
            else:
                self.command(friend, "shield")



so any advise


#6

any advise why the paldins are not moving to the new position ?


#7

Perhaps you enter the loop and issue new commands before they can move in position. Try adding a check for self.now()>2 or such to the looping paladin commands.


#8

as you see the for loop is before anything .so i found it strange to not move . i will try the time condition and see what will happen


#9

Yeah it’s outside the loop so it will only run once, then you enter the loop and a few milliseconds later they get a new command that will likely cancel the first one out.