Jump to content

Recommended Posts

Hi all, i want to activate this 'rush' script on zeus units. To get the ai to rush a beachhead aggressively and not stopped by enemy fire. Is there anyway to bring up the init box in zeus so i can use the code on zeus units?

 

the code: 

_x doMove getpos target;   
_x setspeedmode "FULL";   
_x setbehaviour "SAFE";   
_x setskill ["spotDistance",0.1];   
_x setskill ["spotTime",0.1];   
_x setskill ["courage",1];   
_x setskill ["commanding",0.1];
}forEach units group this;

Share this post


Link to post
Share on other sites

maybe something like this, add to initplayerlocal.sqf

 

// on the zeus clients machine
if (!isNull (getAssignedCuratorLogic player)) then {
	(getAssignedCuratorLogic player) addEventHandler [
		'curatorWaypointPlaced',
		{
			params ['_module','_group','_waypointIndex'];
			private _unit = objNull;
			_waypointPosition = waypointPosition [_group,_waypointIndex];
			{
				_unit = _x;
				{
					_unit forgetTarget _x;
				} forEach (_unit targets [TRUE,300]);
				_unit doMove _waypointPosition;
				_unit setspeedmode "FULL";   
				_unit setbehaviour "CARELESS";   
				_unit setskill ["spotDistance",0.1];   
				_unit setskill ["spotTime",0.1];   
				_unit setskill ["courage",1];   
				_unit setskill ["commanding",0.1];
			} forEach (units _group);
			if (local _group) then {
				if (isNil {_group getVariable 'tag_group_zerg_script'}) then {
					_group setVariable ['tag_group_zerg_script',scriptNull,FALSE];
				};
				if (isNull (_group getVariable ['tag_group_zerg_script',scriptNull])) then {
					_zerg_script = [_group,_waypointPosition] spawn {
						params ['_group','_waypointPosition'];
						private _unit = objNull;
						_t = time + 180;
						waitUntil {
							sleep 10;
							{
								_unit = _x;
								{
									_unit forgetTarget _x;
								} forEach (_unit targets [TRUE,300]);
								_unit doMove _waypointPosition;
								_unit setspeedmode "FULL";   
								_unit setbehaviour "CARELESS";
							} forEach (units _group);
							(
								(({(alive _x)} count (units _group)) isEqualTo 0) ||
								(time > _t)	||
								(!local _group) ||
								(((leader _group) distance2D _waypointPosition) < 10) ||
								(((waypoints _group) isEqualTo []) || {(((waypointPosition [_group,(currentWaypoint _group)]) distance2D _waypointPosition) > 30)})
							)
						};
					};
					_group setVariable ['tag_group_zerg_script',_zerg_script,FALSE];
				};
			};
		}
	];
};

 

 

I added in a few goodies as well, to enhance the "rush" aggression :)

 

how to use:

 

Give the squad a waypoint in zeus, they will charge the waypoint. will only work on groups spawned by that zeus.

 

How to terminate: 

 

Delete all the groups waypoints, or move the waypoint somewhere else

  • Like 2

Share this post


Link to post
Share on other sites
4 hours ago, fn_Quiksilver said:

maybe something like this, add to initplayerlocal.sqf

 


