Jump to content
Sergeant_Emerald

Troubles with enableAI "Move"

Recommended Posts

Hi, I'm about to make a mission preset to help my friends get better in Arma. The thing i want to get working is a guy with this disableAi "move" in its init and an

this addAction ["finish the mission","end_mission.sqf"];

running:

_unit = _this select 0;
_action = _this select 2;
hint "We have done our job for today, lets prepare for tomorrow!";
_unit removeaction _action;
_unit enableAI "Move";

to get him walking to a waypoint placed in a triggerbox what ends the mission. 

In singleplayer and running a server on my computer is working good, but loading the mission on a dedicated will end up everything is working, but not enableAI.
Do you know a fix for this?
 

Share this post


Link to post
Share on other sites

@Sergeant_Emerald,

You can do this,
 

Spoiler

this addAction ["Complete the Mission"," 
_unit = _this select 0; 
_action = _this select 2; 
_unit sideChat ""We have done our job for today, lets prepare for tomorrow!""; 
_unit removeaction _action; 
_unit enableAI ""MOVE""; 
"];

but I'd suggest,
 


you_mission_complete=[ this, "Complete the Mission",    
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",    
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",    
"isNull objectParent _this", "alive _this", {}, {}, {  
_unit = _this select 0;  
_unit sideChat "That's it for today. Let's prepare for tomorrow!";  
_unit removeaction you_mission_complete;  
_unit enableAI "MOVE";  
   }, {}, [], 2, 0, false, true] call BIS_fnc_holdActionAdd; 

 

have fun!

  • Like 3

Share this post


Link to post
Share on other sites

Hi,

thanks for your fast answer,

I tried the addaction you send, same problem again.

and where do i put the otherone?

greedings

Share this post


Link to post
Share on other sites

@Sergeant_Emerald,

Quote

I tried the addaction you send, same problem again.


And the problem is that the unit does not proceed to a waypoint?

Perhaps I misunderstood the original question.

This will make "dude" move to "endMARK" upon activation,
 

Spoiler

you_mission_complete=[ this, "Complete the Mission",    
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",    
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",    
"isNull objectParent _this", "alive dude", {}, {}, {  
_unit = dude;
_unit sideChat "That's it for today. Let's prepare for tomorrow!";  
player removeaction you_mission_complete;  
_unit enableAI "MOVE";
_wp =(group _unit) addWaypoint [position endMARK, 0];
   }, {}, [], 2, 0, false, true] call BIS_fnc_holdActionAdd; 

Paste this action into player's init. Configure "Dude" and place "endMARK" in editor (signs/helpers).

Have fun!

  • Like 2

Share this post


Link to post
Share on other sites

okay,

now i added the guy to my group with the ace interactions menu while the mission played. And as i used the addaction he started walking, but not to the waypoint, just to the formation. So the actual problem is not the enableAI "move" as i expected, its the waypoint after reenableing "move".

Now i put 

3 hours ago, wogz187 said:

you_mission_complete=[ this, "Complete the Mission", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "isNull objectParent _this", "alive dude", {}, {}, { _unit = dude; _unit sideChat "That's it for today. Let's prepare for tomorrow!"; player removeaction you_mission_complete; _unit enableAI "MOVE"; _wp =(group _unit) addWaypoint [position endMARK, 0]; }, {}, [], 2, 0, false, true] call BIS_fnc_holdActionAdd;

in the init and configured the code to get it working. Like i said, if the join group thing doesn't overwrite DisableAI "move", thats not the problem, seems to be Disableai keeps blocking the movement.
Thanks for your help so far, when there are ohter options than disalbe and enableAI "move" i guess i could also use them.

Share this post


Link to post
Share on other sites

@Sergeant_Emerald,
We can fix that,
 

Spoiler

you_mission_complete=[ this, "Complete the Mission",    
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",    
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",    
"isNull objectParent _this", "alive dude", {}, {}, {  
_unit = dude;
_unit join grpNull;  
_unit enableAI "MOVE";
_unit sideChat "That's it for today. Let's prepare for tomorrow!";
_wp =(group _unit) addWaypoint [position endMARK, 0];
player removeaction you_mission_complete; 
   }, {}, [], 2, 0, false, true] call BIS_fnc_holdActionAdd; 

This should fix/force "dude" to move.

Have fun!

  • Like 1

Share this post


Link to post
Share on other sites

well now i am just getting

_unit = Pettka;
_unit |#|joing grpNull;
_unit enableAI "MOVE"; ...'
Error join: Type Object, expected Array

as a script error. 

Share this post


Link to post
Share on other sites

yeah, i'm sorry, it was a typo while i wrote the errormessage down here, so there is actually 

_unit = Pettka;
_unit |#|join grpNull;
_unit enableAI "MOVE"; ...'
Error join: Type Object, expected Array

so its not in the init, its just in the post here. still won't work..

Share this post


Link to post
Share on other sites

nah, wont work. He get's the right waypoint, but still won't walk till i join his group and order him to get there via the f1 menu.

Share this post


Link to post
Share on other sites

@Sergeant_Emerald,

Tested to work,

Spoiler



you_mission_complete=[ this, "Complete the Mission",    
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",    
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",    
"isNull objectParent _this", "alive dude", {}, {}, {  
_unit = dude;
[_unit] join grpNull;  
_unit enableAI "MOVE";
_unit sideChat "That's it for today. Let's prepare for tomorrow!";
_wp =(group _unit) addWaypoint [position endMARK, 0];
player removeaction you_mission_complete; 
   }, {}, [], 2, 0, false, true] call BIS_fnc_holdActionAdd; 

player init dialog

 

* Dude has init properties:
this disableAI "Move"
* Dude is in a group

If that still doesn't work perhaps,

Spoiler

you_mission_complete=[ this, "Complete the Mission",    
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",    
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",    
"isNull objectParent _this", "alive dude", {}, {}, {  
_unit = dude;
[_unit] join grpNull;  
_unit enableAI "MOVE";
_unit sideChat "That's it for today. Let's prepare for tomorrow!";

_group = group _unit;
for "_i" from count waypoints _group - 1 to 0 step -1 do
{
	deleteWaypoint [_group, _i];
};

_wp =(group _unit) addWaypoint [position endMARK, 0];
player removeaction you_mission_complete; 
   }, {}, [], 2, 0, false, true] call BIS_fnc_holdActionAdd;

 

Have fun!

  • Like 1

Share this post


Link to post
Share on other sites

Hi, i thougt about the problem, wouldn't work it if we just give him no waypoint at first and just tell him on the use of the addaction to go to the point?
So i tried this, but it didn't.
 

you_mission_complete=[ this, "Complete the Mission",    
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",    
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",    
"isNull objectParent _this", "alive dude", {}, {}, {  
_unit = dude;
_unit sideChat "That's it for today. Let's prepare for tomorrow!";
_wp =(group _unit) addWaypoint [position endMARK, 0];
player removeaction you_mission_complete; 
   }, {}, [], 2, 0, false, true] call BIS_fnc_holdActionAdd; 

Am i doing something wrong here?

Share this post


Link to post
Share on other sites

The likely reason enableAI did not work on dedicated is that the command has to be run where the unit is local.

 

addAction runs local to the client (player).  When AI is a one-man group (i.e., leader of his own group) the AI is local to the server.  In singleplayer and MP hosted, the host client is also the server, and the command run in addAction will work there.  With dedicated server they are not local to client, so the command fails, it has to be run by server.

 

But in the event locality of the unit is in question, best to just remoteex using the _unit as the target, then the enableAI command will run wherever the unit is local, whether server or client.

Multiplayer Scripting

remoteExec

remoteExecCall

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

Like opusfmspol says, the effect of an addAction script is local to the client who performs the action.

 

Compared to your first post you can try this in your end_mission.sqf :

_unit = _this select 0;
_action = _this select 2;

hint "We have done our job for today, lets prepare for tomorrow!"; // hint here for only hint on the action user

[[_unit, _action],{
	params ["_unit", "_action"];

	//hint "We have done our job for today, lets prepare for tomorrow!"; // hint here for all players
	_unit removeAction _action;
	_unit enableAI "MOVE";

}] remoteExecCall ["call", 0];

 

  • Like 2

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

×