Jump to content
Sign in to follow this  
demonized

Patrol and capture markers [SCRIPT]

Recommended Posts

Engage Towns v 1.1

This is a script that came together from this thread and it deserved its own thread now that its reached full status.

Credits to all ideas and feedback from the above thread, i just did the code.

What it does:

  • Groups will patrol to and around enemy or not captured markers until its captured, then proceed to next marker, duration of patrols is random.
  • Groups can respawn, and be deleted with custom timers, vehicles in groups flying or not is also supported aswell as any type/size of group.
  • Automatically track and handle the changing of "captured" color via MP Framework.
  • Additional options are available in top of script with info on each.
  • Designed to be fully MP compatible.

Notes:

  1. re VEHICLES:
    * Units and vehicles will respawn as they were placed at script start, position and direction.
    * Planes or Helicopters will spawn flying if they were at script start. (v1.1 change)
    * Units will respawn in whatever role (commander,driver,cargo etc) of a group vehicle at script start as long as they are in the vehicle before the script is run.
    * You can use any type vehicle for any side group, as long as there is at least 1 unit of the group inside the vehicle before running the script, see demo mission for an example on west group.
  2. Individual skill, rank and leader from mission start is applied to group units on respawn.
  3. Usable for all sides, add sides in _side info below in options, note that if civilians are included, armed is not a factor only presence.
  4. If area is being fought over, color will remain as last in control, and grids will be added to marker. (blue grid means west defending against *x* enemys(*more than _treshold*) for control) (blue and no grid means west in control)
  5. Uncomment line 172 in script to set color back to _contestedCol(grey by default) if being fought over, grid will be added no matter color.
  6. Including modified BIS_fnc_taskPatrol for bug fix with vehicles, and vehicle respawn.
  7. Resistance can be friends to west or east, and script will take that into acount and marker color will be one of the major powers wich its friends with, if friend to both, resistance is simply not counted.
  8. Civilian can not be friends with anyone atm if civilian is added into _sides below, use of civilians to capture zones have not been thouroghly tested, recomend to not use civilian side groups.
  9. Created with Arma2 CO patch 1.60, v1.1 also tested with 1.62 and latest beta (just a few quick tests)

Instructions:

  1. Place functions module on map.
  2. Place markers over the areas you want capturable, any size, direction or color, and shape must be either rectangle or eclipse.
  3. Place all markernames inside the _ALL_towns_markers below as shown.
  4. Adjust _timer and other options.
  5. Place any amount of groups in editor, this is where they respawn and place one of these codes in the initline of the group:
    _null = [this] execVM "engageTowns.sqf"; - using options below in script.
    _null = [this,5] execVM "engageTowns.sqf"; - using 5 respawns for this group only.
    _null = [this,5,6] execVM "engageTowns.sqf"; - using 5 respawns, and 6 second respawn delay for this group only.
    _null = [this,5,6,78] execVM "engageTowns.sqf"; - using 5 respawns, 6 second respawn delay and 78% chance to respawn for this group only.
    Custom init for GROUP LEADER: place last no matter what options are used above, also remember to use 'single' or ""double"" inside the "outer".
    _null = [this,"_null = [this] execVM 'someScript.sqf';"] execVM "engageTowns.sqf";
    _null = [this,5,6,"_null = [this] execVM 'someScript.sqf';"] execVM "engageTowns.sqf";

Download demo mission OA required

Armaholic download v 1.0

Download contains:

  1. New public version v 1.1
  2. Timer script based on code by psvialli from original thread.
  3. Tracking script usable for debug/testing.

Credits:

  • Katipo66 for many ideas, feedback, script is mostly based on your ideas.
  • psvialli for ideas, feedback, timer code.
  • BIS Forum members for all your knowledge and sharing of it.

Disclaimer:

Feel free to modify, if you share a modification publicly, make sure you include the relevant credits.
Edited by Demonized
respawn error and flying vehicles fix

Share this post


Link to post
Share on other sites

Awesome! some great additions/tweaks... This one of my favourite scripts :D

Edited by Katipo66

Share this post


Link to post
Share on other sites

Thanks for posting Demonized. Had a play....good stuff!

Share this post


Link to post
Share on other sites

Great release, and thanks for all your work on this!

Just a suggestion or tweak if possible?

Say I have 3 Zones and have preplaced some OPFOR in those zones at the start hiding in buildings or what ever It will turn red at the start of the mission which is correct but then the countdown timer will also start.

I do not want the timer to start until at least one of those zones have been re captured by Bluefor. If you get my meaning?

i.e OPFOR have all 3 zones at start Bluefor captures one zone so then if OPFOR recapture that one back and they then have all zones the countdown timer should start and blufor have to recapture a zone before it runs out. otherwoise it is a mad rush to get a zone at the start of a mission.

Is that possible ? hope that makes sence :)

Share this post


Link to post
Share on other sites

Thank you Foxhound, 1st post updated with Armaholic link.

Awesome! some great additions/tweaks... This one of my favourite scripts :D
Thanks for posting Demonized. Had a play....good stuff!
Great release, and thanks for all your work on this!

