How hero.hasEffect("effect") method supposed to work?

Hi, everyone!
I searched forum for more information or examples of hero.hasEffect(“effect”) method usage, but didn’t found any helpful topic.
Am I understand wrong something about this method or my code is bad or something else?
The level is “Backwoods treasure” in Backwood forest, language is Python and my code is:

`def RingOn():
    if self.canCast("invisibility", self):
        self.cast("invisibility", self)

loop:
    item = hero.findNearest(hero.findItems())
    RingOn()
    if hero.hasEffect("invisibility"):
        if item:
            hero.move(item.pos)
`

I supposed that hero would became invisible and pick up coins while invisibility effect duration, but Anya does only the first part)) She became invisible and stands still till running out of time.

Any hint or advice would be highly appreciated.

That is because when you read about the ring of invisibility, it tells you to use the effect “hide”

Oh my gosh( Thank you very much! I feel terribly ashamed for my inattention( As an excuse I could say that I bought ring of invisibility very, very long time ago and didn’t remember about “hide” parameter for checking invisibility effect and my logic circumvents me(
Again, I am very grateful for you, @Harry_the_Wanderer!

No problem. I understand. I have made a few of these mistakes myself. I got into the habit of going back and re-reading the documentation and hints to find out where I went wrong.

Nothing like trying to “attack” an enemy when you have a hammer equipped.

“Why doesn’t hero.attack(); work!?! … oh I need a sword.”

:slight_smile:

Oh, as far as my job doesn’t concern to IT at all and I have no programmer skills and play codecombat as hobby, I used to read documentation and hints carefully too, and also to search forum for more information in difficult cases. It helps me to get to “Kelvintaph Defiler” level in Kelvintaph Glacier location without posting asking for help on forum, and I am a little bit proud of it. :slight_smile: But now I was totally sure that “invisibility spell” should cast “invisibility effect”:confused: Sometimes specifications are very important )

we really need either
getEffects function or the UI shows us the effects of the objects. (and not a graphical icon above their head…)
I am currently hunting for what the effect is when a unit was raised from the dead.

Hmm, yes that would be helpful. They may be around somewhere… @Chaboi_3000 do you know if you can find these in the editor or something?
I think this works:

near = hero.findNearest(hero.findFriends()) #let's assume this is a raised enemy.
corpses = hero.findCorpses()
if near in corpses and near.health > 0: # It doesn't make much sense but I seem to remember it works.
    hero.command(near, "move", Vector(55, 55)) # If you only want your raised to move to this place.

I’m afraid I can’t help you any more than this…
Danny

it kind of makes sense, a corpse that has health must be a zombie :slight_smile: Will use that.
would still also hope we can get the string of what the “zombie” effect is.

It’s somewhere in the thang editor.