// on the zeus clients machine
if (!isNull (getAssignedCuratorLogic player)) then {
	(getAssignedCuratorLogic player) addEventHandler [
		'curatorWaypointPlaced',
		{
			params ['_module','_group','_waypointIndex'];
			private _unit = objNull;
			_waypointPosition = waypointPosition [_group,_waypointIndex];
			{
				_unit = _x;
				{
					_unit forgetTarget _x;
				} forEach (_unit targets [TRUE,300]);
				_unit doMove _waypointPosition;
				_unit setspeedmode "FULL";   
				_unit setbehaviour "CARELESS";   
				_unit setskill ["spotDistance",0.1];   
				_unit setskill ["spotTime",0.1];   
				_unit setskill ["courage",1];   
				_unit setskill ["commanding",0.1];
			} forEach (units _group);
			if (local _group) then {
				if (isNil {_group getVariable 'tag_group_zerg_script'}) then {
					_group setVariable ['tag_group_zerg_script',scriptNull,FALSE];
				};
				if (isNull (_group getVariable ['tag_group_zerg_script',scriptNull])) then {
					_zerg_script = [_group,_waypointPosition] spawn {
						params ['_group','_waypointPosition'];
						private _unit = objNull;
						_t = time + 180;
						waitUntil {
							sleep 10;
							{
								_unit = _x;
								{
									_unit forgetTarget _x;
								} forEach (_unit targets [TRUE,300]);
								_unit doMove _waypointPosition;
								_unit setspeedmode "FULL";   
								_unit setbehaviour "CARELESS";
							} forEach (units _group);
							(
								(({(alive _x)} count (units _group)) isEqualTo 0) ||
								(time > _t)	||
								(!local _group) ||
								(((leader _group) distance2D _waypointPosition) < 10) ||
								(((waypoints _group) isEqualTo []) || {(((waypointPosition [_group,(currentWaypoint _group)]) distance2D _waypointPosition) > 30)})
							)
						};
					};
					_group setVariable ['tag_group_zerg_script',_zerg_script,FALSE];
				};
			};
		}
	];
};

 

 

I added in a few goodies as well, to enhance the "rush" aggression :)

 

how to use:

 

Give the squad a waypoint in zeus, they will charge the waypoint. will only work on groups spawned by that zeus.

 

How to terminate: 

 

Delete all the groups waypoints, or move the waypoint somewhere else

 

Wow, thanks so much man for this detailed script!

So i just put this as a .sqf into the mission folder, then it will work whenever i press play in eden editor and go to zeus?  

Since it's supposed to work for blufor i need to change the curator's name to the blufor zeus's name right (my zeus is a civilian that control both sides)? I'm sorry but i have little to no scripting skills outside of init boxes haha

Share this post


Link to post
Share on other sites

yep as long as its executed/initialized after the mission starts it will work. I tested the code in the editor, I used the debug console to execute, but inside an init field might work. I would spawn it if its in an init box though.. like this:

 

0 = [] spawn {

        sleep 3;

... <paste it all here>

 

 

};

Share this post


Link to post
Share on other sites
3 hours ago, fn_Quiksilver said:

yep as long as its executed/initialized after the mission starts it will work. I tested the code in the editor, I used the debug console to execute, but inside an init field might work. I would spawn it if its in an init box though.. like this:

 

0 = [] spawn {

        sleep 3;

... <paste it all here>

 

 

};

So if i put it in the unit's init it will work whenever i assign it a waypoint? 

 

I thought i could use the debug console to activate scripts but have no idea how, since zeus (even with ares achilles) i can't open the init box for infantry groups. Is there something i need to type before i run a script in the debug console (i only play it in editor not in a server)?

 

Just to make sure can notepad save this script as a .sqf file? Sorry im pretty ignorant when it comes to arma script apart from changing something in notepad haha 

 

And again many thanks for this detailed script and your assistance

 

Share this post


Link to post
Share on other sites

if you have zeus and debug console and you're in the editor you can just paste the whole thing in and it will work

    

dont paste the top line though, starting with // 

 

every line below the one starting with //

  • Like 1

Share this post


Link to post
Share on other sites
On 2017-5-29 at 0:42 PM, fn_Quiksilver said:

if you have zeus and debug console and you're in the editor you can just paste the whole thing in and it will work

    

dont paste the top line though, starting with // 

 

every line below the one starting with //

 

Hope this isn't necroed yet, managed to ran a proper test today in virtual reality and it seems the waypoints sets the unit to move at careless even if i adjust the script to have it at safe?

They wouldn't bother return fire and i think on my 'beach' map they would start to retreat while always resetting their behaviour to ''çareless'' once the waypoints are gone in front of enemies.

 

I hope you know what might be needed quiksilver as perhaps the game may only function properly with the old shorter init script with the preplaced object (they responded to fire while moving)? 

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  

×