greenpeacekiller 14 Posted February 26, 2018 Im looking for a way to operate a tank solo just like this one http://killzonekid.com/arma-scripting-tutorials-one-man-tank-operation/ However this one is out dated and has given me alot of issues in multiplayer. I've also came across 'MGI_1ManTank' script but this one's controls are not very smooth Would it be possible so that when a player enters a vehicle, have a AI unit spawn in the driver seat, then have the player command the unit so he gains control of the vehicle's control. I've noticed if you just spawn AI under your control and enter a vehicle you can basicly do this but I want it so that they are only there once you enter the vehicle, and leave when you exit it. Any help to point me in the right direction would be appriciated Share this post Link to post Share on other sites
mrcurry 505 Posted February 26, 2018 Use the GetIn and GetOut event handlers (addEventhandler) On get in - create the crew and join them to the player, On get out - delete any remaining crew Share this post Link to post Share on other sites
greenpeacekiller 14 Posted February 26, 2018 33 minutes ago, mrcurry said: Use the GetIn and GetOut event handlers (addEventhandler) On get in - create the crew and join them to the player, On get out - delete any remaining crew How would I implement this? I lack the knowledge to properly format it. From what I could figure out it would go something like: this addEventHandler ["GetIn", <code here> _group createUnit ["B_Crew_F", [0,0,0], [], 0, "NONE"]; {_x moveIndriver myvehicle} forEach units _group; Have them join in the group with ''joinsilent / join'' Something like this but then not formatted so it actually makes sense unlike my attempt >.< Share this post Link to post Share on other sites
mrcurry 505 Posted February 26, 2018 1 hour ago, greenpeacekiller said: How would I implement this? I lack the knowledge to properly format it. From what I could figure out it would go something like: this addEventHandler ["GetIn", <code here> _group createUnit ["B_Crew_F", [0,0,0], [], 0, "NONE"]; {_x moveIndriver myvehicle} forEach units _group; Have them join in the group with ''joinsilent / join'' Something like this but then not formatted so it actually makes sense unlike my attempt >.< I'm on the phone so not tested... But something like this: this addEventHandler ["GetIn", { _tank = _this select 0; _unit = _this select 2; If(isplayer _unit) then { createVehicleCrew _tank; crew _tank select {!isplayer _x} joinSilent group player; } ; }] ; this addEventHandler ["GetOut", { _tank = _this select 0; _unit = _this select 2; If(isplayer _unit) then { {deleteVehicle _x;} forEach crew _tank; }; }]; I haven't accounted for all edge cases but should get ball rolling for a singleplayer thing. If not I'll check back with something more solid later. Share this post Link to post Share on other sites
greenpeacekiller 14 Posted February 27, 2018 On 2/26/2018 at 4:23 PM, mrcurry said: I'm on the phone so not tested... But something like this: this addEventHandler ["GetIn", { _tank = _this select 0; _unit = _this select 2; If(isplayer _unit) then { createVehicleCrew _tank; crew _tank select {!isplayer _x} joinSilent group player; } ; }] ; this addEventHandler ["GetOut", { _tank = _this select 0; _unit = _this select 2; If(isplayer _unit) then { {deleteVehicle _x;} forEach crew _tank; }; }]; I haven't accounted for all edge cases but should get ball rolling for a singleplayer thing. If not I'll check back with something more solid later. Sorry for the late reply Thats pretty cool, it works well. It seems to be creating a duplicate when testing this on a dedicated server tho Could make it compatible with multiplayer? Also in multiplayer we use ACE, so I imagine people will group up. You probably wont be able to have the player command AI while he is not the leader of the group. Would it instead be possible to remove them from the group so he can still control the AI and the vehicle? Share this post Link to post Share on other sites
pierremgi 4898 Posted February 28, 2018 On 26/02/2018 at 2:41 AM, greenpeacekiller said: I've also came across 'MGI_1ManTank' script but this one's controls are not very smooth So, I rewrote this old script, with the new commanding action for vehicle. I removed all the radar stuff and the "go to this marker" features. The using is same: You're driver. As soon as you move the mouse, you fall to gunner and keep the control. If 3rd person view, you fall back to driver after 10 sec non-moving mouse (it's better to drive as driver). In 1st view, you stay as gunner, even if not moving the mouse. Enjoy! Spoiler MGI_1ManTank = { if (!hasInterface) exitWith {}; MGI_timerTurreting = 0; MGI_tanks = _this; inGameUISetEventHandler ["Action", " _tk = _this select 0; if (_tk in MGI_tanks) then { if ((_this select 3) == 'GetInDriver' and count crew (_this select 0) > 0) then { _units = crew (_this select 0); if (!isnil MGI_agent) then {_units = _units - [mgi_agent]}; {unassignVehicle _x} forEach _units; _units allowGetIn false; }; if ((_this select 3) in ['GetInGunner','GetInCommander','GetInTurret']) exitWith { hint parseText ('<t>Jump in driver'+""'""+'s seat<t/>'); true }; if ((_this select 3) in ['MoveToGunner','MoveToCommander','MoveToTurret'] && !(player getVariable ['gunning',false])) exitWith { hint parseText ('<t>Only driver'+""'""+'s seat available<t/>'); true }; }; "]; _MGI_EHTank = ["MGI_TK","onEachFrame", { _veh = vehicle player; if (!isNil "MGI_agent" && {!(_veh in MGI_tanks) or !(MGI_agent in _veh)}) exitWith { deleteVehicle MGI_agent; MGI_agent = nil; (findDisplay 46) displayRemoveEventHandler ["keyDown",MGI_keysDriving]; MGI_keysDriving = nil; }; if (player == driver _veh and _veh in MGI_tanks) then { {_veh lockTurret [_x,true]} forEach allTurrets _veh; if (cameraView != "external") then {player switchcamera "external"} } else { if (player == gunner _veh && _veh in MGI_tanks && diag_tickTime > MGI_timerTurreting + 10 && (cameraView == "external" && isnil "MGI_signTkDest")) then { player action ["MoveToDriver", _veh]; player setVariable ["gunning",false]; if !(isnil "MGI_agent") then { deleteVehicle MGI_agent; MGI_agent = nil; deleteGroup MGI_agent_Grp; {_veh lockTurret [_x,true]} forEach allTurrets _veh}; }; }; if (isnil "MGI_keysDriving") then { MGI_keysDriving = (findDisplay 46) displayAddEventHandler ["KeyDown", " private _handled = false; if (!isnil 'MGI_agent'&& {if (inputAction _x >0) exitWith {1} } count ['turnLeft','turnRight','moveBack','moveForward','moveFastForward'] >0) then { enableSentences false; [] spawn {uisleep 1; enableSentences true}; }; _handled "]; }; }] call BIS_fnc_addStackedEventHandler; _MGI_mousingGunner = (findDisplay 46) displayAddEventHandler ["mouseMoving",{ _veh = vehicle player; if (_veh in MGI_tanks) then { _veh allowCrewInImmobile true; _veh setUnloadInCombat [true,false]; player setVariable ["gunning",true]; if (gunner _veh != player) then {player action ["MoveToTurret",_veh,[0]]}; MGI_timerTurreting = diag_tickTime; if (isnil "MGI_agent") then { MGI_agent_Grp = createGroup playerSide; MGI_agent = MGI_agent_Grp createunit ["B_Soldier_VR_F", getpos _veh, [], 0, "CAN_COLLIDE"]; MGI_agent moveInDriver _veh; MGI_agent setBehaviour "COMBAT"; MGI_agent setSpeedMode "FULL"; }; }; }]; }; (vehicles select {_x isKindOf "tank"}) call MGI_1ManTank; 1 2 Share this post Link to post Share on other sites
greenpeacekiller 14 Posted February 28, 2018 3 hours ago, pierremgi said: So, I rewrote this old script, with the new commanding action for vehicle. I removed all the radar stuff and the "go to this marker" features. The using is same: You're driver. As soon as you move the mouse, you fall to gunner and keep the control. If 3rd person view, you fall back to driver after 10 sec non-moving mouse (it's better to driver as driver). In 1st view, you stay as gunner, even if not moving the mouse. Enjoy! Very nice, my friend However the AI Driver keeps ejecting from the vehicle. Can this be prevented ? EDIT Fixed it, set their behaviour to CARELESS Is there a way to exclude this script from certain vehicles? I've noticed not all weapons are compatiable with this. (Using RHS RU T-90s) Share this post Link to post Share on other sites
pierremgi 4898 Posted March 1, 2018 hello @greenpeacekiller I modified the script above. I corrected bugs with view and improved the whole sentences. Now, you can write an array of tanks as parameter. I wrote (vehicles select {_x isKindOf "tank"}) as example. Just think about array and compatible vehicle. Work with RHS (rhs_t90_tv) for me... Please, remove the hidden content in your post to let just one right reference. I saw in other thread, someone often copied/pasted the last code instead of the right one. thanks Share this post Link to post Share on other sites
greenpeacekiller 14 Posted March 1, 2018 52 minutes ago, pierremgi said: hello @greenpeacekiller I modified the script above. I corrected bugs with view and improved the whole sentences. Now, you can write an array of tanks as parameter. I wrote (vehicles select {_x isKindOf "tank"}) as example. Just think about array and compatible vehicle. Work with RHS (rhs_t90_tv) for me... Please, remove the hidden content in your post to let just one right reference. I saw in other thread, someone often copied/pasted the last code instead of the right one. thanks Removed the previous content as requested. Thanks for that last line :D Also the weapons are actually compatible, my controls were assigned to the wrong keys >.> I tested your updated version, there seems to be a bug when switching to the driver's seat. Controls are not responding. (Tested with rhs_t80u) On a positive note, it does actually let you switch to the driver seat manually now which previously switched you back to gunner almost instantly. So far everything else seems to work fine, I am defenitly satisfied :3 Ill run more tests tomorrow Share this post Link to post Share on other sites
pierremgi 4898 Posted March 1, 2018 modified. Btw, I love the T80 explosion! Share this post Link to post Share on other sites
greenpeacekiller 14 Posted March 1, 2018 10 hours ago, pierremgi said: modified. Btw, I love the T80 explosion! Yes I never really was a fan of large sized mods but Im really enjoying this one aswell. As for the script, I've still encountered the same problem with the driver seat. So I just disabled it since im not really gonna be using it. The drivers still eject if you set them to combat, they do get back in quicker than before so thats a plus. however I'll keep them on CARELESS, it doesnt make a difference because the player has full control regardless of their behaviour however It solves the problem of ejecting without the need of tricky coding. In my mission I use opfor, and i forgot to switch the classname of the crew and it actually makes BLUFOR crew stay in the vehicle and let you control it. I will run a test on a dedicated server with players later today but so far I think I got more than everything I came for. Thanks alot for reworking your script. I'll be sure to pass this along to my friends I'm sure they'll find use for it aswell in their missions :3 Share this post Link to post Share on other sites
pierremgi 4898 Posted March 1, 2018 I added : _veh allowCrewInImmobile true; _veh setUnloadInCombat [true,false]; Usually it works for disabling any ejection for crew (driver is in turret, not cargo). Share this post Link to post Share on other sites
greenpeacekiller 14 Posted March 1, 2018 1 hour ago, pierremgi said: I added : _veh allowCrewInImmobile true; _veh setUnloadInCombat [true,false]; Usually it works for disabling any ejection for crew (driver is in turret, not cargo). Perfect that solves the issue. Thanks once again for your effort. Share this post Link to post Share on other sites
greenpeacekiller 14 Posted March 6, 2018 @pierremgi Im having trouble getting your function to excute on vehicles. So far for testing I've used vehicle player call MGI_1ManTank Now for multiplayer this wouldnt work. I tried something simple since I dont know how to make it into a array (vehicles select {_x isKindOf "rhs_t80u"}) call MGI_1ManTank; But it seems your function has to be excuted on the vehicle once a player is inside it. Having just this in the init file doesnt seem to work. Any suggesstions? Share this post Link to post Share on other sites
pierremgi 4898 Posted March 6, 2018 No, you need to always pass an array like: [tank1] call MGI_1Mantank or (vehicles select {_x isKindOf "rhs_t80u"}) call MGI_1ManTank; (Check for an existing class of course). The function has to be executed prior to jump into any tank. So avoid [vehicle player] For SP or MP, it should be fine if you run the code in init.sqf. The array is as defined at the time you call the line. If a vehicle doesn't exist yet, it can't be inside the array. So, for spawned vehicle, you need to add an extra call with the array of new vehicle(s). Don't stack the code several times on a same vehicle (former array), just add it. Share this post Link to post Share on other sites
greenpeacekiller 14 Posted March 6, 2018 3 hours ago, pierremgi said: No, you need to always pass an array like: [tank1] call MGI_1Mantank or (vehicles select {_x isKindOf "rhs_t80u"}) call MGI_1ManTank; (Check for an existing class of course). The function has to be executed prior to jump into any tank. So avoid [vehicle player] For SP or MP, it should be fine if you run the code in init.sqf. The array is as defined at the time you call the line. If a vehicle doesn't exist yet, it can't be inside the array. So, for spawned vehicle, you need to add an extra call with the array of new vehicle(s). Don't stack the code several times on a same vehicle (former array), just add it. Ah I see what I did wrong there, sorry about that Thanks for the help ! Share this post Link to post Share on other sites
Eroge 3 Posted March 11, 2019 On 3/7/2018 at 1:25 AM, pierremgi said: No, you need to always pass an array like: [tank1] call MGI_1Mantank or (vehicles select {_x isKindOf "rhs_t80u"}) call MGI_1ManTank; (Check for an existing class of course). The function has to be executed prior to jump into any tank. So avoid [vehicle player] For SP or MP, it should be fine if you run the code in init.sqf. The array is as defined at the time you call the line. If a vehicle doesn't exist yet, it can't be inside the array. So, for spawned vehicle, you need to add an extra call with the array of new vehicle(s). Don't stack the code several times on a same vehicle (former array), just add it. On 3/7/2018 at 5:29 AM, greenpeacekiller said: Ah I see what I did wrong there, sorry about that Thanks for the help ! I'm totally a starter for Arma scripting so pardon my ignorance... but I'd like to know where should I call this function? And how do I make this function work on new spawned vehicles? Share this post Link to post Share on other sites
pierremgi 4898 Posted March 11, 2019 Hello @Eroge This script is a little bit old and had some interest with previous versions of Arma. Now, you can order an AI driver as you're a turret, without too much radio sentences and a smooth driving as you did in driver's seat. That's a great BI improvement. Anyway, for true one man tank, without AI management, the script is still Ok. To answer at your question, if you want to test the code you can add it into init.sqf, or a trigger set to true for condition. For including spawned vehicles, you need to replace the whole code by: Spoiler inGameUISetEventHandler ["Action", " _tk = _this select 0; if (_tk in MGI_tanks) then { if ((_this select 3) == 'GetInDriver' and count crew (_this select 0) > 0) then { _units = crew (_this select 0); if (!isnil MGI_agent) then {_units = _units - [mgi_agent]}; {unassignVehicle _x} forEach _units; _units allowGetIn false; }; if ((_this select 3) in ['GetInGunner','GetInCommander','GetInTurret']) exitWith { hint parseText ('<t>Jump in driver'+""'""+'s seat<t/>'); true }; if ((_this select 3) in ['MoveToGunner','MoveToCommander','MoveToTurret'] && !(player getVariable ['gunning',false])) exitWith { hint parseText ('<t>Only driver'+""'""+'s seat available<t/>'); true }; }; "]; MGI_EHTank = ["MGI_TK","onEachFrame", { _veh = vehicle player; if (!isNil "MGI_agent" && {!(_veh in MGI_tanks) or !(MGI_agent in _veh)}) exitWith { deleteVehicle MGI_agent; MGI_agent = nil; (findDisplay 46) displayRemoveEventHandler ["keyDown",MGI_keysDriving]; MGI_keysDriving = nil; }; if (player == driver _veh and _veh in MGI_tanks) then { {_veh lockTurret [_x,true]} forEach allTurrets _veh; if (cameraView != "external") then {player switchcamera "external"} } else { if (player == gunner _veh && _veh in MGI_tanks && diag_tickTime > MGI_timerTurreting + 10 && (cameraView == "external" && isnil "MGI_signTkDest")) then { player action ["MoveToDriver", _veh]; player setVariable ["gunning",false]; if !(isnil "MGI_agent") then { deleteVehicle MGI_agent; MGI_agent = nil; deleteGroup MGI_agent_Grp; {_veh lockTurret [_x,true]} forEach allTurrets _veh}; }; }; if (isnil "MGI_keysDriving") then { MGI_keysDriving = (findDisplay 46) displayAddEventHandler ["KeyDown", " private _handled = false; if (!isnil 'MGI_agent'&& {if (inputAction _x >0) exitWith {1} } count ['turnLeft','turnRight','moveBack','moveForward','moveFastForward'] >0) then { enableSentences false; [] spawn {uisleep 1; enableSentences true}; }; _handled "]; }; }] call BIS_fnc_addStackedEventHandler; MGI_1ManTank = { if (!hasInterface) exitWith {}; MGI_timerTurreting = 0; MGI_tanks = []; waituntil {!isNull findDisplay 46}; _MGI_mousingGunner = (findDisplay 46) displayAddEventHandler ["mouseMoving",{ _veh = vehicle player; if (_veh in MGI_tanks) then { _veh allowCrewInImmobile true; _veh setUnloadInCombat [true,false]; player setVariable ["gunning",true]; if (gunner _veh != player) then {player action ["MoveToTurret",_veh,[0]]}; MGI_timerTurreting = diag_tickTime; if (isnil "MGI_agent") then { MGI_agent_Grp = createGroup playerSide; MGI_agent = MGI_agent_Grp createunit ["B_Soldier_VR_F", getpos _veh, [], 0, "CAN_COLLIDE"]; MGI_agent moveInDriver _veh; MGI_agent setBehaviour "COMBAT"; MGI_agent setSpeedMode "FULL"; }; }; }]; while {true} do { uisleep 2; { MGI_tanks pushBackUnique _x; _x setVariable ["onetk",true]; } forEach (vehicles select {_x isKindOf "tank" && isnil {_x getVariable "onetk"}}); }; }; 0 = [] spawn MGI_1ManTank; Have fun. 1 Share this post Link to post Share on other sites
Eroge 3 Posted March 11, 2019 2 hours ago, pierremgi said: Hello @Eroge This script is a little bit old and had some interest with previous versions of Arma. Now, you can order an AI driver as you're a turret, without too much radio sentences and a smooth driving as you did in driver's seat. That's a great BI improvement. Anyway, for true one man tank, without AI management, the script is still Ok. To answer at your question, if you want to test the code you can add it into init.sqf, or a trigger set to true for condition. For including spawned vehicles, you need to replace the whole code by: Reveal hidden contents inGameUISetEventHandler ["Action", " _tk = _this select 0; if (_tk in MGI_tanks) then { if ((_this select 3) == 'GetInDriver' and count crew (_this select 0) > 0) then { _units = crew (_this select 0); if (!isnil MGI_agent) then {_units = _units - [mgi_agent]}; {unassignVehicle _x} forEach _units; _units allowGetIn false; }; if ((_this select 3) in ['GetInGunner','GetInCommander','GetInTurret']) exitWith { hint parseText ('<t>Jump in driver'+""'""+'s seat<t/>'); true }; if ((_this select 3) in ['MoveToGunner','MoveToCommander','MoveToTurret'] && !(player getVariable ['gunning',false])) exitWith { hint parseText ('<t>Only driver'+""'""+'s seat available<t/>'); true }; }; "]; MGI_EHTank = ["MGI_TK","onEachFrame", { _veh = vehicle player; if (!isNil "MGI_agent" && {!(_veh in MGI_tanks) or !(MGI_agent in _veh)}) exitWith { deleteVehicle MGI_agent; MGI_agent = nil; (findDisplay 46) displayRemoveEventHandler ["keyDown",MGI_keysDriving]; MGI_keysDriving = nil; }; if (player == driver _veh and _veh in MGI_tanks) then { {_veh lockTurret [_x,true]} forEach allTurrets _veh; if (cameraView != "external") then {player switchcamera "external"} } else { if (player == gunner _veh && _veh in MGI_tanks && diag_tickTime > MGI_timerTurreting + 10 && (cameraView == "external" && isnil "MGI_signTkDest")) then { player action ["MoveToDriver", _veh]; player setVariable ["gunning",false]; if !(isnil "MGI_agent") then { deleteVehicle MGI_agent; MGI_agent = nil; deleteGroup MGI_agent_Grp; {_veh lockTurret [_x,true]} forEach allTurrets _veh}; }; }; if (isnil "MGI_keysDriving") then { MGI_keysDriving = (findDisplay 46) displayAddEventHandler ["KeyDown", " private _handled = false; if (!isnil 'MGI_agent'&& {if (inputAction _x >0) exitWith {1} } count ['turnLeft','turnRight','moveBack','moveForward','moveFastForward'] >0) then { enableSentences false; [] spawn {uisleep 1; enableSentences true}; }; _handled "]; }; }] call BIS_fnc_addStackedEventHandler; MGI_1ManTank = { if (!hasInterface) exitWith {}; MGI_timerTurreting = 0; MGI_tanks = []; waituntil {!isNull findDisplay 46}; _MGI_mousingGunner = (findDisplay 46) displayAddEventHandler ["mouseMoving",{ _veh = vehicle player; if (_veh in MGI_tanks) then { _veh allowCrewInImmobile true; _veh setUnloadInCombat [true,false]; player setVariable ["gunning",true]; if (gunner _veh != player) then {player action ["MoveToTurret",_veh,[0]]}; MGI_timerTurreting = diag_tickTime; if (isnil "MGI_agent") then { MGI_agent_Grp = createGroup playerSide; MGI_agent = MGI_agent_Grp createunit ["B_Soldier_VR_F", getpos _veh, [], 0, "CAN_COLLIDE"]; MGI_agent moveInDriver _veh; MGI_agent setBehaviour "COMBAT"; MGI_agent setSpeedMode "FULL"; }; }; }]; while {true} do { uisleep 2; { MGI_tanks pushBackUnique _x; _x setVariable ["onetk",true]; } forEach (vehicles select {_x isKindOf "tank" && isnil {_x getVariable "onetk"}}); }; }; 0 = [] spawn MGI_1ManTank; Have fun. Thank you for your answer! Too bad it's already 1:30am in china and I'll have to read them in the moring... cant wait to try it 1 Share this post Link to post Share on other sites
Eroge 3 Posted March 11, 2019 8 hours ago, pierremgi said: Hello @Eroge This script is a little bit old and had some interest with previous versions of Arma. Now, you can order an AI driver as you're a turret, without too much radio sentences and a smooth driving as you did in driver's seat. That's a great BI improvement. Anyway, for true one man tank, without AI management, the script is still Ok. To answer at your question, if you want to test the code you can add it into init.sqf, or a trigger set to true for condition. For including spawned vehicles, you need to replace the whole code by: Reveal hidden contents inGameUISetEventHandler ["Action", " _tk = _this select 0; if (_tk in MGI_tanks) then { if ((_this select 3) == 'GetInDriver' and count crew (_this select 0) > 0) then { _units = crew (_this select 0); if (!isnil MGI_agent) then {_units = _units - [mgi_agent]}; {unassignVehicle _x} forEach _units; _units allowGetIn false; }; if ((_this select 3) in ['GetInGunner','GetInCommander','GetInTurret']) exitWith { hint parseText ('<t>Jump in driver'+""'""+'s seat<t/>'); true }; if ((_this select 3) in ['MoveToGunner','MoveToCommander','MoveToTurret'] && !(player getVariable ['gunning',false])) exitWith { hint parseText ('<t>Only driver'+""'""+'s seat available<t/>'); true }; }; "]; MGI_EHTank = ["MGI_TK","onEachFrame", { _veh = vehicle player; if (!isNil "MGI_agent" && {!(_veh in MGI_tanks) or !(MGI_agent in _veh)}) exitWith { deleteVehicle MGI_agent; MGI_agent = nil; (findDisplay 46) displayRemoveEventHandler ["keyDown",MGI_keysDriving]; MGI_keysDriving = nil; }; if (player == driver _veh and _veh in MGI_tanks) then { {_veh lockTurret [_x,true]} forEach allTurrets _veh; if (cameraView != "external") then {player switchcamera "external"} } else { if (player == gunner _veh && _veh in MGI_tanks && diag_tickTime > MGI_timerTurreting + 10 && (cameraView == "external" && isnil "MGI_signTkDest")) then { player action ["MoveToDriver", _veh]; player setVariable ["gunning",false]; if !(isnil "MGI_agent") then { deleteVehicle MGI_agent; MGI_agent = nil; deleteGroup MGI_agent_Grp; {_veh lockTurret [_x,true]} forEach allTurrets _veh}; }; }; if (isnil "MGI_keysDriving") then { MGI_keysDriving = (findDisplay 46) displayAddEventHandler ["KeyDown", " private _handled = false; if (!isnil 'MGI_agent'&& {if (inputAction _x >0) exitWith {1} } count ['turnLeft','turnRight','moveBack','moveForward','moveFastForward'] >0) then { enableSentences false; [] spawn {uisleep 1; enableSentences true}; }; _handled "]; }; }] call BIS_fnc_addStackedEventHandler; MGI_1ManTank = { if (!hasInterface) exitWith {}; MGI_timerTurreting = 0; MGI_tanks = []; waituntil {!isNull findDisplay 46}; _MGI_mousingGunner = (findDisplay 46) displayAddEventHandler ["mouseMoving",{ _veh = vehicle player; if (_veh in MGI_tanks) then { _veh allowCrewInImmobile true; _veh setUnloadInCombat [true,false]; player setVariable ["gunning",true]; if (gunner _veh != player) then {player action ["MoveToTurret",_veh,[0]]}; MGI_timerTurreting = diag_tickTime; if (isnil "MGI_agent") then { MGI_agent_Grp = createGroup playerSide; MGI_agent = MGI_agent_Grp createunit ["B_Soldier_VR_F", getpos _veh, [], 0, "CAN_COLLIDE"]; MGI_agent moveInDriver _veh; MGI_agent setBehaviour "COMBAT"; MGI_agent setSpeedMode "FULL"; }; }; }]; while {true} do { uisleep 2; { MGI_tanks pushBackUnique _x; _x setVariable ["onetk",true]; } forEach (vehicles select {_x isKindOf "tank" && isnil {_x getVariable "onetk"}}); }; }; 0 = [] spawn MGI_1ManTank; Have fun. That works!! Thanks very much! and I wonder if this code is MP capable? Share this post Link to post Share on other sites
pierremgi 4898 Posted March 12, 2019 9 minutes ago, Eroge said: That works!! Thanks very much! and I wonder if this code is MP capable? Yes. Share this post Link to post Share on other sites
Eroge 3 Posted March 12, 2019 2 hours ago, pierremgi said: Yes. It seems that the code doesn't work on wheeled vehicles... any idea how to modify it? Share this post Link to post Share on other sites
pierremgi 4898 Posted March 12, 2019 1 hour ago, Eroge said: It seems that the code doesn't work on wheeled vehicles... any idea how to modify it? First, it works on... tanks. And most of APCs are if you check their parent classes in config viewer. Second the gunner must have a workable seat in turret [0]. If not, I must check for specific gunner turret. Any difficulty for a specific one? Share this post Link to post Share on other sites
Eroge 3 Posted March 12, 2019 3 minutes ago, pierremgi said: First, it works on... tanks. And most of APCs are if you check their parent classes in config viewer. Second the gunner must have a workable seat in turret [0]. If not, I must check for specific gunner turret. Any difficulty for a specific one? like... how do I apply this on Rhino MGS? Share this post Link to post Share on other sites
pierremgi 4898 Posted March 12, 2019 Well, Rhino is not a tank. If you want to apply the script on APCs, like Rhino, Marshall or Gorgon... which are wheeled APCs, just replace one of the bottom lines: } forEach (vehicles select {_x isKindOf "tank" && isnil {_x getVariable "onetk"}}); by: } forEach (vehicles select { (_x isKindOf "tank" or _x isKindOf "Wheeled_APC_F" ) && isnil {_x getVariable "onetk"}}); Share this post Link to post Share on other sites