Jump to content
Sign in to follow this  
cyop

this addeventhandler ["fired", {(_this select 0) addMagazine "MAAWS_HEAT"}]; ?

Recommended Posts

Hi.

I never could make a working solution for only reloading 2 rounds, so, how can...

this addeventhandler ["fired", {(_this select 0) addMagazine "MAAWS_HEAT"}];

be rewritten to only allow for a reload of a MAAWS round when just the MAAWS is fired? I want to actually have to manually reload the MAAWS round, not have it auto reload.

TIA

Share this post


Link to post
Share on other sites

what I would try:

this setVariable ["smawAmmo", 2]
this addeventhandler ["fired", 
{

[indent]_ammo = (_this select 0) getVariable ["smawAmmo", 0];
_weapon = _this select 1;
if ((_ammo > 0) AND (_weapon == "SMAW")) then {

[indent]_ammo = _ammo - 1;
(_this select 0) setVariable ["smawAmmo", _ammo];
(_this select 0) addMagazine "MAAWS_HEAT"}];[/indent]



};[/indent]
};

completely untested though...

-----------

edit: after re-reading your post, I understood what you really wanted to achieve ^^ But it should work now...

Edited by CptBBQ

Share this post


Link to post
Share on other sites

You made me hungry!

I cannot get it to work. Thank you, though. :)

EDIT: Oh, yeah, sorry, the unit name is... player1

You want to step by step me. Also, I have my original line in the unit init field. And just in case, although I think you may know this, that original line will give me a MAAWS round no matter what I fire. That is mainly what I am trying to prevent. (Heck, I can throw the thing on the ground once I have fire two or three rounds.)

Edited by CyOp

Share this post


Link to post
Share on other sites

this addEventHandler ["Fired",{if (_this select 5=="MAAWS_HEAT") then {_this select 0 addMagazine "MAAWS_HEAT"}}]

Share this post


Link to post
Share on other sites
You made me hungry!

and that made me lol ^^

well, my code should only give you a smaw-round when the fired weapon is a smaw, and only up to two times.

Celery´s solution should rearm you if the fired round is a a "MAAWS_HEAT", without a limitation.

Both should work from within the units init-line. But as I´m unable to test my code atm I can only hope to nudge you in the right direction.

Share this post


Link to post
Share on other sites

Thank you, Celery. Thank you, CptBBQ. (Hmmm... B-B-Q!)

CptBBQ, I still have not got your script to work. Try to test it, please.

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  

×