Forum Jump :

Author Message


Posts: 3
Rank:


Level: Member

Country: se
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2016-03-11 00:49        
     
Hey! as the topic states, kinda recently got familiar with the spawn AI function. I love it alot and makes everything easier.

Just got a question about making it spawn modded units, for example some RHS units. I've tried almost everything possible by just trying random shit, and google it didnt give me an direct answer.

So if any experianced guru can explain how to do this i'd kiss his feet. *WALL*

Have a nice day!


Author Message


Posts: 1589
Rank:


Level: Member

Country: pf
Location: Tahiti
Occupation: too many Arma
Age: 57
In-game name: Kobayashi Maru

 
#2 Posted at 2016-03-11 01:13        
     
First you need to have the addon, and all players for your mission also.
Say RHS: @RHS_usf3 (US force) and @RHS_afrf3 (Russian federation)
Then you have all you need in your config files. Just call the right class names of the units (or group).
For example: "rhs_vdv_rifleman" or "rhs_vdv_RShG2", "rhs_vdv_grenadier", "rhs_vdv_strelok_rpg_assist", "rhs_vdv_machinegunner", "rhs_vdv_LAT", "rhs_vdv_medic" "rhs_vdv_sergeant", "rhs_vdv_junior_sergeant"...

Choose your units or let randomize them and use BIS_fnc_spawnGroup, in init.sqf or a trigger, or what ever script:

_position = <what position you want here>; //[x,y,z] coords or getpos player, or getmarkerpos "a_marker_name"...
_redteam = [_position, east, ["rhs_vdv_rifleman","rhs_vdv_RShG2","rhs_vdv_grenadier","rhs_vdv_strelok_rpg_assist","rhs_vdv_machinegunner","rhs_vdv_LAT","rhs_vdv_medic","rhs_vdv_sergeant"], [], [], [], [], [], 0] call BIS_fnc_spawnGroup;

