Jump to content
Sign in to follow this  
dr@gon

CSW questions

Recommended Posts

After searching the forums I decided to create a new post since I have not been able to find the solution to my questions;

1) I want to start a mission where a M252 Mortar and Tripod are packed on a couple of AI team members. What is the syntax for the init line to add "M252_US_Bag_EP1" to a soldier's loadout? Obviously another soldier would have "Tripo_Bag" added to his loadout also.

2) Now that my team of trouble makers are loaded up with a disassembled Mortar, what sort of commands (or script) could I use in a waypoint to have the AI setup the mortar?

Any help would be appreciated.

thanks

---------- Post added at 12:19 AM ---------- Previous post was Yesterday at 11:37 PM ----------

Okay I found the answer to my first question;

this addBackpack "m252_US_Bag_EP1";

Share this post


Link to post
Share on other sites

Interesting question, which I can't answer. I can't think of any normal ways of scripting this. Anyone know if there are any new actions we could use for this? Commanding AIs to do it seems to be possible (easy even). So apparently there must be some new actions we can use, but unfortunately biki action doesn't seem to have anything updated for OA.

Edit: Oh holy crap... http://community.bistudio.com/wiki/ArmA_2:_Actions

Share this post


Link to post
Share on other sites

View the demo mission to follow along in the comfort of your own home.

deployMortar.sqf:

tripodGuy action["PutBag", tripodGuy];
sleep 4;
mortarGuy doMove getPos tripodGuy;
sleep 2;
deleteVehicle nearestObject [mortarGuy, "tripod_bag"];
mortarGuy action["Assemble", unitbackpack mortarGuy];

breakdownMortar.sqf:

_mortar = nearestObject [mortarGuy, "M252_US_EP1"];

mortarGuy doMove getPos _mortar;
sleep 4;
mortarGuy action["disassemble", _mortar];
sleep 4;
mortarGuy action["takeBag", nearestObject [mortarGuy, "m252_US_Bag_EP1"]];
tripodGuy action["takeBag", nearestObject [tripodGuy, "tripod_bag"]];

unfortunately biki action doesn't seem to have anything updated for OA.

Yeah, that always bugged me. So when I added the new RepairVehicle action to the Armed Assault list of Actions and kju kindly moved it to the ArmA2 list (thereby revealing that such a list existed!) then I added the ArmA2 list link to the action biki reference. No more wondering about new commands! :)

Edited by kylania

Share this post


Link to post
Share on other sites

Very cool gentlemen thank you very much.

Share this post


Link to post
Share on other sites

Sorry to bump an old thread, but I've been using Kylania's work for a script I'm building and I've got stuck.

I'm writing some code to work out a way of doing this on command for the players group. The script is available on command and assumes that there will only be one support weapon carried by the squad.

Here's the problem.

The following code is used to determine which unit is carrying the tripod.

_tripod_bearer = [];
{
    if (unitBackpack _x isKindOf "tripod_bag") then
    {
         _tripod_bearer set [count _tripod_bearer, _x];
    };
} forEach (units _thisgroup);

_tripod = _tripod_bearer select 0;

This works fine.

The following code is used to find the unit carrying the M2 HMG.

_weapon_bearer = [];
{
    if (unitBackpack _x isKindOf "M2StaticMG_US_Bag_EP1") then
    {
         _weapon_bearer set [count _weapon_bearer, _x];
    };
} forEach (units _thisgroup);

_weapon = _weapon_bearer select 0;

