Jump to content
Sign in to follow this  
lexx

Removing specific ammo from a vehicle turret

Recommended Posts

So at first glance, this looks like a non-issue. Just do e.g.

this removeMagazinesTurret ["2Rnd_GAT_missiles",[0]]

...right?

 

Now I just found out that there is a tiny issue that makes this kinda mood in singleplayer. As soon as I save & load, the vehicle is fully stocked on that ammo type again.

 

Is there any other trick or script command that I've got to use here? I don't really want to make a loop and constantly check the vehicle ammo + remove it again, just because the player *could* possibly reload at any time.

Share this post


Link to post
Share on other sites
handle1 = addMissionEventHandler ["Loaded",{ testtank removeMagazinesTurret ["2Rnd_GAT_missiles",[0]] }];

Nope, doesn't work. Tried it already a while ago in a different situation. Save & Load = Ammo is back.

Share this post


Link to post
Share on other sites

Something like this?

test addEventHandler ["GetIn",{ test removeMagazinesTurret ['2Rnd_GAT_missiles',[0]] }]

test = vehicle name.

 

Doesn't do anything either.

 

 

/Edit: The Loaded event handler in itself is working. It's just that removeMagazinesTurret doesn't seem to. Even if I'll call it from within the event handler with [] spawn and a sleep delay.

 

/Edit2: It seems removeMagazinesTurret only works once? Even if I execute it again after loading in the debug console, nothing happens.

Share this post


Link to post
Share on other sites

That's strange, I've definitely used it in the past with getIn to remove unwanted mags.

Share this post


Link to post
Share on other sites

example how i do this with armed boats
 

if (typeOf _veh == "B_Boat_Armed_01_minigun_F") then {
    private ["_mags", "_i"];
   _mags = [_veh magazinesTurret [-1],_veh magazinesTurret [0],_veh magazinesTurret [1]];// need to define for each vehicle type
   _i= -1;
	{
	  _veh removeMagazinesTurret [_x select 0,[_i]];
	 _i = _i + 1;
	} forEach _mags;
};

Share this post


Link to post
Share on other sites

^ Error Type any, expected String.

 

 

Got it working with keeping it simple:

test setAmmo ["missiles_titan", 0];

 

Sadly, doesn't work for "autocannon_30mm_CTWS" - probably because it uses multiple ammo types.

Share this post


Link to post
Share on other sites

as David doss recommended. use types and do removals for all turrets and magazines. You can use the config viewer to get the mags and turrets classnames for each vehicle you are trying to edit.

Good Luck.

ps. I know there is a post over at exilemod forums that shows this exactly but in a different form since that mod loads the vehicles with their own function, but I'm pretty sure you will be able to do the same from the vehicles init in sp

Share this post


Link to post
Share on other sites

Why would I use types? I want to remove *some* ammo from specific vehicles, not everything from all of em.

 

I haven't tried the posted code, but right now I don't exactly see how it is much different than my initial try. Like I've pointed out already, removeMagazinesTurret doesn't seem to work anymore after it was used once and the game got loaded. And using it once, then loading a savegame seems to undo its actions.

Share this post


Link to post
Share on other sites

maybe try selecting appropriate turret weapon with selectWeaponTurret first and then attempt to remove mags

Share this post


Link to post
Share on other sites

Remove all the ammo from all the weapons.

Then add back only the ammo you want.

.

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  

×