Swift daggers hero.throw() issue


New player here. Really enjoying the c++ part of this site.

I just reached the mission: swift daggers.

I am having trouble getting the hero.throw(enemy) function to work.

I am still learning so it is probably an error 40 :stuck_out_tongue:

Can anyone help me ?

Hi @LordlyLump, welcome to the discourse!
I don’t have much experience with c++, but I think you might need a closing bracket on line 15 to close the if hero.isReady(“throw”) block. Or (if it’s like javascript) you could even put it before the else.

Hi @LordlyLump and welcome to the forum! :partying_face:

Look at line 11. How should be the distance in order to be able to throw to the enemy?


Hello Deadpool! :smiley:

Thank you for the swift reply!

Sadly there is a closing bracket on line 15.

1 Like

Hello AnSeDra! :slight_smile:

Thank you for the quick reply!

I did an upsy! haha. Thank you for pointing that out.

The problem persist though :frowning:

1 Like

I think that you forgot to put the () at the end of the hero.throwRange method.



No I don’t think hero.throwRange needs that. I don’t want to give up too quickly but it might be because some levels don’t work with no python/javascript languages. They haven’t got them all fully working yet… But there could still be an error.


Or that. Sorry, but I do not know how to use a Ranger really well.


1 Like

No, it was definitely a good point, you’d think you would need a bracket. But in this case it’s a property not a function. Like Math.Pi as opposed to hero.attack().


It is so cool that you guys are so responsive. Thank you very much :).

The problem persists in the next mission in that mission tree. It is called Shrapnel.

Is there any way of getting a peak at the classes you are using in game?
Im thinking of the hero class here specifically ( if that is what it is… NEWBIE! :stuck_out_tongue: )

1 Like

I don’t really get what you mean. Could you explain a bit more, thanks.

1 Like

Oh… peep as in a look :stuck_out_tongue: Sorry about that :smiley:

Ah, “peek”, yes :grin:. I have all the heroes you can see in the hero bar except for Ritic (sad times), do you want to see something specific about the heroes?

1 Like

It looks like Deadpool is right.

hero.throwRange; does not seem to take any parameters.

1 Like

Oh cool!

I want the necro looking dude :smiley: !

What i mean is. When i play i code different functions into the terminal. Some of them start with hero.(then something).

Like hero.attack(enemy);

Maybe im out of my dept here. But is the hero referred to here not a class or a struct?


I see what you mean. I’m not sure what it’s called in programming but in python at least you can use Math.Pi, like a class, and Math.random(0, 2). So I don’t exactly know the difference. I think we might need a more experienced programmer…

1 Like

Ah. maybe you are right.

Cool with python. i don’t know that language at all. It is so interesting seeing the differences.!

I have contacted my teacher.

He has over 30 years of experience with CPP. Such a cool and knowledgeable guy.
Do you think that the people who make this would be interested in letting him help out?
And if so how he can contact them?

1 Like

Umm, I’m not sure what you mean exactly. I don’t think the hero. system is broken, I think it’s just the development of the c++ levels not quite being finished which is causing an error.
What kind of help are you thinking of? Although I, myself am not the best coder ever, I think the people who made CodeCombat do definitely know what they’re doing :smile:.
But I think they do alwasy look for help. You can go to the github helping page:

1 Like

That is very good to hear.

I was not trying to say that they don’t seem competent. The game is super fun. And it says experimental so :).

My teacher is just a cool guy who loves CPP and especially sharing it. So i think this might be something for him.

I found this link https://codecombat.com/contribute/archmage.

Such a cool project this is :D!

Oh i totally missed your link. Thanks Deadpool :D.