1) No, AI units attack enemy units, not trees, you should trigger that...
2) In the object editor, press CTRL+D then you can see it's value (4 digit), like hpea, hfoo, hkni etc...that's the unit type, if you create a custom unit, the h000,h001 will appear...
it will be declared in jass as integers, so instead of unittype, it can be is...
local integer peasant = 'hpea'