Tnx guys, great that you find it enjoyabe.

Say I have 3 Zones and have preplaced some OPFOR in those zones at the start hiding in buildings or what ever It will turn red at the start of the mission which is correct but then the countdown timer will also start.

I do not want the timer to start until at least one of those zones have been re captured by Bluefor. If you get my meaning?

i.e OPFOR have all 3 zones at start Bluefor captures one zone so then if OPFOR recapture that one back and they then have all zones the countdown timer should start and blufor have to recapture a zone before it runs out. otherwoise it is a mad rush to get a zone at the start of a mission.

Is that possible ? hope that makes sence :)

Try this, untested but should work.

Replace your timer.sqf with this:

private ["_require_1_capture","_noCntStart","_who","_colorChk","_col","_t","_min","_sec","_endHint","_endType","_marker","_cnt","_ALL_towns_markers"];
/*
* Save as timer.sqf
* Place the same markers here as in engageTowns.sqf
* Adjust end messages.
* Set the endMission types, check    http://community.bistudio.com/wiki/endMission    for info on endings.
* Place this in init.sqf or in any unit/object initline, number is minutes after all is captured before endMission.
	_null = 10 execVM "timer.sqf";

Credits: Psivalli for the idea and actual timer code part.
*/

_ALL_towns_markers = ["townMarker1","townMarker2"];
_require_1_capture = true;  // if one of the markers must change color before the actual timer is activated. (all markers can start as for example red, and once 1 of them has been captured by others the timer activates.

if (!isServer OR !isNil "DMZ_ET_endCheck") exitWith {};
DMZ_ET_endCheck = true;
waitUntil { !isNil "BIS_MPF_InitDone" };

if (_require_1_capture) then {
// wait until there is change in marker colors before activating the countdown, no matter color of marker, at least one of them has to change before timer is activated.
_noCntStart = [];
{_noCntStart = _noCntStart + [[_x, getMarkerColor _x]]} foreach _ALL_towns_markers;
waitUntil {sleep 1; ({getMarkerColor (_x select 0) != (_x select 1)} count _noCntStart) != 0};
};

while {DMZ_ET_endCheck} do {
_cnt = count _ALL_towns_markers;
waitUntil {sleep 1; ({getMarkerColor _x == "ColorBlue"} count _ALL_towns_markers) == _cnt OR ({getMarkerColor _x == "ColorRed"} count _ALL_towns_markers) == _cnt OR ({getMarkerColor _x == "ColorGreen"} count _ALL_towns_markers) == _cnt OR ({getMarkerColor _x == "ColorWhite"} count _ALL_towns_markers) == _cnt};
DMZ_ET_endCheck = false;

_t = _this * 60;
while {_t > 0} do {
	_colorChk = [];
	{
		_col = getMarkerColor _x;
		if (!(_col in _colorChk)) then {_colorChk = _colorChk + [_col]};
	} foreach _ALL_towns_markers;

	_who = switch (true) do {
		case ("ColorBlue" in _colorChk): {"West"};
		case ("ColorRed" in _colorChk): {"East"};
		case ("ColorGreen" in _colorChk): {"Resistance"};
	};

	_min = floor (_t / 60);
	_sec = floor (_t mod 60);
	_min = (if (_min <= 9) then {"0"} else {""}) + str _min;
	_sec = (if (_sec <= 9) then {"0"} else {""}) + str _sec;
	_t = _t - 1;

	[nil,nil,rSPAWN,hintSilent (format["%3 WIN %1:%2",_min,_sec,_who])] call RE;
	sleep 1;

	if (_t != 0 AND count _colorChk > 1) then {_t = 0; DMZ_ET_endCheck = true};
};
[nil,nil,rSPAWN,hintSilent ""] call RE;

if (!DMZ_ET_endCheck) then {
	// now all markers is either red, blue or orange.
	_endType = ""; _endHint = "";
	_marker = _ALL_towns_markers select 0;

	if (getMarkerColor _marker == "ColorBlue") then {
		// Bluefor win message or set a variable for your own end triggers etc.
		_endHint= "Blue wins";
		_endType = "END1";
	};
	if (getMarkerColor _marker == "ColorRed") then {
		// Opfor win message or set a variable for your own end triggers etc.
		_endHint= "Red wins";
		_endType = "LOSER";
	};
	if (getMarkerColor _marker == "ColorGreen") then {
		// Resistance win message or set a variable for your own end triggers etc.
		_endHint = "Resistance wins";
		_endType = "LOSER";
	};
	if (getMarkerColor _marker == "ColorWhite") then {
		// Civilian win message or set a variable for your own end triggers etc.
		_endHint = "Civilians wins";
		_endType = "LOSER";
	};
	[nil,nil,rHINT,_endHint] call RE;

	// below  and the _endType lines can be deleted if you handle end of mission some other way.
	sleep 5;  // wait 5 seconds after hint then endmission for all.

	// end the mission.
	[nil,nil,rendMission,_endType] call RE;
};
};

Set all the markers colors in editor, red for all like your example with opfor, then once mission starts, the timer will not start until at least one of the markers have changed color.

