Jump to content
ttdsi

On mission start script

Recommended Posts

Ive been at it for a god 12 hours but i cant get this script yo execute when i start a mission: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" or _x isKindOf "Wheeled_APC_F" )  && isnil {_x getVariable "onetk"}}); 
  }; 
}; 
 
 
0 = [] spawn MGI_1ManTank;

One man tank crew script that works, But having a mod with this as a init does not wanna execute, Could someone help

Share this post


Link to post
Share on other sites

I'm the author of this script.

There are 2 ways to use it:

- by script: just follow the link https://forums.bohemia.net/forums/topic/215081-solo-tank-script/?do=findComment&amp;comment=3344314

- by mod: use the MGI advanced module  one man tank from https://steamcommunity.com/sharedfiles/filedetails/?id=1682280809

 

 

 

 

Share this post


Link to post
Share on other sites

What i meant is i would like to have this script ran on every mission i start, Can this be done by making a PBO? with a init.sqf? so i don't have to put the script every mission i wanna play just have it as apart of the game

Share this post


Link to post
Share on other sites
29 minutes ago, ttdsi said:

What i meant is i would like to have this script ran on every mission i start, Can this be done by making a PBO? with a init.sqf? so i don't have to put the script every mission i wanna play just have it as apart of the game

Not every mission you start. Every mission you run the script (see the link) or place the module (need to load the addon of course, see also the link).

Share this post


Link to post
Share on other sites

What im trying to say is how do i get the script to run on every mission i start without having to use the dev console or adding it to the mission itself, Like a stand alone mod so i can drive one man tanks alone any time anywhere in arma 3

Share this post


Link to post
Share on other sites

This is not supposed to be a stand alone mod. Not with my consent. I'm scripting for mission makers only. On the other hand, if you have access to console in third party scenario, feel free to do what you want.

Share this post


Link to post
Share on other sites

I didnt mean to say i was gonna post it, I just want the script to execute on every mission that i play without manually adding it or executing it in the console

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

×