Sign in to follow this  
Followers 0
Stoll

disableAI "MOVE";

3 posts in this topic

Folks, this is causing me a headache for hours now...
I want a group of bandits STAND STILL at their positions, a few do others seem to follow gunshots around.

I added all possible for AI idling...but I cannot find the error.

That's what I'm using:
 

//Group 0, 2 Units
_group0 = createGroup east;
//_group0 setBehaviour "AWARE";
//_group0 setCombatMode "YELLOW";
	_unit1 = _group0 createUnit ["O_helicrew_F",_spawn1,[],0,"FORM"];
		if (isNull _unit1) then {
			_unit1 = createVehicle ["O_helicrew_F",_spawn1,[],0,"FORM"];
 			createVehicleCrew _unit1;
		};
		(group _unit1) selectLeader _unit1;
		if(_spawn1 isEqualTo [4985.39,6605.01,21.784275]) then
			{
			_unit1 setDir 354;
			}
		else
			{
			_unit1 setDir 312.57;
			};
		_unit1 setPosATL _spawn1;
		_unit1 disableAI "TARGET";
		_unit1 disableAI "MOVE";
		doStop _unit1;
		_unit1 setunitpos "MIDDLE";
		_unit1 setSkill 0.5;
		[_unit1] joinSilent _group0;
		
	_unit2 = _group0 createUnit ["O_helicrew_F",_spawn2,[],0,"FORM"];
		if (isNull _unit2) then {
			_unit2 = createVehicle ["O_helicrew_F",_spawn2,[],0,"FORM"];
 			createVehicleCrew _unit2;
		};
		(group _unit2) selectLeader _unit2;
		if(_spawn2 isEqualTo [4995.20,6621.33,14.0353737]) then
			{
			_unit2 setDir 269.36;
			}
		else
			{
			_unit2 setDir 91.26;
			};
		_unit2 setPosATL _spawn2;
		_unit2 disableAI "TARGET";
		_unit2 disableAI "MOVE";
		doStop _unit2;
		_unit2 setunitpos "MIDDLE";		
		_unit2 setSkill 0.3;
		[_unit2] joinSilent _group0;
		
//Group 1, 2 Units
_group1 = createGroup east;
//_group1 setBehaviour "AWARE";
//_group1 setCombatMode "YELLOW";
	_unit3 = _group1 createUnit ["O_helicrew_F",_spawn3,[],0,"FORM"];
		if (isNull _unit3) then {
			_unit3 = createVehicle ["O_helicrew_F",_spawn3,[],0,"FORM"];
 			createVehicleCrew _unit3;
		};
		(group _unit3) selectLeader _unit3;
		if(_spawn3 isEqualTo [4965.70,6623.56,17.66398]) then
			{
			_unit3 setDir 90.63;
			}
		else
			{
			_unit3 setDir 176.45;
			};
		_unit3 setPosATL _spawn3;
		_unit3 disableAI "TARGET";
		_unit3 disableAI "MOVE";
		doStop _unit3;
		_unit3 setunitpos "AUTO";			
		_unit3 setSkill 0.5;
		[_unit3] joinSilent _group1;
		
	_unit4 = _group1 createUnit ["O_helicrew_F",_spawn4,[],0,"FORM"];
		if (isNull _unit4) then {
			_unit4 = createVehicle ["O_helicrew_F",_spawn4,[],0,"FORM"];
 			createVehicleCrew _unit4;
		};
		(group _unit4) selectLeader _unit4;
		if(_spawn4 isEqualTo [4969.56,6612.44,23.700901]) then
			{
			_unit4 setDir 0.94;
			}
		else
			{
			_unit4 setDir 86.96;
			};
		_unit4 setPosATL _spawn4;
		_unit4 disableAI "TARGET";
		_unit4 disableAI "MOVE";
		doStop _unit4;
		_unit4 setunitpos "AUTO";		
		_unit4 setSkill 0.3;
		[_unit4] joinSilent _group1;
		