Share this post


Link to post
Share on other sites

Had a great mission last night using this script very easy and fast to set up a new mission !

Is there way to use Helicopters , so that they will land near the Patrol area and then capture hold the zone and then move off to the next just like vehicles ?

Share this post


Link to post
Share on other sites
Had a great mission last night using this script very easy and fast to set up a new mission !

Is there way to use Helicopters , so that they will land near the Patrol area and then capture hold the zone and then move off to the next just like vehicles ?

Cool to hear, have been toying with transport helis ideas, ill see if i can bring it to life this weekend.

Share this post


Link to post
Share on other sites

Hotfix: Vehicles respawn error, vehicles respawned once for each crew member due to a mishap delete while editing, downloadlink updated.

Some upcoming changes in v 1.1

  • Land, unload and patrol with helis.
  • Side or group taxi function.
  • Dynamically adjustable markers.
  • Beheaviour when capturing VS contested.
  • Air vehicles can spawn flying.
  • Groups can have waypoints to execute before going on patrol.

Share this post


Link to post
Share on other sites

This is great to hear!

+Air vehicles can spawn flying. This would be great for the islands with no Airports, it kind off works now if i use planes set to 'flying' but they just nose dive and crash on respawn, this for I44 air units at least.

Looking forward to it, those new features sound awesome.

Just a note with the timer (cool feature) if east has captured all markers, and timer goes gets to Zero it then changes all markers to blue and gives Blufor the win :P

Edit* scratch the comment about the timer... on countless other tests it appears to work no problem.

Edited by Katipo66

Share this post


Link to post
Share on other sites
Hotfix: Vehicles respawn error, vehicles respawned once for each crew member due to a mishap delete while editing, downloadlink updated.

Some upcoming changes in v 1.1

  • Land, unload and patrol with helis.
  • Side or group taxi function.
  • Dynamically adjustable markers.
  • Beheaviour when capturing VS contested.
  • Air vehicles can spawn flying.
  • Groups can have waypoints to execute before going on patrol.

Did you manage to get the Helli's to work on this ?

Share this post


Link to post
Share on other sites

Hey Demonized just wanna know if this is correct, ive 8 towns wanting to use this script, so no the _ALL_towns_markers line I should have like below right?

_ALL_towns_markers = ["townMarker1","townMarker2","townMarker3","townMarker4","townMarker5","townMarker6","townMarker7","townMarker8"];

Another thing is, how to make the markers invisible so I cant see them in game, and it only gives a hint which town to attack or retake? and hide the

spam chat which says things like "DarkXess activated marker" something like that anyways ..

Last but not least, lol... how to also hide the units so I cant see them on map? its well too easy seeing where the enemy are coming from, hehe.

Thanks

Edited by DarkXess

Share this post


Link to post
Share on other sites

1) look in the .sqf and locte the "sidechat "trigger activated"; " and comment that out as that will revove the Spam Chat , that was left in in error.

2) make sure you set _tracking = false; otherwise you wilol see all the red dots - that was for debug and testing.

Not sure how to hide the markers as the whole point was to show them in the first place !!!

As for the other you will need to wait for the Expert Demonized LOL.

Share this post


Link to post
Share on other sites
1) look in the .sqf and locte the "sidechat "trigger activated"; " and comment that out as that will revove the Spam Chat , that was left in in error.

Done the rest, but "comment that out" meaning using a // at the front of the line? lol sorry not an expert at this.

Thanks again

Share this post


Link to post
Share on other sites
Done the rest, but "comment that out" meaning using a // at the front of the line? lol sorry not an expert at this.

Thanks again

Yes mate locate that line in the .sqf and then put the // in front of that line :)

Share this post


Link to post
Share on other sites
Yes mate locate that line in the .sqf and then put the // in front of that line :)

Thanks alot ... just waiting for the rest now from Mr Demonized! hehe :)

Share this post


Link to post
Share on other sites

Not sure if you are running this on a dedi box if you are can you confirm that the Timer works for you? , as I am unable to get the Timer to work on a dedi box, works great when hosting myself!

Just tested again on Dedi box and Timer defiantly does not work , Demonized any chance you could have a look at that for us ?

Thanks

Edited by psvialli

Share this post


Link to post
Share on other sites
Not sure if you are running this on a dedi box if you are can you confirm that the Timer works for you?

Nah, same here! not working. LoL seems Demonized has gone AwoL too, hehe

Share this post


Link to post
Share on other sites

I have playing around testing this and noticed that there is only 1 respawn no matter what?

I removed all mods and tested on vanilla mission and groups will only respawn once no matter what i did... default, custom.

Does it work for anyone else, weird as im sure it worked no problem prior and cant think of anything that might break it?

Share this post


Link to post
Share on other sites

Same here must be the new version as just tested the old verstion and it works, lets hope Demonized is back soon :)

Edited by psvialli

Share this post


Link to post
Share on other sites

Em, strange... new version is working ok for me on respawns. Still waiting for an answer on my last question, lol... DEMONIZED where are you man? :bounce3:

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  

×