This works fine too, as long as I'm using the M2. I want to expand the available weapons to all static weapons regardless of class. I found the following list which I'd like to include. (Plus the BAF units, which classnames I can't find);

SPG9_TK_INS_Bag_EP1
SPG9_TK_GUE_Bag_EP1
TOW_TriPod_US_Bag_EP1
Metis_TK_Bag_EP1
2b14_82mm_TK_INS_Bag_EP1
2b14_82mm_TK_GUE_Bag_EP1
2b14_82mm_TK_Bag_EP1
M252_US_Bag_EP1
AGS_UN_Bag_EP1
AGS_TK_INS_Bag_EP1
AGS_TK_GUE_Bag_EP1
AGS_TK_Bag_EP1
MK19_TriPod_US_Bag_EP1
KORD_UN_Bag_EP1
KORD_TK_Bag_EP1
KORD_high_UN_Bag_EP1
KORD_high_TK_Bag_EP1
DSHkM_Mini_TriPod_TK_INS_Bag_EP1
DSHkM_Mini_TriPod_TK_GUE_Bag_EP1
DSHKM_TK_INS_Bag_EP1
DSHKM_TK_GUE_Bag_EP1
M2HD_mini_TriPod_US_Bag_EP1
M2StaticMG_US_Bag_EP1

The only way I can find to reference them is this, which is really tedious and possibly wasteful.

_weapon_bearer = [];
{
    if (unitBackpack _x isKindOf "M2StaticMG_US_Bag_EP1" or unitBackpack _x isKindOf "TOW_TriPod_US_Bag_EP1") then
    {
         _weapon_bearer set [count _weapon_bearer, _x];
    };
} forEach (units _thisgroup);

_weapon = _weapon_bearer select 0;

Is there any other way to check for every type of CSW bag? (Didn't want to type out all of the different bags in the example). I was looking at the configs and trying to use the following but with no success:

_weapon_bearer = [];
{
    if (unitBackpack _x isKindOf "assembleInfo") then
    {
         _weapon_bearer set [count _weapon_bearer, _x];
    };
} forEach (units _thisgroup);

_weapon = _weapon_bearer select 0;

I'm a config noob and the only thing I could see that the weapon bags have in common is the assembleInfo entry. But I think my lack of knowledge with scripting and config work is seriously letting me down.

If anyone can help, I'd really appreciate it.

EDIT: I've searched these forums for useful stuff, but couldn't find anything.

Edited by Das Attorney

Share this post


Link to post
Share on other sites

Solved.

I dug around in the configs for Backpacks a bit more and found this parent(?) class common to all of the weapon backpacks: "Weapon_Bag_Base_EP1"

So the following now works:

	_weapon_bearer = [];
{
    if (unitBackpack _x isKindOf "Weapon_Bag_Base_EP1") then
    {
         _weapon_bearer set [count _weapon_bearer, _x];
    };
} forEach (units _thisgroup);

_weapon = _weapon_bearer select 0;

Share this post


Link to post
Share on other sites

sorry to resurect an old thread but people may be interested.

was modifying the scripts on the thread and came up with this:

deploy

_units = {units _x} forEach _this;
_number = 0;
_tripod_bearer = [];
_weapon_bearer = [];
_cswtgt = createMarkerLocal ["csw", [0,0,0]];
_cswtgt setMarkerShapeLocal "ICON";
_cswtgt setMarkerColorLocal "ColorRed";
"csw" setMarkerTypeLocal "hd_destroy";
hint "map click overwatch position";
onMapSingleClick {'csw' setMarkerPos _pos; target=true};
waituntil {target};
onMapSingleClick { };
target=false;

{
_x setVariable ["CSW", 0, true];
if (unitBackpack _x isKindOf "tripod_bag") then
	{
	 _tripod_bearer set [count _tripod_bearer, _x];
	_x setVariable ["CSW", 1, true];
	};
if (unitBackpack _x isKindOf "Weapon_Bag_Base_EP1") then
       	{
        	 _weapon_bearer set [count _weapon_bearer, _x];
	_x setVariable ["CSW", 2, true];
       	};
} forEach _units;
{_x setUnitPos "DOWN"; _x disableAI "MOVE"} foreach _tripod_bearer;
while {_number < count _weapon_bearer} do
{
_weapon = _weapon_bearer select _number; 
_tripod = _tripod_bearer select _number; 
sleep 1;
_tripod action["PutBag", _tripod];
sleep 2;
_weapon doMove getPos _tripod;
sleep 2;
deleteVehicle nearestObject [_weapon, "tripod_bag"];
_weapon action["Assemble", unitbackpack _weapon];
sleep 2;
_sf = nearestObject [_weapon, "StaticWeapon"];
_weapon assignAsGunner _sf;
[_weapon] orderGetIn true;
_number = _number +1;
_possf = getpos _sf;
_posTrg = getMarkerpos "csw";
_sf setdir (((_posTrg select 0) - (_possf select 0)) atan2 ((_posTrg select 1) - (_possf select 1)));
};
{_x setUnitPos "AUTO"; _x enableAI "Move"} foreach _tripod_bearer;
deleteMarkerLocal "csw"

pack up

_units = {units _x} forEach _this;
_number = 0;
_tripod_bearer = [];
_weapon_bearer = [];
{
if ((_x getVariable "CSW")==1) then
	{
	 _tripod_bearer set [count _tripod_bearer, _x];
	};
if ((_x getVariable "CSW")==2) then
       	{
        	 _weapon_bearer set [count _weapon_bearer, _x];
       	};
} forEach _units;
while {_number < count _weapon_bearer} do
{
_weapon = _weapon_bearer select _number; 
_tripod = _tripod_bearer select _number; 
[_weapon] orderGetIn false;
sleep 5;
_sf = nearestObject [_weapon, "StaticWeapon"];
_weapon doMove getPos _sf;
sleep 4;
_weapon action["disassemble", _sf];
sleep 4;
_tripod action["takeBag", nearestObject [_tripod, "tripod_bag"]];
sleep 1;
_weapon action["takeBag", nearestObject [_weapon, "Weapon_Bag_Base_EP1"]];
_number=_number+1;
};

can be executed from HC by radio as

deploy

nul = (hcSelected player) execVM "deploy.sqf"

packup

nul = (hcSelected player) execVM "packup.sqf"

can also be done out of hc by making arguments

group (unitleader)

the bulk of the code comes from kylania and Das Attorney

i just made it so a single squad can have multiple CSW and deploy them an overwatch on a position

  • Thanks 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×