Sign in to follow this  
Chaosnz82

Timed artillery barrage on random town

1 post in this topic

Hi all, I've been looking about at code to see how to create script to select a random town (based on markers), i came across some scripting that pretty much did what i wanted after setting up a trigger to run the script, except the AI would not actually select a random spot (town) and launch a few rounds but fire 1 round without doing the 'targetting'. Below is what i used

_targetArray = ["target_1", "target_2", "target_3", "target_4", "target_5", "target_6"]; //Cherno, Electro, Zelenogorsk, Berezino and Stary sobor
_artyGunsArray = [Arty1, Arty2, Arty3]; // B_MBT_01_mlrs_F x 3 at SW corner, NW corner and NE corner in editor


while {(damage Arty1 < 0.4) and ((damage (gunner Arty1) < 1) and (side (gunner Arty1) == west)) or 	(damage Arty2 < 0.4) and ((damage (gunner Arty2) < 1) and (side (gunner Arty2) == west)) or 	  (damage Arty3 < 0.4) and ((damage (gunner Arty3) < 1) and (side (gunner Arty3) == west))} do {

_shots = 0;
	{
		if ((damage _x < 0.4) and ((damage (gunner _x) < 1) and (side (gunner _x) == west))) then {
			_gunner = gunner _x;
			_gunner lookAt [(getpos _gunner select 0), ((getpos _gunner select 1) + 50), 50];
			sleep 1;
			_x fire "rockets_230mm_GAT";
			_shots = _shots + 1;
			sleep 1;
		};
	} forEach _artyGunsArray;

sleep 10;

_x = 0;
while {_x < _shots} do {
	_rndNum = round(random 5);
	_target = _targetArray select _rndNum;
	_explosion = createVehicle ["rockets_230mm_GAT", getMarkerPos _target, [0,0,+100], 0, "NONE"];             
	_x = _x + 1;
	sleep 1;
};

sleep 15;

};

How can i make the rounds appear above the designated 'area', send a warning out to players  saying something like

player sideChat "WARNING! one of the 5 main areas is under artillery barrage, Get Clear";

Also, is the below code right as into adding a 'zone' around the area?

_marker = createMarker ["artyzone", _target];

_marker setMarkerShape "ELLIPSE";

_marker setMarkerSize [100,100];

 

Thanks to anyone whom can shed some advice into this.

 

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.