IRONFRONT FANS FORUM
Register Latest Topics
 
 
 


Reply
  Author   Comment  
Tayuk

Avatar / Picture

Admin
Registered:
Posts: 455
Reply with quote  #1 
Download: AI Simulated Artillery Script

This script makes a pak40 or Zis3 behave as a simulated artillery gun. Found on one of the ARMA sites, author unknown.

A Pak40/Zis3 named art1 placed on map, the following in its init. A marker named "TARGET1" placed where you want the explosions (as if round landed there).
5000 points the gun up, 300 is the radius around marker that rounds might land, 2 is time between fireing and round dropping.

Artillary keeps fireing unit the gunner is dead basically. If you attack the gun position close up it will try and kill you.

The class names highlighted in blue can be changed to the Russian LIB_Zis3 and/or a different shell for the type of explosion wanted. On the Zis3 the 5000 within the init code should be increased to 9000 to make the gun raise more.

Code:
[art1, "TARGET1", 5000, 300, 2] exec "D30fire.sqs";


Then the D30fire.sqs
Code:
_d30=_this select 0

(gunner _d30) disableAI "AUTOTARGET"

_d30TARG1=_this select 1

_GUNHEIGHT=_this select 2

_Radius=_this select 3

_droptime=_this select 4

_GUNHEIGHT2=_GUNHEIGHT+(Random 20)

_X = GetMarkerpos _d30TARG1 select 0;

_Y = GetMarkerpos _d30TARG1 select 1;

_d30 DoWatch [_X,_Y,_GUNHEIGHT];

~(3+(Random 10))

#start
if (isServer) exitWith {};

_d30 setVehicleAmmo 1;

~3
_X3=_X-(Random 20);
_Y3=_Y-(Random 20);
_GUNHEIGHT2=_GUNHEIGHT+(Random 20)
_d30 DoWatch [_X3,_Y3,_GUNHEIGHT2];

?(not alive gunner _d30): exit

_d30 fire "LIB_Pak40"

~_droptime

_X1 = GetMarkerpos _d30TARG1 select 0;

_Y1 = GetMarkerpos _d30TARG1 select 1;

_X1 = _X1+((Random _Radius)-40);

_Y1 = _Y1+((Random _Radius)-40);

_Bomb="LIB_SprGr34_KWK40_HE" CreateVehicle [_X1,_Y1,0];

~(5+(Random 3))
_X2=_X+(Random 20)
_Y2=_Y+(Random 20)
_GUNHEIGHT2=_GUNHEIGHT+(Random 20)
_d30 DoWatch [_X2,_Y2,_GUNHEIGHT2];
~3
goto "start"
0
Santa Six

Avatar / Picture

Colonel
Registered:
Posts: 360
Reply with quote  #2 
I made this to eject the units when the enemy gets too close. Maybe someone can streamline it or approve effectiveness.

Using three AT guns as a battery (w/ above script). I named the AT guns (gun, gun_1, and gun_2)
In the mission init.sqf I added gunCrew = [gun,gun_1,gun_2]; 

Then I placed a trigger in the center of the battery with good coverage. Set to activate when the enemy is in the trigger area. On act: _nul = execVM "artyEject.sqf";

artyEject.sqf
Code:
{
   {
      (gunner _d30) enableAI "AUTOTARGET";
      unassignVehicle _x;
      _x Action ["Eject", Vehicle _x];
      [_x] allowGetIn false;
 
   } ForEach crew _x;
} ForEach gunCrew;
 
0
Gunter Severloh

Avatar / Picture

Admin
Registered:
Posts: 2,733
Reply with quote  #3 
Script is now hosted on the MR:
AI Simulated Artillery Script

first post updated with download link, please use this thread as a reference.

__________________
0
Foxsch

Avatar / Picture

Colonel
Registered:
Posts: 454
Reply with quote  #4 
How many times have I wanted that!? Definitely updating my missions [thumb]
Many thanks Santa Six

__________________
Mission Repository - http://www.missionrepository.com

0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.