Asmodeuz 54 Posted March 21, 2017 Hey, I went through the search results worth of four pages that had somekind of mention about BIS_fnc_spawnGroup but couldn't find anything that would directly fit the problem I'm having. I'm trying to use [getMarkerPos "test3", side player, 10] remoteExecCall ["BIS_fnc_spawnGroup",(_this select 1),false] which spawns an AI squad (of the same side as the human player is) when a human player captures the sector. I've placed that code snippet in the Expression field of a BIS sector and while the code works nicely when testing through a editor hosted multiplayer it doesn't spawn anything when testing the mission in a dedicated server environment. What I might be missing here? Is there any way I could keep using the Expression field to execute what I want in dedicated server or should I use something else (what might that be then)? Greetings Asmodeuz Share this post Link to post Share on other sites
Asmodeuz 54 Posted March 22, 2017 Hello there, so far I've tried a few different variations of that code snippet there in the OP but not surprisingly not one did provide any positive results. if((_this select 1) != sideUnknown) then {if((side _x) isEqualTo (_this select 1)) then {[getMarkerPos "test3",10] remoteExecCall ["BIS_fnc_spawnGroup",_x,false];};}; gives 22:07:44 Error in expression <elect 1) != sideUnknown) then {if((side _x) isEqualTo (_this select 1)) then {[g> 22:07:44 Error position: <_x) isEqualTo (_this select 1)) then {[g> 22:07:44 Error Undefined variable in expression: _x Then a more simpler approach [getMarkerPos "test3", side (_thisList select 0), 10] call BIS_fnc_spawnGroup; gives error 21:29:41 Error in expression <rigger1);};[getMarkerPos "test3", side (_thisList select 0), 10] call BIS_fnc_sp> 21:29:41 Error position: <_thisList select 0), 10] call BIS_fnc_sp> 21:29:41 Error Undefined variable in expression: _thislist Then there have been slightly different variations that don't give any error but don't spawn any AI groups either. I would somehow need to determine the side of the player (or players) in a capture area and just when the area gets succesfully captured an AI group spawns to a marker to stay in guard so the human players can continue to the next objective. Any advice on how to achieve what I'm trying to aim here for? btw. changed the topic to better reflect what I'm trying to achieve with this one Share this post Link to post Share on other sites
Nikander 123 Posted March 22, 2017 (edited) Assuming you have successfully configured your sector trigger, side logics and location logic, write this in the expression field of your Sector module [getMarkerPos "test3", _this select 1, 10] remoteExec ["BIS_fnc_spawnGroup", 2] Remember to allow remoteExec for BIS_fnc_spawnGroup in your description.ext Edited March 22, 2017 by Nikander 1 Share this post Link to post Share on other sites
Asmodeuz 54 Posted March 23, 2017 20 hours ago, Nikander said: Assuming you have successfully configured your sector trigger, side logics and location logic, write this in the expression field of your Sector module [getMarkerPos "test3", _this select 1, 10] remoteExec ["BIS_fnc_spawnGroup", 2] Remember to allow remoteExec for BIS_fnc_spawnGroup in your description.ext Terve Nikander, thank you for the suggestion that worked right out of the box! One troubling thing though is that since I'd be using Iron Front lite assets this small script snippet should be spawning WW2 units instead of vanilla A3 squads which it did now when I tested what would happen when the player took the role of a WW2 infantry character. Would there be some way to influence what faction of a certain side should spawn in? I had hoped the game would parse that on its own but unfortunately it didn't. Share this post Link to post Share on other sites
Nikander 123 Posted March 23, 2017 (edited) 56 minutes ago, Asmodeuz said: I'd be using Iron Front lite assets this small script snippet should be spawning WW2 units instead of vanilla A3 squads Terve! Try this expression field in your Sector module [getMarkerPos "test3", _this select 1, if (_this select 1 isEqualTo west) then {["LIB_GER_rifleman"]} else {["LIB_US_FC_rifleman"]}] remoteExec ["BIS_fnc_spawnGroup", 2] or try Iron Front group compositions like this [getMarkerPos "test3", _this select 1, if (_this select 1 isEqualTo west) then {(configfile >> "CfgGroups" >> "West" >> "LIB_WEHRMACHT" >> "Infantry" >> "LIB_GER_scout_squad")} else {(configfile >> "CfgGroups" >> "Indep" >> "LIB_US_ARMY" >> "Infantry" >> "LIB_US_scout_squad")}] remoteExec ["BIS_fnc_spawnGroup", 2] Edited March 23, 2017 by Nikander Share this post Link to post Share on other sites
Asmodeuz 54 Posted March 23, 2017 15 minutes ago, Nikander said: Terve! Try this expression field in your Sector module [getMarkerPos "test3", _this select 1, if (_this select 1 isEqualTo west) then {["LIB_GER_rifleman"]} else {["LIB_US_FC_rifleman"]}] remoteExec ["BIS_fnc_spawnGroup", 2] Terve terve :) This spawned a single GE rifleman when the sector was captured with a west character and a single US rifleman when side was something else than west. I assume this was the intention? Would you already happen to see with that change that snippet could spawn these soldiers in groups? 1 Share this post Link to post Share on other sites
Larrow 2819 Posted March 24, 2017 There is no need to remoteExec to the server as the sector expression only runs server side. Just call the function directly. Thats the reason your first example failed is because you used player, and player has no meaning on a dedicated server. params[ "_sector", "_owner" ]; if !( _owner isEqualTo sideUnknown ) then { _unitType = [ "LIB_GER_rifleman", "LIB_US_FC_rifleman" ] select ( _owner call BIS_fnc_sideID ); _groupSize = 5; _units = []; _units resize _groupSize; _units = _units apply { _unitType }; [ getPosATL _sector, _owner, _units ] call BIS_fnc_spawnGroup; }; Always remember to check for sideUnknown when dealing with sectors, as they fire off at mission start with their default owner, which if is no one it will be sideUnknown. 1 Share this post Link to post Share on other sites
Asmodeuz 54 Posted March 24, 2017 1 hour ago, Larrow said: There is no need to remoteExec to the server as the sector expression only runs server side. Just call the function directly. Thats the reason your first example failed is because you used player, and player has no meaning on a dedicated server. params[ "_sector", "_owner" ]; if !( _owner isEqualTo sideUnknown ) then { _unitType = [ "LIB_GER_rifleman", "LIB_US_FC_rifleman" ] select ( _owner call BIS_fnc_sideID ); _groupSize = 5; _units = []; _units resize _groupSize; _units = _units apply { _unitType }; [ getPosATL _sector, _owner, _units ] call BIS_fnc_spawnGroup; }; Always remember to check for sideUnknown when dealing with sectors, as they fire off at mission start with their default owner, which if is no one it will be sideUnknown. Thank you Larrow for the script. Using that now spawns groups of AI (using units from modifications such as Iron Front) with the size set in _groupSize There are still anomalies or then the code is working as intented (though that is a thing I really couldn't tell which it actually is). Using [ "LIB_GER_rifleman", "LIB_US_FC_rifleman" ] will always spawn a group of five soldiers as follows: using a GE rifleman to capture the sector spawns a squad consisting of 5 * "LIB_US_FC_rifleman" (United States rifleman) using a Soviet Union rifleman to capture the sector spawns a squad consisting of 5 * "LIB_GER_rifleman" (German rifleman) It also seems that the AI squad that gets spawned is friendly to the player/side that captured the sector. For example if I as a human player capture a sector while playing as Soviet Union (OPFOR) and then a German (BLUFOR) AI squad gets spawned inside that sector it happens so that the GE squad couldn't care less even if I running around and mocking them. BUT, if I change side from Soviet Union to German then all of a sudden the GE AI squad is firing at me. Another thing is that BIS_fnc_spawnGroup in it's vanilla state spawns a nice mix of different infantry soldiers (AA, AT, MG etc.) but that functionality seems to be lost when having to "force" spawning of units from different modifcations. Or is it actually lost? Share this post Link to post Share on other sites
Larrow 2819 Posted March 24, 2017 3 hours ago, Asmodeuz said: Using [ "LIB_GER_rifleman", "LIB_US_FC_rifleman" ] will always spawn a group of five soldiers as follows: using a GE rifleman to capture the sector spawns a squad consisting of 5 * "LIB_US_FC_rifleman" (United States rifleman) using a Soviet Union rifleman to capture the sector spawns a squad consisting of 5 * "LIB_GER_rifleman" (German rifleman) Then your GE must be side WEST and your SU must be side EAST. _owner call BIS_fnc_sideID will return an enumeration for the side of owner 0 = EAST 1 = WEST 2 = INDEPENDENT 3 = CIVILIAN Which the number is then used to select from the unit types. 3 hours ago, Asmodeuz said: GE squad couldn't care less even if I running around and mocking them They dont care much for mocking. :) Check what I said above and make sure you have the right units in the index of the array along with what I said sides enumerate to. 3 hours ago, Asmodeuz said: Another thing is that BIS_fnc_spawnGroup in it's vanilla state spawns a nice mix of different infantry soldiers (AA, AT, MG etc.) but that functionality seems to be lost when having to "force" spawning of units from different modifcations. Or is it actually lost? You will have to check the config CfgGroups to see if the mod has any setup for infront sides. If it has then just replace the unit type in the array for each side with the path to the particular group config you want spawned. Share this post Link to post Share on other sites
Asmodeuz 54 Posted March 25, 2017 11 hours ago, Larrow said: Then your GE must be side WEST and your SU must be side EAST. _owner call BIS_fnc_sideID will return an enumeration for the side of owner 0 = EAST 1 = WEST 2 = INDEPENDENT 3 = CIVILIAN Which the number is then used to select from the unit types. What might be the reason that the sides need to be declared separately. As far as I understand from the picture (see the link below) everything should be lined up pretty nicely regarding that good old WEST vs EAST confrontation. (I mean the whole thing begins with CfgGroups sorted to EAST, WEST, Indep and then one can find SU placed under EAST, GE placed under WEST and so on) http://i1370.photobucket.com/albums/ag278/testusah123/cfgGroups_IFAlite_zps6wjvveyv.jpg~original Naturally if I need to separately declare that GE is WEST and SU is EAST etc. I can certainly do that. But the thing is, how do I do that, where do I add the number for the corresponding sides? 11 hours ago, Larrow said: You will have to check the config CfgGroups to see if the mod has any setup for infront sides. If it has then just replace the unit type in the array for each side with the path to the particular group config you want spawned. I changed the array as follows: params[ "_sector", "_owner" ]; if !( _owner isEqualTo sideUnknown ) then { _unitType = [ "LIB_GER_rifleman", (configfile >> "CfgGroups" >> "West" >> "LIB_WEHRMACHT" >> "Infantry" >> "LIB_GER_infantry_squad") ] select ( _owner call BIS_fnc_sideID ); _groupSize = 5; _units = []; _units resize _groupSize; _units = _units apply { _unitType }; [ getPosATL _sector, _owner, _units ] call BIS_fnc_spawnGroup; }; and got this when capturing the sector: 9:29:08 Error in expression <= getNumber(configFile >> "CfgVehicles" >> _type >> "isMan") == 1; if !(_isMan)> 9:29:08 Error position: <>> _type >> "isMan") == 1; if !(_isMan)> 9:29:08 Error >>: Type Config entry, expected String 9:29:08 File A3\functions_f\spawning\fn_spawnGroup.sqf [BIS_fnc_spawnGroup], line 128 What is that CfgVehicles doing there. As far as I understand there isn't any vehicles in "LIB_GER_infantry_squad" Also apparently I did something very wrong and am now at a loss what I should do next? Share this post Link to post Share on other sites
Larrow 2819 Posted March 25, 2017 7 hours ago, Asmodeuz said: What might be the reason that the sides need to be declared separately. You dont, unless you are specifically forcing units from one side to be used on another. I think the whole thing has just caused confusion as I used the men ( "LIB_GER_rifleman", "LIB_US_FC_rifleman" ) as shown from previous posts without knowing what side they should belong to. Lets go through the script again.. You receive _owner from the sector, this _owner will be East, West etc who ever captured it, and you want to spawn AI of the same side. _owner call BIS_fnc_sideID will return a number for this side being 0 for East, 1 for West etc We then have an Array of the type on units to spawn, in this case we are going to use CfgGroups as you have shown in your last post that there are infact entries for the sides. so.. [ (configfile >> "CfgGroups" >> "East" >> "LIB_?" >> "Infantry" >> "LIB_RUS_infantry_squad"), //EAST, index 0, 0 as returned by EAST call BIS_fnc_sideID (configfile >> "CfgGroups" >> "West" >> "LIB_WEHRMACHT" >> "Infantry" >> "LIB_GER_infantry_squad") //WEST, index 1, 1 as returned by WEST call BIS_fnc_sideID ] (check the config path for the Russians ). We then use the number returned from _owner call BIS_fnc_sideID to select the correct units to spawn matching the side number to the corresponding item in the array as shown above. BIS_fnc_spawnGroup then uses the config groups path to spawn the units on the side given by _owner. If the units to spawn and the _owner are mismatched you will get soldiers spawn being of a side they do not usually belong to, as you where seeing with the GE being spawn as East and not attacking you when being a SU. params[ "_sector", "_owner" ]; if !( _owner isEqualTo sideUnknown ) then { _groupConfigPath = [ (configfile >> "CfgGroups" >> "East" >> "LIB_?" >> "Infantry" >> "LIB_RUS_infantry_squad"), //EAST, index 0, 0 as returned by EAST call BIS_fnc_sideID (configfile >> "CfgGroups" >> "West" >> "LIB_WEHRMACHT" >> "Infantry" >> "LIB_GER_infantry_squad") //WEST, index 1, 1 as returned by WEST call BIS_fnc_sideID ] select ( _owner call BIS_fnc_sideID ); [ getPosATL _sector, _owner, _groupConfigPath ] call BIS_fnc_spawnGroup; }; As you are now using a config path to the groups definition which tells it what units to spawn and how many you no longer need the rest of the code ( which is why you were receiving the errors from BIS_fnc_spawnGroup ). 1 Share this post Link to post Share on other sites
Asmodeuz 54 Posted March 25, 2017 Brilliant stuff Larrow. Can't really get wrong with you. Also thank you so much for the time you spent with this one. As per your example there I populated the missing Soviet Union group and the path to it as follows: params[ "_sector", "_owner" ]; if !( _owner isEqualTo sideUnknown ) then { _groupConfigPath = [ (configfile >> "CfgGroups" >> "East" >> "LIB_RKKA" >> "Infantry" >> "LIB_SOV_infantry_squad"), (configfile >> "CfgGroups" >> "West" >> "LIB_WEHRMACHT" >> "Infantry" >> "LIB_GER_infantry_squad")] ] select ( _owner call BIS_fnc_sideID ); [ getPosATL _sector, _owner, _groupConfigPath ] call BIS_fnc_spawnGroup; }; That there now spawns a 10 man squad of German or Soviet Union origin right in the center of the sector that was captured by the players. And what gets spawned is dependant on what side did the capturing. Hostility states are correct so no more BLUFOR AI squad firing on BLUFOR human players. All in all this got solved! Share this post Link to post Share on other sites