Enigx 39 Posted July 29, 2020 I have a script that spawn enemy units on marker and order a patrolling movement on waypoints. Simplifying the script it is as in the following: CallPatrol.sqf ..... // loop "for" for enemy spawning. _numFT: numbers of fire teams for "_i" from 1 to _numFT do { sleep 0.2; ... definition of random markers "p1","p2".. where define patrolling waypoints .. null = [ListEnemyUnit select _faction,["p1","p2","p3","p4","p5"],EAST] execVM "Spawn_Enemy_patrol.sqf"; }; // ListEnemyUnit: array containing arrays of enemies of different factions (each with 4 units), selected by _faction. I can vary the _faction parameter in game .... Spawn_Enemy_patrol.sqf _unitArray = _this select 0; _MarkerMoveArray = _this select 1; _sideFactionUn = _this select 2; grpAI = createGroup [_sideFactionUn, true]; _unitlArrayCount = (count _unitArray) - 1; // Fire team definition for "_i" from 0 to _unitlArrayCount do { _ce = grpAI createUnit [_unitArray select _i, getMarkerPos (_MarkerMoveArray select 0), [], 0, "FORM"]; }; EnGrp = grpAI; ..... other lines to set waypoints movement It works, but I have a strange behaviour with independent factions. One of the ListEnemyUnit array elements is an array on independent units (NAPA units form RHS). If I select this faction the script spawns them correctly, but they fight each other. I noticed that only the TL is "east" while the other 3 units of the group are something else, hostile to the TL. The TL kills them, they don't shoot the TL waiting their death! They appear green on map, but once killed they appear violet on editor left screen list. This doesn't happen if I pass INDEPENDENT and not EAST to the _sideFactionUn variable. Why this behavior? Any suggestions/solution? Thanks Share this post Link to post Share on other sites
engima 328 Posted July 30, 2020 I have thought of this behavior like: if you e.g. spawn an opfor unit in a westly group, the units get confused. Like in real life, they will identify an enemy, but they do not know that it is actually friendly - or something like that. So the rule is, always spawn units in a group of their actual side. Regarding independent, they can be either friendly or enemy to east and west (independently). Their alliance can be set in the editor’s mission settings, or with script commands - setFriend I think. Is there a particular reason you want units of different factions in the same group? Share this post Link to post Share on other sites
pierremgi 4898 Posted July 31, 2020 classic when using createUnit. Read the whole BIKI page. I always add a join command just after this one to make sure the unit is on the right group/side. Share this post Link to post Share on other sites
Enigx 39 Posted July 31, 2020 Thanks all for answers. Yes it is also written in BIKI, sorry I didn't read it. So I have two ways: 1) set independent as enemies from editor and create group as independent, as enigma said. 12 hours ago, engima said: Is there a particular reason you want units of different factions in the same group? No no I want a group composed by all independent units but with east behavior. The reason is because I can dinamically spawn enemies in game by a personal menu, and sometimes I use independent units as enemies. 2) createunit and then join the unit to the group, as pierremgi said So in Spawn_Enemy_patrol.sqf the "for" loop will be // Fire team definition for "_i" from 0 to _unitlArrayCount do { _ce = grpAI createUnit [_unitArray select _i, getMarkerPos (_MarkerMoveArray select 0), [], 0, "FORM"]; [_ce] join grpAI; }; Is it right? Share this post Link to post Share on other sites
pierremgi 4898 Posted July 31, 2020 yep! I'd use joinSilent rather than join. Just test it. Share this post Link to post Share on other sites