fisheadaustin 10 Posted February 6, 2016 just like the title says i need to link a created group to a high command subordinate module so i can gain control of them after creation. how i have this setup the player group clears a town, trigger goes off that creates a new group of soldiers using the BIC call function. but thats all i got, it needs to be that after they are created the group is then linked to the HCS subordinate module that way i gain control of that group. ive tried using the synchronizeObjectsAdd function, however to my dismay the group doesnt have a name... and if they do i cannot find it to place that in the correct order to allow this to happen. also i cannot give the unit a name do to the way they are created apparently. Here's what i have in the trigger activation :[position player, WEST, configfile >> "CfgGroups" >> "West" >> "OPTRE_UNSC" >> "Infantry_Marine" >> "OPTRE_Groups_UNSC_Squad_Marine"] call BIS_fnc_spawngroup; Alpha_2_2 synchronizeObjectsAdd [HCS];right now i figure as im looking at the high command menu that this group is alpha 2_2, (there are numerous reasons for thinking this) but it all boils down to that i cannot link the group leader to the actual HCS module because i cannot go in and edit his "name" to do so. and i have no idea how to issue him one. Share this post Link to post Share on other sites
f2k sel 164 Posted February 6, 2016 Possibly something like this but not tested. mygrp2 = [position player, WEST, configfile >> "CfgGroups" >> "West" >> "OPTRE_UNSC" >> "Infantry_Marine" >> "OPTRE_Groups_UNSC_Squad_Marine"] call BIS_fnc_spawngroup;player hcSetGroup [mygrp2]; Share this post Link to post Share on other sites
fisheadaustin 10 Posted February 6, 2016 I believe I tried setting the call function to a var name but it didn't work the editor only returned a scripting error. I don't know why though cause if you spawn multiple groups that way it should still work and it would set the var name to mygroup2_1, mygroup2_2 and up as It does that automatically for things created with the same name. If anyone can test this out for me id appreciate it. I have to go to work unfortunately Share this post Link to post Share on other sites
f2k sel 164 Posted February 6, 2016 using a global variable as above (mygrp) they all become one group using locval variable below they remain separate groups each added to HC _spawngrp=[position player, EAST, (configFile >> "CfgGroups" >> "east" >> "OPF_F" >> "Infantry" >> "OIA_Infsquad")] call BIS_fnc_spawnGroup; player HCsetgroup [_spawngrp]; every time it's run it adds a group to HC Share this post Link to post Share on other sites
Igitur 43 Posted February 6, 2016 mygrp2 = [getPos player, WEST, 5] call BIS_fnc_spawnGroup; HCS synchronizeObjectsAdd [leader mygrp2]; edit :wont work since the group is created after the module has initialized. Share this post Link to post Share on other sites
fisheadaustin 10 Posted February 7, 2016 using a global variable as above (mygrp) they all become one group using locval variable below they remain separate groups each added to HC _spawngrp=[position player, EAST, (configFile >> "CfgGroups" >> "east" >> "OPF_F" >> "Infantry" >> "OIA_Infsquad")] call BIS_fnc_spawnGroup; player HCsetgroup [_spawngrp]; every time it's run it adds a group to HC when i use the _spawngrp, it keeps saying a local variable is trying to be used in a global space. right at the player HCsetgroup [_spawngrp]; part. nothing else has changed so far. i also tried the next suggestion and it still doesnt add the new created group to the High command subordinate module. soo i dont know how it worked for you guys but it doesnt want to work for me. Share this post Link to post Share on other sites
fisheadaustin 10 Posted February 7, 2016 ok, so after testing around for a bit with the code you guys gave me, i finally have found the solution... this code which i placed in my activation field creates the specific group. gives it a name and connects it to the high command.which means, that the only thing different between this and the above mentioned code is that you cannot place a local variable in the var name (well you can but you wont be able to call on it later when it expects a global variable) i can see this becoming a problem though.... maybe. ill have to test it out with this script spawning multiple groups. but im pretty sure it will only spawn one at this point since this group will get the name mygrp2 and once another group tries to spawn with that same name it wont allow it to spawn. but i guess if anything i can just go up the list eh? mygrp2, 3, 4 for as many as needed.... mygrp2 = [position player, WEST, configfile >> "CfgGroups" >> "West" >> "OPTRE_UNSC" >> "Infantry_Marine" >> "OPTRE_Groups_UNSC_Squad_Marine"] call BIS_fnc_spawngroup; player hcSetGroup [mygrp2]; Share this post Link to post Share on other sites
f2k sel 164 Posted February 7, 2016 when you see local variables beginning with _ it usually means it's to be used in script or needs to be spawned if you wish to use it in on act. null=[] spawn { _mygrp2 = [position player, WEST, configfile >> "CfgGroups" >> "West" >> "OPTRE_UNSC" >> "Infantry_Marine" >> "OPTRE_Groups_UNSC_Squad_Marine"] call BIS_fnc_spawngroup; player hcSetGroup [_mygrp2]; }; I'd also take a look at the above suggestion as it looks correct also and is adding it to HCS, which I'm not sure hcSetGroup does. change this in above player hcSetGroup [_mygrp2]; to HCS synchronizeObjectsAdd [leader _mygrp2]; Still couldn't get synch to work anyway. Share this post Link to post Share on other sites
Larrow 2822 Posted February 7, 2016 Just using hcSetGroup will be enough. The HCS module is only used at mission start to tell the HC module what groups the the commander has control over, so syncing the group to the HCS will have no benefit. but im pretty sure it will only spawn one at this point since this group will get the name mygrp2 and once another group tries to spawn with that same name it wont allow it to spawn You are not actually naming the group, myGrp2 is a variable that holds a reference to a group, once the group has been passed to the HC via hcSetGroup the reference held in myGrp2 is not needed any more and spawning a new group using the same variable will have no effect on previous spawns. Share this post Link to post Share on other sites