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

Help! Can't make the hero move to flags in Tactical timing

#1

I made my code to make my hero go to flags but he wouldn’t go there.

#2

do you have the flag item equipped and how are you calling the flag logic?

#3

,

var enemy = hero.findNearestEnemy();
var flag = this.findFlag();

while(true) {
if (flag) {
hero.moveXY(flag);
hero.pickUpFlag(flag);
}else if(enemy) {
hero.attack(enemy);
}
,
Sorry if it’s not posted according to the FAQ, I’m still working on how too use the code thing. BTW I have the basic flag.

#4

@TheEpicSoldierReborn just highlight your source code and use the “Preformatted text” button to fix it.

also its the ` below the ~ character (US keyboard) and not the ' below the " character.

#5

take a look at this again.

hero.moveXY(x ,y); wants two arguments an x-coordinate and a y-coordinate.

So the question is “Does a flag have and x and y coordinate and how would you access them?”

#6

Sorry the moveXY command was just trying to get my hero to move the flag.

#7

@TheEpicSoldierReborn I am not sure what you mean. Are you ok now with the code or did you still need help?

#8

Fixed it! I found out the solution!

#9

This topic is officially solved.