it says I I don’t have the “findFriends” skill, but when I look at my list of skill, I’ve found I already have the skill granted by my hero himself. This is the first time I’ve come across “findNearestFriend” - it didn’t as ask me to buy any specific item before I went to this level either. Is there a bug to this?
Well that’s strange because the “findNearestFriend()” function was already written down by the computer itself not me. Hence the code should have existed
Ah nevermind, the one that you see on the picture was my actual code except more organized. After hours of fiddling around, I manage to find the cause of the problem.
It was no more then a bug, I had to exit the level, de-equip my new pair of glass and equip them again before entering the level. The code that I remains unchanged and yet works. This is something the developer of codecombat should take a look into as it is really frustrating.
while true do
local friend = self:findNearestFriend()
local enemy = self:findNearestEnemy()
if friend and enemy then
self.say("To battle, " + friend.id + “!”)
self.say(“Go Away,” + enemy.id + “!”)
–# Now find the nearest enemy and tell them to go away.
end
end
the use of “else” doesn’t work because I don’t have a for loop equipped yet
If you are still having problems with that code, please format it according to the FAQ. It helps us be able to understand your code as we try to help you. https://discourse.codecombat.com/faq