_type createunit [getpos _trig, _group, "soldier1 = this"]
i want to be able to send several different ai men through this line, but the init string won't let me put local variables in it
so how do i make a local variable work in a string, or is there something i can do something that will have the same effect?
(basically i want to replace soldier1 with _soldier)
cant use no private varies
soldiers = [s1, s2, s3]
soldiers = [what s1 stands for, what s2 stands for, etc]
what i write: soldiers = [s1, s2]
what i get: soldiers = [Alpha Black 1, Alpha Kilo 1]
what i want: _sold = s1
what i get: _sold = Alpha Black 1
[_sold] exec "script.sqsi'm getting:
[Alpha Black 1] exec "script.sqs"instead of:
[s1] exec "script.sqs"
soldiers = ["s1", "s2"]
(call soldiers select 0) exec "script.sqs"
(call soldiers select 1) exec "script.sqs"
what if i have more than one parameter?
soldiers = ["s1", "s2"]
(call soldiers select 0) exec "script.sqs"
(call soldiers select 1) exec "script.sqs"
[_sold, _man] exec "script.sqs"
soldiers = ["s1","s2","s3"]
men = ["c1',"c2","c3"]
[call soldiers select 0,call men select 0] exec "script.sqs"
soldiers = ["s1","s2","s3"]
men = ["c1',"c2","c3"]
_sold = call soldiers select 0
_man = call men select 0
[_sold,_man] exec "script.sqs"
_name = _this select 0
_unit = call _name
#respawnloop
@!alive _unit
@alive call _name
_unit = call _name
removeallweapons _unit
.....
.....
.....
.....
goto "respawnloop"
soldiers = ["s1","s2","s3"]
men = ["c1',"c2","c3"]
_sold = call soldiers select 0
_man = call men select 0
[_sold,_man] exec "script.sqs"
soldiers = ["s1", "s2"]
(call soldiers select 0) exec "script.sqs"
(call soldiers select 1) exec "script.sqs"
In the above example the call command retrives the string and executes it as if it were code. So...
(call soldiers select 0) exec "script.sqs"
Is executed as....
s1 exec "script.sqs"
If you want to call your strings and ahve them executed AS strings you simply do this...
(call {soldiers select 0}) exec "script.sqs"
and it will be executed as...
"s1" exec "script.sqs"
why do the {} change it from no quotes to quotes?
call mycodestring
player setdamage 1
(call (soldiernames select 0) = this);
It's possible the call command will not work in a units init feild. Why not just name the soldier?