Zero Sum "Can't Read Protect Property: target"

Basically I was trying to create this code in Zero Sum, and there is an if statement saying if hero.findNearestEnemy().target = hero, then I do something.

When the yeti jumped out of its cage, my hero got an error saying it can’t read the protected property… why?

also, how does the array returned by hero.findEnemies() work? are the enemies nearer to the hero at the front of the array, or are the enemies just numbered based on their coordinates?

What is the code? If you don’t have the code, we can’t help that much.

can’t post the code… (Don’t want you guys plagiarising it :wink: )

1 Like

FindEnemies will return all of the enemies within your sight, so make sure you have equipped the right glasses.

dude. It’s Zero Sum… HELLO? (can’t choose glasses)

Sorry, oops, I forgot. Well, just give that line of code that you are having trouble with when the box is destroyed, that okay?

Think it’s because yeti’s target property is protected. I fixed it by setting an if statement that excludes the yeti. Problem now fixed. :smiley:

yeah, I think that would work.