Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Help with selecting gear in dueling grounds

#1

I have certain gear equipped (such as the sword of the forgotten, emporer’s gloves, programmication IV, boss star III, etc.), or the gear that I equipped before entering the dueling grounds. However, this gear is only equipped when I am on the red team. When I am on the blue team, my gear changes back to the gear I had equipped the first time I ever played in the dueling grounds.
Code when on red team:

def summonSoldier():
    # Fill in code here to summon a soldier if you have enough gold.
    if hero.gold>=hero.costOf("archer"):
        hero.summon("archer")
    elif hero.gold>=hero.costOf("soldier"):
        hero.summon("soldier")
    


# This function commands your soldiers to attack their nearest enemy.
def commandSoldiers():
    for soldier in hero.findFriends():
        enemy = soldier.findNearestEnemy()
        if enemy:
            hero.command(soldier, "attack", enemy)
while True:
    enemy = hero.findNearestEnemy()
    item = hero.findNearestItem()
    summonSoldier()
    commandSoldiers()
    if item:
        hero.move(item.pos)
    elif enemy:
        if hero.canCast("chain-lightning", enemy):
            hero.cast("chain-lightning", enemy)
        elif hero.isReady("bash"):
            hero.bash(enemy)
        else:
            hero.attack(enemy)

Code when on blue team:

# Defeat the enemy hero in a duel!

while True:
    
    # Find and attack the enemy inside a loop.
    # When you're done, submit to the multiplayer ladder!
    enemy = hero.findNearestEnemy()
    if hero.isReady("cleave"):
        hero.cleave(enemy)
    else:
        hero.attack(enemy)
        

My gear also changes when I am on blue team, as my gear changes to having things like programmication II, long sword, defensive infantry sheild, etc. please fix this so I can do much better on the ladder!

#2

You can get to the multiplayer section with the link below to pick which level you want and then change up which side you fight on instead of going through the maps. This way you can pick which side red or blue you want to fight with and make the changes to the code. Each side is separate and can have a different hero/gear and different code. I’m trying two different approaches and have them going at the same time, one on each side.

#3

No, the problem is that is won’t let me pick my gear when I play on the blue team

#4

While you are in the duel writing code, you can go to the Game Menu and change the hero and gear at any time. After you change to what you want, it will reset the level with your new hero and gear without changing the code.

#5

ah thanks
:slight_smile: