Jump to content
Sign in to follow this  
Tucker.W

AttachTo effects AI [Plz Help]

Recommended Posts

So I have a unit that I attached an object about a bit bigger than the size of said unit using the following command (var names are different and local):
 

object attachTo [unit, [0,-1,1.2]];


I also have a script that forces said unit to run at targets similar to a zombie script:
 

while(alive _target && ...) do {
	/*Some code stuff/conditional unrelated to problem*/
	doMove (getPosATL _target);
	uiSleep 0.1;
};

 

After this is done, the unit seems to go nowhere near the target. Sometimes it runs away from it. When it doesn't have the object attached, the unit seems to run straight at the target without hesitation. I used these commands to try and fix but none of them seem to fix the main problem:
 

unit disableAI "AUTOTARGET";
unit disableAI "TARGET";
unit disableAI "COVER";
unit disableAI "FSM";
unit disableAI "SUPPRESSION";
unit disableAI "AIMINGERROR";
unit disableAI "AUTOCOMBAT";

unit setSkill ["commanding", 1];
unit setSkill ["courage", 1];
unit setBehaviour "CARELESS";
unit enableFatigue false;
unit setunitpos "UP";
unit allowFleeing 0;
unit addRating -2000;
(group unit) setSpeedMode "FULL";

object disableCollisionWith unit;
object enableDynamicSimulation unit;

/*attachTo command then while loop*/


The only thing I found that works somewhat better is changing the unit to an agent. However, the same issue is there, it just follows the waypoint command slightly better. The other issue with that is that I'm trying to make this a unit mod and an agent wouldn't work well with it. 

TLDR: attachTo command is effecting the efficiency of the effected ai's pathfinding. I need a way to get it to ignore said object. 

Share this post


Link to post
Share on other sites
2 hours ago, Tucker.W said:

 

TLDR: attachTo command is effecting the efficiency of the effected ai's pathfinding. I need a way to get it to ignore said object. 

 

What object are you attaching? I've been attaching plenty of stuff to AI, never had any issue with pathfinding or effects on behaviour.

We're gonna need more details or code to help you mate.

Share this post


Link to post
Share on other sites
1 hour ago, haleks said:

 

What object are you attaching? I've been attaching plenty of stuff to AI, never had any issue with pathfinding or effects on behaviour.

We're gonna need more details or code to help you mate.

I've been using a third party addon with a single lod for the model and no geometry. However, I have seen this happen with things as small as cans to sofas to as big as construction buildings. 

When I have the attachTo command used in my script, the ai doesn't chase the target. When it has the attachTo command commented out, the ai chases the target without hesitation. 

This is not the exact code however this provides the same issue: 

 

/*******************************
unit = begger placed in editor
thing = sofa prop placed in editor
*******************************/

unit disableAI "TARGET"; 
unit disableAI "COVER"; 
unit disableAI "FSM"; 
unit disableAI "SUPPRESSION"; 
unit disableAI "AIMINGERROR"; 
unit disableAI "AUTOCOMBAT"; 
 
unit setSkill ["commanding", 1]; 
unit setSkill ["courage", 1]; 
unit setBehaviour "CARELESS"; 
unit enableFatigue false; 
unit setunitpos "UP"; 
unit allowFleeing 0; 
unit addRating -2000; 
(group unit) setSpeedMode "FULL";

thing attachTo [unit, [0,-1,1.2]]; //this seems to be causing the problem

while{alive player} do { 
	unit doMove (getPosATL player); 
	uiSleep 0.1; //this only helps when at higher numbers, however, i need unit to chase player
};

yes I know the vars should be local but I typed this up rather quickly and didn't want to deal with params

I can see where you are coming from that attachTo doesn't affect single waypoints, however, when told to chase the unit doesn't like it and bugs out. Either by running past the player or from it. 

I need the  uiSleep 0.1 so unit chases player. If it is a large number, though my issue is sort of resolved (but not really as it still hiccups a little), it doesn't chase the player if the player just runs from it. There are also other conditionals above the doMove that need to be ran at the same speed (for example say I need to switch targets or get unit to stop).  

My guess is that there is some sort of way to get AI to ignore props or something. I know that if I use hideObject on the prop the unit will function as normal, but I need the prop to be visible to all players. I also know that AI ignore props inside of buildings; ie they will follow specific waypoints without a care in the world for collision detection. I've looked all over the A3 commands and several forum posts and some testing on my own in order to figure this out. This forum is pretty much my last resort. 

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  

×