how can I access the name of a unit in a script?
I tried it this way, but it didn't work.
- Code: Select all
~ This procedure adds one 'Scythe' tag to the unit for every instance of this option taken.
~ For Tyrant Guards only add a single 'Scythe' tag to the unit
var i as number
var selcount as number
var result as number
var unitname as string
var unitid as string
selcount = selection
unitname = "Tyrant Guard"
unitid = "tyTyrGuard"
if ([b]this.unit.name = unitname[/b]) then
result = unit.assign[tyTags.Scythe]
else
for i = 1 to selcount
result = unit.assign[tyTags.Scythe]
next
endif
My problem is the bold marked part of the IF statement. Either all units jump into the else part or in the then part. But there is no difference if the unit is tyrant guard od not...
Many thanks in advance,
Andy