Home   Help Search Login Register  

Author Topic: group class names  (Read 2514 times)

0 Members and 1 Guest are viewing this topic.

Offline loki72

  • Former Staff
  • ****
    • Loki's Nightmare
group class names
« on: 11 Aug 2008, 17:49:04 »
greetings,

where do i find the group class names?

the kind explained at the bottom of the FAQ:

http://www.ofpec.com/ed_depot/beginners/groups.php

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: group class names
« Reply #1 on: 11 Aug 2008, 20:42:18 »
No such thing exists, except in the editor when you have selected Groups.
urp!

Offline loki72

  • Former Staff
  • ****
    • Loki's Nightmare
Re: group class names
« Reply #2 on: 11 Aug 2008, 20:55:30 »
thanks for the reply,

bummer... :dry:

Offline kju

  • Members
  • *
    • PvPScene - The ArmA II multiplayer community
Re: group class names
« Reply #3 on: 12 Aug 2008, 06:50:53 »
hm

maybe misunderstood your question

cfggroups in config - most of them in ca\config.cpp  ???

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: group class names
« Reply #4 on: 12 Aug 2008, 13:48:27 »
You can generate a list of all the group types, but I do not think you can use them for anything(scripts).
urp!

Offline loki72

  • Former Staff
  • ****
    • Loki's Nightmare
Re: group class names
« Reply #5 on: 12 Aug 2008, 14:59:01 »
greetings,

thanks for the replies..

the list in the ca config.cpp was what i was looking for.. but as mr. peanut pointed out.. i don't think i can 'createunit' or 'createvehicle' to spawn a stock group from a script.

i guess i will have to make all the squads up manually..?


Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: group class names
« Reply #6 on: 12 Aug 2008, 17:24:20 »
You'd be able to read the config and make the groups manually, but you might be as well just to define your own groups.
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: group class names
« Reply #7 on: 13 Aug 2008, 20:50:08 »
Well, how about a snippet that shows how to get the group out of the config?

With that it would be relatively easy to write a spawn script based on the group type.
urp!

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: group class names
« Reply #8 on: 14 Aug 2008, 00:44:32 »
Bit more than a hint, but still needs a lot of work to be worthwhile:
Code: (find out which groups are in the config) [Select]
// Find config on a specific group.
_westInfGroupsCfg = configFile >> "CfgGroups" >> "West" >> "Infantry";

// Compile a list of group classes.
_westInfGroupInfo = [];
for "_i" from 0 to ((count _westInfGroupsCfg) - 1) do
{
_groupCfg = _westInfGroupsCfg select _i;

if (isClass _groupCfg) then
{
_westInfGroupInfo = _westInfGroupInfo +
[[getText (_groupCfg >> "name"), configName _groupCfg]];

// Or just fill up a listbox directly with this info.
};
};

hint str _westInfGroupInfo;

Code: (Create a basic infantry group) [Select]
// based on a class name picked from _westInfGroupsCfg.
_westInfGroupsCfg = configFile >> "CfgGroups" >> "West" >> "Infantry";
_groupClass = westInfGroupsCfg >> "BasicInfantry";

// Create 25m North of the player.
_groupPos = getPos player;
_groupPos set [1, (_groupPos select 1) + 25];

_groupCfg = _westInfGroupsCfg >> _groupClass;

// Create a group to put them in.
_group = createGroup west;

for "_i" from 0 to ((count _groupCfg) - 1) do
{
_manCfg = _groupCfg select _i;

if (isClass _manCfg) then
{
_class = getText (_manCfg >> "vehicle");
_rank = getText (_manCfg >> "rank");

// Place at relative position, as they would be when placed in the
// editor. They will get into formation immediately.
_pos = getArray (_manCfg >> "position");
_pos set [0, (_pos select 0) + (_groupPos select 0)];
_pos set [1, (_pos select 1) + (_groupPos select 1)];
_pos set [2, (_pos select 2) + (_groupPos select 2)];

// (_manCfg >> "side") doesn't seem too important, since you are already
// looking at WEST units based on which config path you chose originally.

_unit = _group createUnit [_class, _pos, [], 0, "NONE"];
};
};

Code: (Create a vehicle group (e.g. M1 Abrams Platoon).) [Select]
// Ensure that tracked vehicles PBO is loaded, just in case it isn't used in the
// mission.pbo already.
activateAddons ["catracked"];

_M1GroupCfg = configFile >> "CfgGroups" >> "West" >> "Armored" >> "M1Platoon";

// Create 50m South of the player.
_groupPos = getPos player;
_groupPos set [1, (_groupPos select 1) - 50];

_group = createGroup west;

for "_i" from 0 to ((count _M1GroupCfg) - 1) do
{
_vehCfg = _M1GroupCfg select _i;

if (isClass _vehCfg) then
{
// Create the vehicle.
_class = getText (_vehCfg >> "vehicle");
_rank = getText (_vehCfg >> "rank");

_pos = getArray (_vehCfg >> "position");
_pos set [0, (_pos select 0) + (_groupPos select 0)];
_pos set [1, (_pos select 1) + (_groupPos select 1)];
_pos set [2, (_pos select 2) + (_groupPos select 2)];

_vehicle = _class createVehicle _pos;

// Create the crew.
_vehicleConfig = configFile >> "CfgVehicles" >> _class;
_crewClass = getText (_vehicleConfig >> "crew");

// Driver.
for "_i" from 0 to ((_vehicle emptyPositions "driver") - 1) do
{
_unit = _group createUnit [_crewClass, _pos, [], 0, "NONE"];
_unit setRank _rank;
_unit assignAsDriver _vehicle;
_unit moveInDriver _vehicle;
};

// Gunner or gunners, if any.
for "_i" from 0 to ((_vehicle emptyPositions "gunner") - 1) do
{
_unit = _group createUnit [_crewClass, _pos, [], 0, "NONE"];
_unit setRank _rank;
_unit assignAsGunner _vehicle;
_unit moveInGunner _vehicle;
};

// Commander if any.
for "_i" from 0 to ((_vehicle emptyPositions "commander") - 1) do
{
_unit = _group createUnit [_crewClass, _pos, [], 0, "NONE"];
_unit assignAsCommander _vehicle;
_unit moveInCommander _vehicle;
};
};
};

EDIT: You'll notice I haven't bothered with directions of formation, soldiers or vehicles. Doesn't matter too much, since they will just get into formation as soon as they can anyway. If you are mad for rotating all the relative formation positions around the group position at creation, you might use something like SPON_mapRotatePoint2D which is in SPON Map (SPON\Map\initMaths.sqf). Alternatively, just use FormationDirection to point them in a specific direction, since, as I said, they'll run about getting into their formation when created anyway.
« Last Edit: 14 Aug 2008, 00:54:33 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)