OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: zonker3210 on 16 Jul 2011, 13:54:38

Title: Adding ammo to cargo area of boats
Post by: zonker3210 on 16 Jul 2011, 13:54:38
In my "init.sqf" file, the following code does not add magazines for either the RHIB and CRRC (Zodiac) vehicles....

Code: [Select]
_boat addMagazineCargo ["30Rnd_556x45_Stanag", 10];
Am I doing something wrong or do these vehicles simply have no cargo capacity? The following post on the BI forums suggests attaching an ammo crate to the boat so I guess that's an option...

http://forums.bistudio.com/showthread.php?t=84937#post1466511

Anyhow, I'd appreciate any suggestions for handling this. Thanks!
 - z
Title: Re: Adding ammo to cargo area of boats
Post by: punisher on 16 Jul 2011, 14:55:42
try just doing it in the units init: this addmagazinecargo ["stanag",10]
Title: Re: Adding ammo to cargo area of boats
Post by: zonker3210 on 16 Jul 2011, 23:07:27
I tried that...although the name you used in your example "stanag" isn't what I tried. Is that some sort of super-class name that is needed or was that just a placeholder for your example? In any event, using the actual magazine class names, the INIT field approach works for cars, trucks and other vehicles but not for boats such as RHIB's and CRRC's.
Title: Re: Adding ammo to cargo area of boats
Post by: Pirin on 17 Jul 2011, 00:32:44
I don't know when it changed, but currently vanilla CRRC's cannot hold any weapon or magazine cargo.  I know this wasn't always the case since I have a mission where you start out in one and use Gear to equip what you need.

The ACE2 mod includes CRRC's (and other boats) which can carry ammo and weapons.
Title: Re: Adding ammo to cargo area of boats
Post by: zonker3210 on 17 Jul 2011, 01:16:39
Okay, thanks for the info!
Title: Re: Adding ammo to cargo area of boats
Post by: F2kSel on 17 Jul 2011, 01:23:45
You can add a fake ammobox to any object.

Just place an ammobox on the map and name it ammobox  and in the init put this hideobject true

In the boats init put this
Code: [Select]
this addaction ["CRRC-Gear","ammobox.sqf",[], 6, true, true, "", "(_this distance (_target))<2  and !(player in _target)"];

and for the code it's just this

Code: [Select]
_Player = _this select 1;
ammobox setpos position _player;
_Player action ["Gear", ammobox];


Title: Re: Adding ammo to cargo area of boats
Post by: zonker3210 on 19 Jul 2011, 06:47:09
Thanks, F2kSel...that's a really nice solution. The "CRRC-Gear" action doesn't always appear unless the player is positioned just right but in many ways it's much nicer than using the "attachTo" function. I'd been using the latter but it causes the CRRC to bounce a lot when using single-player mode's 2x and 4x Fast Time modes. When using a hidden ammobox, I don't run into that problem.

Thanks again!
Title: Re: Adding ammo to cargo area of boats
Post by: F2kSel on 19 Jul 2011, 11:28:11
You can extend the the range which may make it easier to see by changing this bit.

from
Code: [Select]
(_this distance (_target))<2
to
Code: [Select]
(_this distance (_target))<4