FindByType() question


#1

I just bought the Hardened Steel Glasses and have been playing with FindByType(). Based on that experience, I was wondering about a few things:

  1. Is there a comprehensive listing of the different types of enemies? Or all different types in general?
  2. Are all spaces in type names handled with a “-” (as in “sand-yak”)?
  3. Do coins have types? I’ve tried “gold-coin” and “gold” but neither work. If not, is there a reason why coins don’t have types even though each has a different name?

#2

I’m agree with you, very often, an easy way to get types is missing.
What you can do is to select an unit, the type will be displayed ( without the -).
You can also : this.say(enemy.type), which is more accurate.

About coins, I remember you could use something like that : coin.value
It gives the value, and it’s the most important thing :slight_smile:
(not sure, correct me if I’m wrong).


#3

Is the value numeric (i.e. “1” or “5” or “10”)?


#4

Yes, though the maximum as fas as I know is 5.


#5

I came back to a previous where I used coin value : Greed.
In this level, coin items have the following properties :
bountyGold = 1,2 or 3 for example (sorry, I don’t remember it was such name)
type = "coin"
id = “Silver Coin 9”

So you can do :

if(item.bountyGold > 2)...

or

var rank = item.bountyGold / this.distanceTo(item);