Nielsen 10 Posted July 6, 2010 I'm spawning some units and I want to set their init. Normally I would do this with the "type createUnit unitInfo" command, and set the init there. But I need to spawn them in a 100m radius og the player. I only know how to do this with the "group createUnit []" command. And this command does (AFAIK) not allow to set the vehicle init. I then try to set the vehicle init afterwards with the setVehicleInit command: { _x setVehicleInit "this addEventHandler ["killed", {killedno = killedno + 1; PublicVariable "killedno";}];"; } forEach units _grp; I spawn the group with this code: _grp = createGroup east;sleep 0.05; _unit = _grp createUnit ["TK_INS_Soldier_HAT_EP1", getPos player1, [], 100, "FORM"];sleep 0.05; [_unit] join _grp; _unit2 = _grp createUnit ["TK_CIV_Takistani03_EP1", getPos player1, [], 100, "FORM"];sleep 0.05; [_unit2] join _grp; _unit3 = _grp createUnit ["TK_CIV_Takistani04_EP1", getPos player1, [], 100, "FORM"];sleep 0.05; [_unit3] join _grp; _unit4 = _grp createUnit ["TK_CIV_Takistani02_EP1", getPos player1, [], 100, "FORM"];sleep 0.05; [_unit4] join _grp; _unit5 = _grp createUnit ["TK_CIV_Takistani05_EP1", getPos player1, [], 100, "FORM"];sleep 0.05; [_unit5] join _grp; _unit6 = _grp createUnit ["TK_CIV_Takistani01_EP1", getPos player1, [], 100, "FORM"];sleep 0.05; [_unit6] join _grp; _unit7 = _grp createUnit ["TK_CIV_Takistani06_EP1", getPos player1, [], 100, "FORM"];sleep 0.05; [_unit7] join _grp; _unit8 = _grp createUnit ["TK_CIV_Worker02_EP1", getPos player1, [], 100, "FORM"];sleep 0.05; [_unit8] join _grp; _unit9 = _grp createUnit ["TK_CIV_Worker01_EP1", getPos player1, [], 100, "FORM"];sleep 0.05; [_unit9] join _grp; I get a scripterror in line 42, the line of the setVehicleInit. It says i'm missing an ;. But I can not see that I do. However I have tried all variations of ; in the sentence that I can think of, and it does not work. Can anybody tell me what I have missed? Thanks in advance. Share this post Link to post Share on other sites
Muzzleflash 108 Posted July 7, 2010 { _x setVehicleInit "this addEventHandler ["killed", {killedno = killedno + 1; PublicVariable "killedno";}];"; } forEach units _grp; "this: here you start the string with the quotes. }];" here you wanna end it. But Arma thinks you end the string here: ler ["kil and that you start a new string here led", {. If you want " in a string you need to write them twice: "". So you should write this: { _x setVehicleInit "this addEventHandler [""killed"", {killedno = killedno + 1; PublicVariable "killedno";}];"; } forEach units _grp; Share this post Link to post Share on other sites
Nielsen 10 Posted July 7, 2010 (edited) AHA! So that's it. I remember seeing the use of double "" before, but I never knew when to use it. It's funny how problemsolving little specifik issues, helps you understand scripting in general much better. Thanks man BTW: If what you say is allways true, then shouldnt the code really be: { _x setVehicleInit "this addEventHandler [""killed"", {killedno = killedno + 1; PublicVariable [color="Red"]"[/color]"killedno"[color="Red"]"[/color];}];"; } forEach units _grp; :) Edited July 7, 2010 by Nielsen Addition Share this post Link to post Share on other sites