johnnyboy 3793 Posted March 30, 2022 I have a strange problem where AI in player squad won't follow player (who is leader) when player selects ALL - Return To Formation. The AI won't move. But the AI will obey a Move to cursor position command or any other command. The AI is playable. And if I switch to that AI make the AI I switched into leader, then the other AI (formerly player) will follow me perfectly. If I switch back into original player unit, I have the same problem again. I have tried all of the following to force the unit recognize player as leader: (units group player) dofollow leader group player; bob doFollow player; (group player) selectLeader player; [bob] join grpNull; [bob] join group player; None of the above make the AI unit bob respond to the "All - Return to Formation" command. He will not follow the player, but obey all other commands. I also checked that leader and formationLeader for Bob, and both show player as leader. What the hell? I'm working on some AI related scripts, where player can switch among units in squad, and is always set to Leader when switched into new unit. Player can also be revived from unconscious state, and will then be set to leader again. Somehow the subordinate AI gets confused. Any ideas? Share this post Link to post Share on other sites
madrussian 347 Posted March 30, 2022 Interesting problem. What are you doing prior to: 34 minutes ago, johnnyboy said: I have a strange problem where AI in player squad won't follow player (who is leader) when player selects ALL - Return To Formation. The AI won't move. But the AI will obey a Move to cursor position command or any other command. The AI is playable. Sounds like everything that follows are things you tried to get him responsive again? Edit: In other words, what gets him unresponsive in the first place? Share this post Link to post Share on other sites
johnnyboy 3793 Posted March 30, 2022 5 minutes ago, madrussian said: Sounds like everything that follows are things you tried to get him responsive again? Too much to describe...haha. But that is perceptive, as I'm isolating it that way right now. Note that this doesn't work either: bob enableAI "ALL"; Share this post Link to post Share on other sites
madrussian 347 Posted March 30, 2022 I recall having an unresponsive AI after selectPlayer to another AI. In that case, the guy that was under player control and had now reverted to AI control (due to the selectPlayer), was somehow unresponsive after that. Seems like maybe he wasn't moving at all anymore (which wouldn't be an exact match for your issue, but still could be related). Sadly I also don't recall if this was a player group thing or not. Then years or months later, I saw (here on the forums) people discussing what appeared to be my exact same problem and a solution (though of course by then I'd moved on). Something about one of the enableAI components helps to get AI moving again after AI control being bestowed upon them by way of selectPlayer vacating player control of them. I'll try to find that discussion thread. Meanwhile I did find this under enableAI description (which I'm sure you probably noticed already): Quote When player switches and leaves behind AI unit, you need to enable "TeamSwitch" AI on it _unit enableAI "TeamSwitch" so that the unit continues with waypoints Maybe instead of: bob enableAI "ALL"; Try something like: bob disableAI "TEAMSWITCH"; sleep 2; bob enableAI "TEAMSWITCH"; Or alternately, does his unresponsiveness not arise in any way from player control leaving him (via selectPlayer)? If no selectPlayer is involved in getting him unresponsive in the first place, I'm probably barking up the wrong tree. Share this post Link to post Share on other sites
johnnyboy 3793 Posted March 30, 2022 22 minutes ago, madrussian said: Or alternately, does his unresponsiveness not arise in any way from player control leaving him (via selectPlayer)? If no selectPlayer is involved in getting him unresponsive in the first place, I'm probably barking up the wrong tree. Thanks for the input. That Teamswitch tip will probably come in handy later. I solved my problem. I was doing the following in an EachFrame eventHandler and that made the units unresponsive to following player...no idea why. But once I removed the line below all is well again. _unit doFollow (leader group _unit); 1 Share this post Link to post Share on other sites