//Group 2, 4 Units
_group2 = createGroup east;
//_group2 setBehaviour "AWARE";
//_group2 setCombatMode "YELLOW";
	_unit5 = _group2 createUnit ["O_helicrew_F",[4978.87,6648.70,11.389277],[],0,"FORM"];
		if (isNull _unit5) then {
			_unit5 = createVehicle ["O_helicrew_F",[4978.87,6648.70,11.389277],[],0,"FORM"];
 			createVehicleCrew _unit5;
		};
		(group _unit5) selectLeader _unit5;
		_unit5 setDir 285.69;
		_unit5 setPosATL [4978.87,6648.70,11.389277];
		_unit5 disableAI "TARGET";
		_unit5 disableAI "MOVE";
		doStop _unit5;
		_unit5 setunitpos "AUTO";		
		_unit5 setSkill 0.5;
		[_unit5] joinSilent _group2;
		
	_unit6 = _group2 createUnit ["O_helicrew_F",[4994.75,6632.70,14.704557],[],0,"FORM"];
		if (isNull _unit6) then {
			_unit6 = createVehicle ["O_helicrew_F",[4994.75,6632.70,14.704557],[],0,"FORM"];
 			createVehicleCrew _unit6;
		};
		(group _unit6) selectLeader _unit6;
		_unit6 setDir 230;
		_unit6 setPosATL [4994.75,6632.70,14.704557];
		_unit6 disableAI "TARGET";
		_unit6 disableAI "MOVE";
		doStop _unit6;
		_unit6 setunitpos "AUTO";	
		_unit6 setSkill 0.3;
		[_unit6] joinSilent _group2;
		
	_unit7 = _group2 createUnit ["O_helicrew_F",[4981.39,6609.85,17.109118],[],0,"FORM"];
		if (isNull _unit7) then {
			_unit7 = createVehicle ["O_helicrew_F",[4981.39,6609.85,17.109118],[],0,"FORM"];
 			createVehicleCrew _unit7;
		};
		(group _unit7) selectLeader _unit7;
		_unit7 setDir 341.75;
		_unit7 setPosATL [4981.39,6609.85,17.109118];
		_unit7 disableAI "TARGET";
		_unit7 disableAI "MOVE";
		doStop _unit7;
		_unit7 setunitpos "AUTO";		
		_unit7 setSkill 0.4;
		[_unit7] joinSilent _group2;
		
	_unit8 = _group2 createUnit ["O_helicrew_F",[4983.15,6611.83,17.357254],[],0,"FORM"];
		if (isNull _unit8) then {
			_unit8 = createVehicle ["O_helicrew_F",[4983.15,6611.83,17.357254],[],0,"FORM"];
 			createVehicleCrew _unit8;
		};
		(group _unit8) selectLeader _unit8;
		_unit8 setDir 313.78;
		_unit8 setPosATL [4983.15,6611.83,17.357254];
		_unit8 disableAI "TARGET";
		_unit8 disableAI "MOVE";
		doStop _unit8;
		_unit8 setunitpos "AUTO";		
		_unit8 setSkill 0.4;
		[_unit8] joinSilent _group2;

I also tried disableAI "AUTOTARGET"; instead with the same result. :|

Share this post


Link to post
Share on other sites

i believe this boils down to which combatmode your group is in, in your case "YELLOW" which is the default if not defined. (https://community.bistudio.com/wiki/2D_Editor:_Waypoints#Combat_Mode)

do you want them to engage enemies but stand still?

 

also, consider using functions when doing repetetive tasks, like when you create your ai:

_fnc_spawnUnit = {
	_group = _this select 0;
	_pos = this select 1;
	_spawnpos = this select 2;
	_dir1 = this select 3;
	_dir2 = this select 4;
	_skill = this select 5;

	_unit = _group createUnit ["O_helicrew_F",_spawnpos,[],0,"FORM"];
		if (isNull _unit) then {
			_unit = createVehicle ["O_helicrew_F",_spawnpos,[],0,"FORM"];
 			createVehicleCrew _unit;
		};
		(group _unit) selectLeader _unit;
		if(_spawnpos isEqualTo _pos) then
			{
			_unit setDir _dir1;
			}
		else
			{
			_unit setDir _dir2;
			};
		_unit setPosATL _spawn4;
		_unit disableAI "TARGET";
		_unit disableAI "MOVE";
		doStop _unit;
		_unit setunitpos "AUTO";		
		_unit setSkill _skill;
		[_unit] joinSilent _group; //No need really since _unit is already in _group??
};


//and to create unit, simpy call the function:
_unit1 = [_group,_pos,_spawnpos,_dir1,_dir2,_skill] call _fnc_spawnUnit;
_unit2 = [_group,_pos,_spawnpos,_dir1,_dir2,_skill] call _fnc_spawnUnit;

the above will most certainly contain both syntax errors and "too little coffee" errors, but you get the idea. 

 

also, out of curiousity, why this?

		if (isNull _unit7) then {
			_unit7 = createVehicle ["O_helicrew_F",[4981.39,6609.85,17.109118],[],0,"FORM"];
 			createVehicleCrew _unit7;
		};

Share this post


Link to post
Share on other sites

you can ofcourse make your function more generic and add things specific to that AI later like 

_unit1 = [_group,_pos,_spawnpos,_dir1,_dir2,_skill] call _fnc_spawnUnit;
(group _unit1) selectleader _group1;

 

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  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.