Jump to content
tony86

Additional options for artillery AI

Recommended Posts

Hello!

 

I create artillery unit, and I call it "gun1", then I create marker, and I call it "target1".

At last I create trigger:

 

In Act:

 

ammo1 = getArtilleryAmmo [gun1] select 0;

tgt = getMarkerPos "target1";

gun1 doArtilleryFire [tgt, ammo1, 10];

 

Everything works great, the artillery fires 10 rounds at the target.

However, I would like to add a few more options - For example - to fire 5 rounds, then pause for 10 seconds, and then another 5 rounds fired. What would I have to add to?

 

Thanks in advance for your help and suggestions!

Share this post


Link to post
Share on other sites
[] spawn {

ammo1 = getArtilleryAmmo [gun1] select 0; 
tgt = getMarkerPos "target1"; 
gun1 doArtilleryFire [tgt, ammo1, 5];
sleep 5;
gun1 doArtilleryFire [tgt, ammo1, 5];

};

 

Share this post


Link to post
Share on other sites

I would like to do this just in trigger. Unfortunately, your additional command line are not working and causing an error.

Share this post


Link to post
Share on other sites

 

16 minutes ago, tony86 said:

 an error.

are u serious?

Share this post


Link to post
Share on other sites

some more variety but not tested:
 

0 = [] spawn 
{
 private [ "_salvos", "_delay", "_rounds", "_ammo1", "_tgt" ];
  
 private _min_delay = 3;
 private _max_delay = 20;
 private _min_rounds = 2;
 private _max_rounds = 10;
 private _min_salvos = 1;
 private _max_salvos = 5;
  
 _salvos = round (_min_salvos + random (_max_salvos - _min_salvos));

 _ammo1 = getArtilleryAmmo [gun1] select 0; 
 _tgt = getMarkerPos "target1"; 

 for "_i" from 1 to _salvos do 
 {
  _delay = _min_delay + random (_max_delay - _min_delay);
  _rounds = round (_min_rounds + random (_max_rounds - _min_rounds));
   
  gun1 doArtilleryFire [_tgt, _ammo1, _rounds];

  sleep _delay;
 };
};

 

Share this post


Link to post
Share on other sites
12 hours ago, tony86 said:

I would like to do this just in trigger. Unfortunately, your additional command line are not working and causing an error.

Could you enlighten me as to what that error is?  As I just took your code, wrapped it in a spawn so I could add a sleep to it.  

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

×