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

Must have "missed" it, but...-the code for planting a flag in the first place

Must have “missed” it, but…-the code for planting a flag in the first place…
People here seem to have problems locating or picking their flags, but not for placing them.
For some reason I don’t seem to recall seeing the code for planting one.
I guess it should be something like:

green = hero.Placeflag(flag.pos.x, flag.pos.y)
black = hero.Placeflag(flag.pos.x, flag.pos.y)
purple = hero.Placeflag(flag.pos.x, flag.pos.y)

which should place flags with diferent colors at specific locations.
I’m following what I perceive as the script logics, but I did not see anything like it anywhere, not even the hints section.

I think one can also use it to establish dynamic flags, meaning:

green = hero.flagPlace(enemy.pos.x, enemy.pos.y)

and make conditionals for the hero behavior towards different characters.

-Any help in feaguring it out is welcome.

If I understand you right, you can’t place a flag with code. But flags are suppoused to be placed manually in real-time gameplay mode, after clickin’ the “SUBMIT” button. (That’s why I don’t like flags:) ).

Thanks Alex,
Than’s exactly what I was looking for. -It doen’t make sese to me that a code learning app, will refrain from using code, especially, if there is such a thing as the code I used to illustrate what I meen.

Additionally, I really don’t understand yet, how to put down the flags after submit…, or how to select the color. -Is it by clicking the mouse over a coordinate? -Ringht clicking? double-clicking? -Do I have to “drag” the flag ffrom somewhere ?

If you can help me understand this, last part, it would be axremely helpful.

Push “SUBMIT” button and click the left mouse button on the needed flag to choose it. Than left click on the level field to put the flag in the place. Flag is planted))
At least for windows PC. Idk about other OS.

1 Like

That is right for all OS
Flags are used for marking places specifically
Like if you put the right code down in the right place, your hero would go to the flag before doing anything else :smiley:

Yep)
But manual marking places is both hard and weak for me. I prefer vectors. You’ll find it soon.
Good luck)

2 Likes

When You said

I felt spooped.
I understand that you prefer vectors, as flags do use up quite a few lines on your code.
How far are you into the game?

I get on Kelvintaph Glacier pretty much time ago.
Vectors starts there, with the first level of glacier. If I’m not mistaken)

Ah…
Kinda stuck now…
I am stuck on Clash Of Clones on Sarven Desert
Please go to Need help on Clash Of Clones ASAP
If you are able to help at all I would be very thankful ! :smiley:

Thanks a bunch Alex.
I guess now I only have to try and locate where “flags needed” is…(I did not seem to see one, but I did not subscribe yet for money, just registered as user, playing with the open levels…

I’m not a subscriber too.
You meet flags somewhere in the forest, I suppose.

I think I saw quite a lot topics about this lvl and there were much advices about it. I can try when I’ll have spare time. Show us your inventory.

UPD Sorry, was in harry, now I’ve seen inventory and post in that topic.

Got it !! -Finally I submitted instead of running. I did not complete the stage I’m in (needs some code tweaking), Diont’ remember the stage name - I’m supposed to beat all the ogres, and run for healing to a specified spot when I’m too heart.
-BUT, I finally figured out that the flags show on the bottom of the scene, and clicking them and cliking to place works just fine.
–Soecond thought it is quit couterintuitive to pick up the flags just to use them again…

Hmm, as far as I remember, first levels were informative enough about flag usage. I mean how to drop flag, pick it up and so on. Maybe it was explained in the level hints. Or in the level instructions. Anyway, it was quite simple to obtain “flag skills”. Maybe something changes (but, I think, not). Sometimes, while having troubles with definite piece of game/code, there is a bit of information out of our sight. We miss something. Man times I spend minutes and hours with some issue, just because was inattentive and careless about details.

As I remember you don’t need to pick up flag to use it again, just click on this flag on the toggle bar to choose it and click on playground to set it up.

It’s a ‘stage thing’…while not a stage win requirement, they say in the comments of the code that I should pick up the flags, and actiallu provide the code for t. -I don’t know why. My ‘hero’ got stuck and stoppped fighting after one cleave, and one attack, and doesn’t seem to chakc itself for health status, or disengage to “go to the healer” - somehow the whole loop in this stage doesn’t seem to loop.
So…-at some point I’ll probably reset the code and start again.

What level is it? Could you provide direct link?

Inside Githard Dungeon, there is a link to >> Backwood Forest (gateway is near a gate at the righthand side of the scene and is an arrow which you click to go there) > 33/123 (signal Course) - the bottom righthand side flag (out of the possible two .

Thnx, found it. It’s easier to copy level url from address bar while level playing, like this: https://codecombat.com/play/level/signal-corpse?

You need to pick the flag up because if it stands on the ground, hero would always run towards it and never execute others part of code.

Well…-I did that and he stood and got bashed to death, I managed to get him to do a singe attack and a single cleave, but not to run to the doctor…-OR alternatively - fight back !! -the while loop seems not to go through its rounds…-so…-back to “the grind” to see what’s not working.
I was thinking to plant a "got to the doctor, every other line so he will heal (still did not do that - other engagements in life…).