array of units is made with soldier classes found in the config viewer (console) cfgVehicles, you can also replace this array by a pre-defined group from cfgGroups (copy all the path: configfile >> "cfgGroups">>"east">>... and pay attention for syntax.

PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS

Advertisement


Author Message


Posts: 3
Rank:


Level: Member

Country: se
Location:
Occupation:
Age:
In-game name:

 
#3 Posted at 2016-03-11 01:56        
     
# Pierre MGI : First you need to have the addon, and all players for your mission also.
Say RHS: @RHS_usf3 (US force) and @RHS_afrf3 (Russian federation)
Then you have all you need in your config files. Just call the right class names of the units (or group).
For example: "rhs_vdv_rifleman" or "rhs_vdv_RShG2", "rhs_vdv_grenadier", "rhs_vdv_strelok_rpg_assist", "rhs_vdv_machinegunner", "rhs_vdv_LAT", "rhs_vdv_medic" "rhs_vdv_sergeant", "rhs_vdv_junior_sergeant"...

Choose your units or let randomize them and use BIS_fnc_spawnGroup, in init.sqf or a trigger, or what ever script:

_position = <what position you want here>; //[x,y,z] coords or getpos player, or getmarkerpos "a_marker_name"...
_redteam = [_position, east, ["rhs_vdv_rifleman","rhs_vdv_RShG2","rhs_vdv_grenadier","rhs_vdv_strelok_rpg_assist","rhs_vdv_machinegunner","rhs_vdv_LAT","rhs_vdv_medic","rhs_vdv_sergeant"], [], [], [], [], [], 0] call BIS_fnc_spawnGroup;

array of units is made with soldier classes found in the config viewer (console) cfgVehicles, you can also replace this array by a pre-defined group from cfgGroups (copy all the path: configfile >> "cfgGroups">>"east">>... and pay attention for syntax.

Thanks, Pierre! Will try this


Author Message


Posts: 13
Rank:


Level: Member

Country: id
Location:
Occupation:
Age:
In-game name:

 
#4 Posted at 2017-01-19 22:33        
     
How to make ModuleSpawnAI_F (Spawn AI) with custom factions? I want it change to Red Hammer Studio faction? (RHS)

I put this _fireteam = [getMarkerPos "MARK1", EAST, ["rhs_msv_emr_sergeant", "rhs_msv_emr_machinegunner", " rhs_msv_emr_grenadier_rpg", "rhs_msv_emr_strelok_rpg_assist"]] call BIS_fnc_spawnGroup; in the init sqf. The Question is,, how to make them respawn again?

This post was edited by BLACKSQUAD (2017-01-19 23:00, 272 days ago)


Author Message


Posts: 1589
Rank:


Level: Member

Country: pf
Location: Tahiti
Occupation: too many Arma
Age: 57
In-game name: Kobayashi Maru

 
#5 Posted at 2017-01-20 04:07        
     
If you spawn a group, you need to script for respawning it. The module is not a solution.

0 = [] spawn {_fireteam = [getMarkerPos "MARK1", EAST, ["rhs_msv_emr_sergeant", "rhs_msv_emr_machinegunner", " rhs_msv_emr_grenadier_rpg", "rhs_msv_emr_strelok_rpg_assist"]] call BIS_fnc_spawnGroup; 
sleep 1; 

// if you place a waypoint here, this one will be available also for respawning unit, until its completion by leader. Then respawned units will stay at start marker position.
 
_fireteam spawn { 
  _fireteam = _this; 
  private "_unit"; 
  while {count units _fireteam > 0} do { 
        for "_i" from 0 to count (units _fireteam) - 1 do { 
          _unit = units _fireteam select _i; 
          if !(_unit getVariable ["_ready",false]) then { 
            _unit setVariable ["_type",typeOf _unit]; 
            _unit setVariable ["_dir",getdir _unit]; // not used here
            _unit setVariable ["_side",side _unit]; 
            _unit setVariable ["_group",_fireteam]; 
            _unit addEventHandler ["killed", { 
              _fellow = _this select 0; 
              _newbie =  (_fellow getVariable "_type") createUnit [getMarkerPos "MARK1", _fellow getVariable "_group"]; 
              _newbie setVariable ["_ready", false]; 
              _fellow setVariable ["_ready", nil]; 
              deleteVehicle _fellow; 
           }]; 
           _unit setVariable ["_ready", true]; 
         }; 
       }; 
       sleep 1; 
    }; 
  };
};

PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS

Author Message


Posts: 13
Rank:


Level: Member

Country: id
Location:
Occupation:
Age:
In-game name:

 
#6 Posted at 2017-01-20 12:44        
     
Thanks for the script! And how about the module bro? How to make a ModuleSpawnAI_F (Spawn AI) with custom factions?


This post was edited by BLACKSQUAD (2017-01-20 12:57, 272 days ago)


Author Message


Posts: 1589
Rank:


Level: Member

Country: pf
Location: Tahiti
Occupation: too many Arma
Age: 57
In-game name: Kobayashi Maru

 
#7 Posted at 2017-01-20 14:22        
     
You can't. As you can see, it's hard coded in module.

On the other hand, you can call your unit(s) or group(s) belonging to your faction:

Finding units belonging to a faction:
As you can see in config viewer, units are classed like this one:
configfile >> "CfgVehicles" >> "B_Soldier_A_F"
if you click on faction: >> "faction" class is added to the path and the corresponding line is:
faction = "BLU_F";
So, you need to pick vehicles which are men (if you want to limit to infantry, not mandatory) and who belongs to faction "BLU_F" or your faction name.

This array of possible unit classes is obtained by:
("getText (_x >> 'faction') == 'BLU_F' && configname _x isKindOf 'CAManBase' && getNumber (_x >> 'scope') == 2" configClasses (configfile >> "CfgVehicles")) apply {configName _x}
Change BLU_F by you faction name.
NB: CAManBase is the type for man, the scope = 2 is for usable classes only (not the generic ones).

Now, you have an array where you must pick any units you like, building a "group", more exactly an array of units for bis_fnc_spawnGroup:
_myFactionUnits = ("getText (_x >> 'faction') == 'BLU_F' && configname _x isKindOf 'CAManBase' && getNumber (_x >> 'scope') == 2" configClasses (configfile >> "CfgVehicles")) apply {configName _x};
_myCustomGroup = [];
for "_i" from 0 to floor random 8 do {
  _myCustomGroup pushBack selectRandom _myFactionUnits;
};
_fireteam = [getMarkerPos "MARK1", EAST, _myCustomGroup] call BIS_fnc_spawnGroup;
This is not so good, because you mix diverse units like diver with sniper and pilot...

But bis_fnc_spawnGroup has an alternate syntax with already existing groups (in configclasses, like when clicking in the "group" tab of the editor):

General script for an UNSUNG West infantry (just one family example):
_fireteam = [getMarkerPos "MARK1", EAST, selectRandom (("getText (_x >> 'faction') == 'UNSUNG_W'" configClasses (configfile >> "CfgGroups" >> "West" >> "UNSUNG_W_US" >> "ussfInfantry")) )] call BIS_fnc_spawnGroup;

here "ussfInfantry" is a class for several groups (I call that "family"), so you can pick one of them at random (with selectRandom here). In UNSUNG (big mod), there are several "family" classes like this one. If you need a huge choice, just add the arrays like ("getText.... >> "another group family"), yes it's an array, then selectRandom the big resulting array.

But I guess, if you have made your own faction, there are not so much factions like in Unsung mod!
Just check the path of your group(s) in the configViewer (from console), at cfgGroups.
Double click to descend the sub-classes until you can read faction = yourFaction. Now you are at one of group classes like you want.
Copy/paste the config path line (at bottom of console).
For always calling the same group, it's done. You don't need to selectRandom of course.
If several groups like this one, erase: >> "name of the group" (as you want the "family" class above, and replace here in what I wrote inside configClasses ().
You should read something looking as above. Don't forget to change the name of the faction as well.

This post was edited by Pierre MGI (2017-01-20 15:02, 272 days ago)

PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS

Author Message


Posts: 5
Rank:


Level: Member

Country: ee
Location:
Occupation:
Age:
In-game name:

 
#8 Posted at 2017-09-06 03:29        
     
People, I am begging you, PLEASE someone explain me step by step how to make AI spawn (RHS ONLY!)

1 - AI spawn location (marker)
2- AI spawn module with its special area (what script goes in module?)
3- script itself. what should be in SFQ or SQS file?