The Zoteboat 1 Posted December 17, 2023 Hey there, I am looking for a simple way to stop the player (in the gunner's position) from giving orders to an AI driver when pressing the WASD keys (the good old "forward", "left" etc.) I have created a simple convoy mission, everything works fine (the vehicles follow each other, stay where they are meant to stay, stop at the correct place etc.), but pressing one of the aforementioned keys immediately switches the control of the vehicle to the player in the gunner position, the AI driver completely stops following the vehicle in front and the whole mission is thrown off. I have tried googling it but the solutions either did not work (like giving the AI a higher rank than the player) or were completely incomprehensible for a newbie like me. Unfortunately, just not pressing the WASD keys is not a solution as I play with people who think it is hilarious to always ram other vehicles like it's top gear. Any help would be appreciated. TL;DR : need help stopping the player in the gunner position from commandeering a vehicle driven by an AI Share this post Link to post Share on other sites
Play3r 147 Posted December 17, 2023 maybe you can use thishttps://community.bistudio.com/wiki/disableUserInput but also means that the player can not get out or anything else. Share this post Link to post Share on other sites
The Zoteboat 1 Posted December 17, 2023 Ah. Unfortunately that is not really viable What I'm going for is a mission that resembles the start of the MW2 campaign, where you have to drive through an area full of hostile forces while attempting to gun them down, so user input is very much necessary (at least shooting and dismounting). Share this post Link to post Share on other sites
honger 114 Posted December 17, 2023 Have you tried this command: https://community.bistudio.com/wiki/setEffectiveCommander? I used it to not allow player command an AI-driven vehicle from SOG while in front passenger sit and it worked. Alternatively you can just script your driving through https://community.bistudio.com/wiki/setDriveOnPath. This will make AI drive from marker to marker and should ignore user commands and FSMs. Share this post Link to post Share on other sites
The Zoteboat 1 Posted December 17, 2023 Thanks for your reply, Do you know a simple tutorial about how to include a script in a scenario? I gotta admit I don't really get it lol Share this post Link to post Share on other sites
honger 114 Posted December 17, 2023 the first one you can put either in vehicle's attributes (RMB -> Attributes -> Init field) or in init of your mission Attributes -> General (if it's multiplayer environment you should create an initPlayerLocal.sqf file in your mission folder (where your mission.sqm is) and put it there, since the setEffectiveCommander is executed locally -> per user). Not sure about 2nd one, in multiplayer it should be in initServer.sqf I guess, I'm a rather singleplayer-oriented person. If you end up using the 1st one, make sure to give the vehicle and its driver variable names, so the command actually works. Share this post Link to post Share on other sites
The Zoteboat 1 Posted December 17, 2023 Thanks a bunch! Share this post Link to post Share on other sites
pierremgi 4850 Posted December 17, 2023 You can test this code for forbidding forward,backward, left, right , fast orders when driver is AI, no matter the binding chosen by the players: In init.sqf (or initPlayerLocal.sqf) [] spawn { if isDedicated exitWith {}; waitUntil {!isNull findDisplay 46}; findDisplay 46 displayAddEventHandler ["keyDown",{ params ["_disp", "_key"]; _override =FALSE; if (!isPlayer driver vehicle player && {_key in flatten (["commandLeft","commandRight","commandForward","commandBack","commandFast"] apply {actionKeys _x})}) then { _override = TRUE; }; _override }]; }; Share this post Link to post Share on other sites
The Zoteboat 1 Posted December 21, 2023 Thanks for all the replies, the solution provided by pierremgi worked like a charm. However, I am now faced with another issue. After I board the vehicle as gunner, the AI driver refuses to follow the vehicles in front. I have tried the first method recommended by honger, to no avail. I have tried to fiddle with the ranks of the different units involved, but that didn't work either. I am using vehicles and units out of the RHSUSAF mod, namely the M1237 with a top gunner, if that info can be of value. Again, thanks in advance Share this post Link to post Share on other sites
pierremgi 4850 Posted December 21, 2023 You should be in a different group from the driver, or at least not the leader. (not tested) Share this post Link to post Share on other sites
The Zoteboat 1 Posted December 21, 2023 Hey Pierremgi This unfortunately doesn't work, the situation remains exactly the same, the convoy of vehicles just leaves without my vehicle Share this post Link to post Share on other sites