PROBLEM: Adding parameters to a script, made create a new unit, works, but now I can't select the unit with names I gave to the script in the brackets.
DETAILED:
I execute a script with the following code:
[patrol1,"patrol1"] exec "test.sqs";
The script is the following:
_patrol1 = "Civilian8" createUnit [getpos out_gate,patrolMaster,format["%1 = this",_this select 1], 0.6, "corporal"]
_patrol1 = _this select 0;
_patrol1 setDammage 1;
_patrol1 doMove getpos player;
hint format ["%1:%2",_this select 0,_this select 1];
The script doesn't work. The unit is created, but can't be commanded by me. He doesn't get killed and doesn't get moved to the location of the player (which is named properly, "player").
It does work when I insert a line like this:
patrol1 setDammage 1;
But this way it's not using the variables given to the script when it's activated. So my question is, how can I get this to work. Because I can't use a string to do so, that's why I gave two parameters to the script. But it doesn't work when I use the first parameter, which isn't a string. The game doesn't know that it's an object.
Anyone got a solution?