Jump to content
Sign in to follow this  
cupcake_actual

eject player using mortar

Recommended Posts

i have a mp tvt mission. i want to force eject players using mortars. how?

 

Also, how can i execute a script for killing an Ai. Not a specific Ai, a randomly spawned Ai, like from using the Ai spawn module. 

Share this post


Link to post
Share on other sites

Also you could just lock the mortar preventing player from getting the option to get in or use an eventhandler placed in the mortars init

this addeventhandler ["getin",{moveout (_this select 2)}];// will eject all units 
this addeventhandler ["getin",{if (player in (_this select 0)) then { moveout (_this select 2)}}];//ejects just player

Share this post


Link to post
Share on other sites

f2k sel, This is meant to apply to all mortars, even those from virtual arsenal, so they would not have a name or an init.

 

i found this, and im sure the answer is in here, but i do not know what to do. again, i want to eject the player, or even delete the mortar. the mission uses arsenal so the players can get a mortar from it, but i dont want them to be able to shoot it..

 

KK_playerAddMortarBag = { removeBackpack player; KK_mortarBag = toString [ (toArray faction player) select 0 ] + "_Mortar_01_weapon_F"; player addBackpack KK_mortarBag; player addAction [ format [ localize "STR_ACTION_ASSEMBLE", localize "str_a3_cfgvehicles_mortar_01_base0" ], { player action ["Assemble", unitBackpack player]; player removeAction (_this select 2); }, [], 0, false, true, "User1", " !isNull unitBackpack player && {backpack player == KK_mortarBag} && {player == vehicle player} " ]; KK_mortarAssembled_EH = player addEventHandler ["WeaponAssembled", { if ((_this select 1) isKindOf "StaticMortar") then { player removeEventHandler ["WeaponAssembled", KK_mortarAssembled_EH]; enableEngineArtillery false; (_this select 1) addEventHandler ["GetOut", { if (alive player) then { player setDir (direction (_this select 0)); player setPos ((_this select 0) modelToWorld [0,-2,-0.7]); player playActionNow "PutDown"; (_this select 0) spawn { sleep 0.5; deleteVehicle _this; call KK_playerAddMortarBag; } } else { (_this select 0) setDamage 1; } }]; (_this select 1) spawn { sleep 0.9; if (isNull _this || {!alive _this}) exitWith {}; if (player distance _this > 3.5) exitWith { deleteVehicle _this; call KK_playerAddMortarBag; }; if (lineIntersects [ getPosASL player, getPosASL _this, player, _this ]) exitWith { deleteVehicle _this; call KK_playerAddMortarBag; }; player moveInGunner _this; if (gunner _this != player) exitWith { deleteVehicle _this; call KK_playerAddMortarBag; }; } } }] };

Share this post


Link to post
Share on other sites

Try this save it as initPlayerLocal.sqf  or it won't work, not sure how it works in MP but this will stop units getting in all three default mortars.

// initPlayerLocal.sqf;


inGameUISetEventHandler [
     "Action",
     "
          _target = _this select 0;
         if ((_this select 3) in ['GetInTurret'] and  (typeof (_this select 0) in ['B_G_Mortar_01_F','O_Mortar_01_F','I_Mortar_01_F'])) then {
               hint 'Not Allowed';
               true;
          };
     "
];

this would also stop the Disassembly of the mortars as well and give you an idea of how it works by adding items to the arrays.

Not the syntax has to be correct  disassemble will not work.

// initPlayerLocal.sqf;


inGameUISetEventHandler [
     "Action",
     "
          _target = _this select 0;
        //  hint str (_this select 3); // for debug
         if ((_this select 3) in ['GetInTurret','DisAssemble'] and  (typeof (_this select 0) in ['B_G_Mortar_01_F','O_Mortar_01_F','I_Mortar_01_F'])) then {
               hint 'Not Allowed';
               true;
          };
     "
];

Share this post


Link to post
Share on other sites

THis is defiantly what i need. but it isn't working. prolly syntax but i have no idea 

 

we're on the right track tho!!

Share this post


Link to post
Share on other sites

Ah couple of issues,debug comments are not allowed inside an EVH so that needed removing and there are four types of mortars I'd only noticed three so you would still be able to get in BLUFOR mortar.

 

This should be fine now for all four.

// initPlayerLocal.sqf;


inGameUISetEventHandler [
     "Action",
     "
          _target = _this select 0;
        
         if ((_this select 3) in ['GetInTurret','DisAssemble'] and  (typeof (_this select 0) in ['B_G_Mortar_01_F','B_Mortar_01_F','O_Mortar_01_F','I_Mortar_01_F'])) then {
               hint 'Not Allowed';
               true;
          };
     "
];

also you should have seen a syntax  error about the debug  line, if you didn't you may want to turn on the  showscripterrors in launcher somewhere.

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  

×