Jump to content
target_practice

Creating a simple attack/defence mission using vanilla assets.

Recommended Posts

How would one go about creating such a scenario using native resources such as the sector modules and such?

The idea for such a scenario is that one team would have to try to capture multiple sectors in a linear order while the opposing team tries to stop them.

 

Attackers win if all sectors are captured, whereas defenders win if attackers lose all their tickets from deaths/ticketbleed.

 

Also are there any hooks I could use to create waypoints for groups to the currently active sector in order to create rudimentary AI support.

 

EDIT:

I should also add that I am aware making such a mission would probably require the use/creation of custom scripts.

Share this post


Link to post
Share on other sites

I've actually already made something very very similar to what you describe.

Sectors are really simple to use. You place a trigger (anybody, present) the size that you want the sector to be. Sync the trigger to an Area module (found in Systems >> logic entities >> Locations). Sync the Area module to the sector module. Sync the sector module to the sides (found in Systems >> logic entities >> sides) that you would like to be able to capture it. 

More on sectors here: https://community.bistudio.com/wiki/Arma_3_Module:_Sector

Done, you have a sector that can be captured. Configure the sector a bit more by setting the expression. In each sector I use the expression field to set a global variable equal to the controlling side.

cp1Stat = _this select 1;

Now things get a bit trickier. I have a game logic entity that calls a script to manage the game. This script keeps track of both sides tickets and every group in both sides via arrays. Based on the cp1Stat global variable I get each group within the groups array and give them a Search and Destroy way point within the size of the sector. You can get the location of the sector by naming the sector trigger and then calling "position triggerName". I have this code run once every 10 seconds to try and update the waypoints for all units on the map.

 

//WEST
	if(countBlufor1 < 7 && countOpfor2 > 7 && isNil "wguardGroup1") then{
		wguardGroup1 = wGroups call BIS_fnc_selectRandom;
		if(!isNil "wguardGroup1") then {
		deleteWaypoint ((waypoints wguardGroup1) select 0);
		deleteWaypoint ((waypoints wguardGroup1) select 0);
		_wp = wguardGroup1 addWaypoint [position obj1, 90];
		_wp setWaypointType "GUARD";
		wGroups = wGroups - [wguardGroup1]; };
	};
	if(cp1Stat == west) then 
	{
		if(cp2Stat == west) then 
		{
			{
			if(((waypointPosition ((waypoints _x) select 0)) distance (position obj3)) > 91) then {
				deleteWaypoint ((waypoints _x) select 0);
				_wp = _x addWaypoint [position obj3, 90];
				_wp setWaypointType "SAD";};} forEach wGroups;
		} 
		else 
		{
			{
			if(((waypointPosition ((waypoints _x) select 0)) distance (position obj2)) > 91) then {
				deleteWaypoint ((waypoints _x) select 0);
				_wp = _x addWaypoint [position obj2, 90];
				_wp setWaypointType "SAD";};} forEach wGroups;
		};
	}
	else
	{
			{
			if(((waypointPosition ((waypoints _x) select 0)) distance (position obj1)) > 91) then {
				deleteWaypoint ((waypoints _x) select 0);
				_wp = _x addWaypoint [position obj1, 90];
				_wp setWaypointType "SAD";};} forEach wGroups;
	};

I am able to keep track of all the groups because they are spawned by code as well. If you manually placed the groups you might just need to hardcode an array of the groups or something.

As far as tickets go I don't know as much about the default system. I just decrement some global variables as more units are spawned and utilize them as tickets. I'm aware Arma has some built in accessible ticket system but rolling my own seemed a bit easier.

If you are interesting in playing this mission or would just like the code, it currently only works in singleplayer, but I could send it to you. Hope this helps get you in the right direction, its a very fun and rewarding project.

  • Like 1

Share this post


Link to post
Share on other sites

I wouldn't mind having a look at how the mission works, but personally I think I'm probably going to make use of the native ticket system as it seems pretty robust.

I have a general idea of how to achieve most things in the mission, its really only on the the point of getting the sectors to unlock in a linear fashion as a result of a previous sector's capture that I'm at a loss.

Share this post


Link to post
Share on other sites

I wouldn't mind having a look at how the mission works, but personally I think I'm probably going to make use of the native ticket system as it seems pretty robust.

I have a general idea of how to achieve most things in the mission, its really only on the the point of getting the sectors to unlock in a linear fashion as a result of a previous sector's capture that I'm at a loss.

If you just mark all sectors as default owned by opfor you can have blufor spawn closest to a specific one and tell them to attack that one. Next if capturing them linearly is important I've got an idea.

On init call "enableSimulation false" on all but the first sector. Then utilize the expression field of the sectors to "enableSimulation true" on the next sector module after one is captured. According to https://community.bistudio.com/wiki/Arma_3_Module:_Sector disabling the simulation prevents its capture. I haven't tried this but it should work.

Share this post


Link to post
Share on other sites

Alright, I'll try doing something with that. Is there a way to check a sector or object in general has enabled simulation? (for the purposes of using its state in other scripts)

Share this post


Link to post
Share on other sites

I've encountered a few problems with this method.

Firstly, when unsimulated, the sectors are invisible.

Secondly, when attempting to enable their simulation in-mission from an unsimulated state, they don't become visible.

 

Additionally, I'd like sectors to become 'locked' after ownership has changed, similarly to the attack-defend sectors in Zeus.

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

×