Koni 3 Posted September 7, 2011 Trying to get my head round the BIS_fnc_spawnGroup: Been looking through the search results for ages and I can't get this right. I found one method which quite suits me, by spawning a random set of units and off they go and patrol an area, but I can't exactly choose the kind of units it spawns. I like this as it cuts down a massive amount of lines of code compared the the old very basic way I normally spawn units and send them off patroling. patrolunits = 2 + Random 5;patrolgrp = [getPos aPos, resistance, 5] call BIS_fnc_spawnGroup; [patrolgrp, (getPos patrolarea),50] call BIS_fnc_taskPatrol;; This works fine for Arma2 Resistance, but what do I use to have it spawn say Takistani Locals, or OA US Army etc. I've been playing around adding things like BIS_TK, BIS_US BIS_TK_GUE, and so on, and I can't get anything to work like that. Thanks Share this post Link to post Share on other sites
noricum 10 Posted September 7, 2011 patrolunits = 2 + (Random 5); patrolgrp = [getPos aPos, WEST, 5] call BIS_fnc_spawnGroup; [patrolgrp, (getPos patrolarea),50] call BIS_fnc_taskPatrol; Dunno what exactly will be spawned (US/USMC), but they are west! Btw you had an ; too much in the last line. Share this post Link to post Share on other sites
Koni 3 Posted September 7, 2011 patrolunits = 2 + (Random 5); patrolgrp = [getPos aPos, WEST, 5] call BIS_fnc_spawnGroup; [patrolgrp, (getPos patrolarea),50] call BIS_fnc_taskPatrol; Dunno what exactly will be spawned (US/USMC), but they are west! Btw you had an ; too much in the last line. Yeah, I just edited my post a few times before actually posting it, and ended up with 2 ;; on here. Yeah I know about using EAST, WEST, Resistance etc, it's the defining which units from that faction that gets spawned that's my problem mate. Share this post Link to post Share on other sites
1para{god-father} 105 Posted September 7, 2011 it is all here .. http://community.bistudio.com/wiki/BIS_fnc_spawnGroup Spawn a TK Militia Medic and Soldier at aPos facing south: [getPos aPos, EAST, ["TK_INS_Bonesetter_EP1", "TK_INS_Soldier_2_EP1"],[],[],[],[],[],180] call BIS_fnc_spawnGroup Share this post Link to post Share on other sites
Koni 3 Posted September 7, 2011 Yes, I have been reading the wiki till my head hurt and I have had that working no problem, but using that you have to enter every single soldier into the code line, where as the way I am trying to get working does not, it just picks random units. Maybe it isn't possible to do what I'm trying to do, the way I am trying to do it. Looks like I need to start learning how to make arrays, and call random arrays, and what not... my heads already hurting at the prospect, lol ---------- Post added at 02:50 PM ---------- Previous post was at 02:18 PM ---------- Been trying this in a trigger, or as a script and nothing will work. [getMarkerPos "Spawn1", side player, (configFile >> "CfgGroups" >> "Resistance" >> "BIS_TK_GUE" >> "Infantry" >> "TK_GUE_AATeam")] call BIS_fnc_spawnGroup I have a marker down called Spawn1, I have a few guys set to 0% probability of presence of all sides , I am an Independant TK Militia Unit as well, also I have a Functions Mod placed on the map... what am I doing wrong please ? This from the wiki works just fine [getMarkerPos "tankSpawn", side player, (configFile >> "CfgGroups" >> "West" >> "BIS_US" >> "Armored" >> "US_MGSPlatoon")] call BIS_fnc_spawnGroup But when I try and change it to Resistance units, nothing happens. Share this post Link to post Share on other sites
loyalguard 15 Posted September 7, 2011 Try "Guerilla" instead of resistance. If not that maybe "Independent" [getMarkerPos "Spawn1", side player, (configFile >> "CfgGroups" >> "Guerrila" >> "BIS_TK_GUE" >> "Infantry" >> "TK_GUE_AATeam")] call BIS_fnc_spawnGroup Share this post Link to post Share on other sites
Koni 3 Posted September 7, 2011 (edited) I've tried so many I'm forgetting what I've done already. Tried, GUER, resistance, Guerilla, Independent, nothing works. I must be doing something very basic wrong here... Got it working... The way you spelt Guerrila is what was wrong with mine, I was spelling it Guerilla, which dosen't work, but your way of spelling it does work ---------- Post added at 03:45 PM ---------- Previous post was at 03:29 PM ---------- Right... that now works for just pre set teams of units, it still dosen't fix my original problem of spawning units using this below but with Takistani units patrolunits = 2 + Random 5;patrolgrp = [getPos aPos, resistance, 5] call BIS_fnc_spawnGroup; [patrolgrp, (getPos patrolarea),50] call BIS_fnc_taskPatrol; as with this way, the group can be refered to, to add the taskpatrol function.. I have tried this, but it dosen't work, funnily enough.. [getMarkerPos "Spawn1", side player, (configFile >> "CfgGroups" >> "Guerrila" >> "BIS_TK_GUE" >> "Infantry" >> "TK_GUE_ATTeam")] call BIS_fnc_spawnGroup; [grp, (getPos patrolarea),50] call BIS_fnc_taskPatrol; That obviously spawns the TK_GUE_ATT team, but I don't know how to add the call BIS_fnc_taskPatrol for that created group spawning the unit this way. So that's two problems now, lol Edited September 7, 2011 by Koni Share this post Link to post Share on other sites
loyalguard 15 Posted September 7, 2011 For the AT group, I might be reading your code wrong or you may not be showing it here, but are you storing the group you are creating with BIS_fnc_spawnGroup to a variable that you can then refer to in BIS_fnc_taskPatrol like you do with the patrolunits example? It should look like this (see the green -- name the group whaterver you want): ATGroup = [getMarkerPos "Spawn1", side player, (configFile >> "CfgGroups" >> "Guerrila" >> "BIS_TK_GUE" >> "Infantry" >> "TK_GUE_ATTeam")] call BIS_fnc_spawnGroup; [ATGroup, (getPos patrolarea),50] call BIS_fnc_taskPatrol; Share this post Link to post Share on other sites
Koni 3 Posted September 7, 2011 For the AT group, I might be reading your code wrong or you may not be showing it here, but are you storing the group you are creating with BIS_fnc_spawnGroup to a variable that you can then refer to in BIS_fnc_taskPatrol like you do with the patrolunits example? It should look like this (see the green -- name the group whaterver you want):ATGroup = [getMarkerPos "Spawn1", side player, (configFile >> "CfgGroups" >> "Guerrila" >> "BIS_TK_GUE" >> "Infantry" >> "TK_GUE_ATTeam")] call BIS_fnc_spawnGroup; [ATGroup, (getPos patrolarea),50] call BIS_fnc_taskPatrol; Perfect, mate, that's brilliant, didn't think of adding that to the code Works just fine now thanks Share this post Link to post Share on other sites
loyalguard 15 Posted September 7, 2011 (edited) So I have figured out why you cannot choose the specific units based on side (without providing an array that is). If all you do is provide a number of units, to decide which units to use BIS_fnc_spawnGroup calls a differnet function called BIS_fnc_returnGroupComposition that decides which units to use. It only works from specific classes of units that is also dependent on if you have A2 only, OA, or A2 and OA. Long story short...unless you tell it which units you might want you probably will not get what you want. So your best bet is to provide it an array of your own units or a CfgGroups class. For CfgGroups, to get the units you mention above (OA Civs, OA US Army), try the following configFile codes: OA Civs: TK_CIV_Crowd1 TK_CIV_Crowd2 Example: (configFile >> "CfgGroups" >> "Civilian" >> "BIS_TK_CIV" >> "Infantry" >> "TK_CIV_Crowd1") US Army: US_RifleSquad Example: (configFile >> "CfgGroups" >> "West" >> "BIS_US" >> "Infantry" >> "US_RifleSquad") You can find all the CfgGroup names here: http://community.bistudio.com/wiki/CfgGroups You can also use the randomization parameters to switch things up a little. Edited September 7, 2011 by Loyalguard Typos Share this post Link to post Share on other sites
Koni 3 Posted September 7, 2011 (edited) Yeah, thanks Loyalguard, these are the kind of things I need to get my head round to script things a little more advanced, and cut down the amount of lines I type to spawn the simplest of things. It took me long enough to be able to do random spawn points lol Edited September 7, 2011 by Koni Share this post Link to post Share on other sites
mikie boy 18 Posted September 7, 2011 not sure if this helps any, script i made to add 20 randon civs using the call BIS_fnc_selectRandom command, and then adding an addaction (local) to them. for "_i" from 0 to 20 do { _terrormantype = ["TK_CIV_Takistani01_EP1", "TK_CIV_Takistani02_EP1", "TK_CIV_Takistani03_EP1", "TK_CIV_Takistani04_EP1", "TK_CIV_Takistani05_EP1", "TK_CIV_Takistani06_EP1"] call BIS_fnc_selectRandom; _distances = [10,20,30,40,50,60,70,80,90,100] call BIS_fnc_selectRandom; _ang = random 360; _dis = _distances; _dx = sin(_ang)*_dis; _dy = cos(_ang)*_dis; _terrorsuspects = [[((getmarkerpos "terrorHelpers") select 0) + _dx, ((getmarkerpos "terrorHelpers") select 1) + _dy, 0], Civilian, [_terrormantype],[],[],[],[],[1,0.5],180] call BIS_fnc_spawnGroup; _terrorprobability = [false, true] call BIS_fnc_selectRandom; { _interroraction = _x addAction ["Interrogate","interror.sqf", [_terrorprobability],1,false,true,"","(_target distance _this) < 3"]; } foreach units _terrorsuspects; }; Share this post Link to post Share on other sites