0verlord-actual 11 Posted January 7, 2015 Hey, How would I create an addaction that would mean a AI Unit in a multiplayer game would the group of the player who selected the addaction? I assume using the join command but to make them join the player who selected the addaction? the addaction is on the unit and the unit is a HVT! Share this post Link to post Share on other sites
jshock 512 Posted January 7, 2015 _unit addAction [ "Recruit Unit", { (_this select 0) joinSilent group (_this select 1); (_this select 0) removeAction (_this select 2); }, [], 6, true, true, "", "_this distance _target < 5" ]; Share this post Link to post Share on other sites
0verlord-actual 11 Posted January 7, 2015 _unit addAction [ "Recruit Unit", { (_this select 0) joinSilent group (_this select 1); (_this select 0) removeAction (_this select 2); }, [], 6, true, true, "", "_this distance _target < 5" ]; Hey J.Shock the name of the unit is HVT2 do I put _HVT2 addaction? I cant seem to get it to work. it pops up with an script error. Share this post Link to post Share on other sites
jshock 512 Posted January 7, 2015 It would just be the following (no "_"): HVT2 addAction... Share this post Link to post Share on other sites
0verlord-actual 11 Posted January 7, 2015 Awesome thank you very much :) you are very helpful ---------- Post added at 06:54 ---------- Previous post was at 06:07 ---------- Hey man, I still cant get this working? do I just put it in the units init? Share this post Link to post Share on other sites
genesis92x 810 Posted January 7, 2015 Awesome thank you very much :) you are very helpful---------- Post added at 06:54 ---------- Previous post was at 06:07 ---------- Hey man, I still cant get this working? do I just put it in the units init? Create a file called "init.sqf" in the root of your mission folder. Then add the code provided above. Share this post Link to post Share on other sites
0verlord-actual 11 Posted January 7, 2015 Create a file called "init.sqf" in the root of your mission folder. Then add the code provided above. hey bro, sorry to be a pain but it still is not working... this is the error i get if it helps... https://www.dropbox.com/s/odk597st66hnvuh/2015-01-07_00003.jpg?dl=0 thanks again :) Share this post Link to post Share on other sites
Heeeere's johnny! 51 Posted January 7, 2015 hey bro, sorry to be a pain but it still is not working...this is the error i get if it helps... https://www.dropbox.com/s/odk597st66hnvuh/2015-01-07_00003.jpg?dl=0 thanks again :) That's because join and joinSilent expect the joining unit(s) to be an array, not an object. Try this: [color="#FF8040"][color="#1874CD"]_unit[/color] [color="#191970"][b]addAction[/b][/color] [color="#8B3E2F"][b][[/b][/color] [color="#7A7A7A"]"Recruit Unit"[/color][color="#8B3E2F"][b],[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#000000"]_this[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b]][/b][/color] [color="#191970"][b]joinSilent[/b][/color] [color="#191970"][b]group[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#000000"]_this[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//array may contain more than one unit[/i][/color] [color="#8B3E2F"][b]([/b][/color][color="#000000"]_this[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]removeAction[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#000000"]_this[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]2[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b],[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]6[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]true[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]true[/color][color="#8B3E2F"][b],[/b][/color] [color="#7A7A7A"]""[/color][color="#8B3E2F"][b],[/b][/color] [color="#7A7A7A"]"_this distance _target < 5"[/color] [color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [/color] Kudos to Killzone_Kid for his SQF to BBCode Converter. Share this post Link to post Share on other sites
0verlord-actual 11 Posted January 7, 2015 sorry i am legit a complete novice at all this, so is the array of units that can add him to their group? and is it between those to empty [] brackets in the script? or is it an array of the unit that the addaction applies to? Share this post Link to post Share on other sites
jshock 512 Posted January 7, 2015 It's just how the join command works, it expects an array of units to join the group. It was my mistake on usage. [allUnitsGoHere] join group player; Share this post Link to post Share on other sites