Jump to content
Wiki

[Solved] AI infinite magazine

Recommended Posts

Hello there.

 

I'm trying to create a firing range for my new mission.

I want the AI to have infinite magazines but reload when the mag is empty.

 

Is it possible?

If yes, how can I do that?

 

Thanks

Share this post


Link to post
Share on other sites
[] spawn
{
    while {alive unit} do
    {
        if ((count magazines unit) < 5) then
        {
            unit addMagzine "xxxx";
        };
        sleep 5;
    };
};

 

Maybe like so?

Share this post


Link to post
Share on other sites

Easiest way is to use the "reloaded" eventhandler and simple add magazine of current weapon.. so every time they reload and discard empty mag they are give a new one.

Share this post


Link to post
Share on other sites
17 minutes ago, R3vo said:

[] spawn
{
    while {alive unit} do
    {
        if ((count magazines unit) < 5) then
        {
            unit addMagzine "xxxx";
        };
        sleep 5;
    };
};

 

Maybe like so?

Thanks, gonna try this :-)

 

2 minutes ago, nimrod_z said:

Easiest way is to use the "reloaded" eventhandler and simple add magazine of current weapon.. so every time they reload and discard empty mag they are give a new one.

Good to know.

Do you have the command?

Share this post


Link to post
Share on other sites
8 minutes ago, nimrod_z said:

Easiest way is to use the "reloaded" eventhandler and simple add magazine of current weapon.. so every time they reload and discard empty mag they are give a new one.

 

I didn't even think about the reloaded EH. Good idea!

Share this post


Link to post
Share on other sites

Probably like this:

this addEventHandler ["Reloaded",{
	_unit = _this select 0 ;
	_mag = _this select 4 select 0 ;
	_unit addMagazine _mag ;
}] ;

Not tested yet.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Works great! Thanks a lot!

Share this post


Link to post
Share on other sites

Help me Please AddEventHandler

Could you give me some help?
I want to know how this works, and if this works in ARMA 2

It's about the infinite refills script
where should i put this

What should I do?
Create which files or where to put them in the game

 

this addEventHandler ["Reloaded",
{
_unit = _this select 0;
_mag = _this select 4 select 0;
_unit addMagazine _mag ;
}];



or this

 

null = this spawn {
	_this dotarget t1;
	sleep 0.5;
	_this addEventHandler ["Reloaded",{ 
		_unit = _this select 0 ; 
		_mag = _this select 4 select 0 ; 
		_unit addMagazine _mag ; 
	}] ;
	while {alive t1 and alive _this} do {
		sleep 0.3;
		[_this,currentWeapon _this] call BIS_fnc_fire;
	} ;
} ;

 

Share this post


Link to post
Share on other sites

To give a unit unlimited ammo

= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

 

this addeventhandler ["fired", {(_this select 0) setvehicleammo 1}]

 

 

 

 

 

  • Like 1

Share this post


Link to post
Share on other sites
On 05/03/2022 at 19:22, Joe98 said:

Para dar munição ilimitada a uma unidade

= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

 

this addeventhandler ["disparado", {(_this select 0) setvehicleammo 1}]

 

 

 

 

 



Make unit have unlimited ammo but do still have to make a Magasin change

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

×