Sarven Sentry Help Needed[SOLVED]

Btw the Ogre walked right through my fence. Like how?

Hi @Reyansh_Tandon , please post your code correctly/fomated

and i found something too

in the if flag black: you have fence insted of fire-trap

Heres something for flags


You have to be quick by placing flags
when you run the code, it gives you another random seed.

BEFORE

AFTER

if you dont know how to place flags,
look at the bottom left of your screen and click green, click on the map

also, use hero.pickUpFlag() to pick the flag up. Else, it might confuse your hero into going to your previous flag

EDIT : if i posted the same thing in a different topic, its cause im to lazy to wright it again lol

1 Like

You didn’t add pick up flag either

while True:
flagGreen = hero.findFlag(“green”)
flagBlack = hero.findFlag(“black”)

# If there's a flagGreen...
if flagGreen:
    
    # Build a "fence" at flagGreen's position.
    hero.buildXY("fence", flagGreen.pos.x, flagGreen.pos.y)
    hero.pickUpFlag(flag)
    # Pick up the flag!
    
# If there's a flagBlack...
if flagBlack:
    
    hero.buildXY("fire-trap", flagBlack.pos.x, flagBlack.pos.y)
    hero.pickUpFlag(flag)

hero.moveXY(43, 31)

So I read everything and followed that, but when I wrote pickupflag it says flag not defined

because it isint you have to do flagGreen and flagBlack

Thanks for all the help @Eric_Tang @WaWa_Yang

is it solved?
20 charactefrs

Yep. (20 Characters)