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


#1

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?


#2

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?


#3

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


#4

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


#5

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


#6

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


#7

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


#8

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:


#9

yeah, I think that would work.