Hi!
I working on a script to spawn civilians to towns. To speed this up I decided to use the same units repeatedly and set their damage to 0 whenever a citytrigger is activated.
Snippet (moving civ's to a far away position when a town is left):
_counter = 1
_nrOfCivilians = 9
#loop
(_test select _counter) setdamage 0
call format["%1 setpos civilianHome;%1 setbehaviour {safe};%1 setcaptive true;%1 allowfleeing 0.9;%1 domove civilianHome",(civNames select _counter)]
call format["%1 removeAllEventhandlers {killed}",(civNames select _counter)]
_counter = _counter + 1
?(_counter<=_nrOfCivilians):goto "loop"
where:
_test = [0,civ1,civ2,civ3,civ4,civ5,civ6,civ7,civ8,civ9]
civNames = ["","civ1","civ2","civ3","civ4","civ5","civ6","civ7","civ8","civ9"]
civilianHome is a position2d
The problem is they won't get up again, still seem to be dead, however the setpos command works
. I tried call format["%1 setdamage 0",(civNames select _counter)] before, this didn't work either.
They are non player units (so no problems caused by respawn), they were created with createUnit, but I tried it with editor set units to no avail. I also created another small test mission where radioalpha would set a civilian damage to 0, that worked fine.
So what's wrong here?
h