Jump to content

Recommended Posts

Hello I am doing a mission and I want to lock 5 quad for the BLUFOR and let them open for the OPFOR, Is it possible and, If yes, How can I do that ?

 

Sorry if my English is bad ans thx for your help ;)  

Share this post


Link to post
Share on other sites

A long time ago I made this, should still work and do the trick.

{
	_target = _x;
	if (isNil "_target") exitWith {};
	_target addEventHandler [
		"GetIn", {
			params ["_veh","_pos","_unit"];
			if !(side (group _unit) isEqualTo east) then {
				_unit action ["eject", _veh];
			};
		}
	];
	nil;
} count [vehicle_1,vehicle_2,...,vehicle_n];

 

Share this post


Link to post
Share on other sites

this script can't work due to params, not complying with the EH "getin" parameters. Try params ["_veh","_pos", "_unit"]; instead.

  • Like 2

Share this post


Link to post
Share on other sites

Ah, I knew there was something I missed when I converted it to params... Thank you!

 

Fixed it in the post above.

  • Like 1

Share this post


Link to post
Share on other sites

And I have to write that in the "init" of the vehicle ?

I don't really understand how I have to use that script :/

 

Share this post


Link to post
Share on other sites

Just smack it in the init.sqf and place the names of the vehicles where [vehicle_1...vehicle_n] is.

Share this post


Link to post
Share on other sites

For 5 quads, you can just add:

this addEventHandler [
  "GetIn", {
   params ["_veh","_pos","_unit"];
   if (side _unit != EAST) then {
    _unit action ["eject", _veh];
   };
  }
 ];

on each init field of quad.

 

Share this post


Link to post
Share on other sites
On 6/21/2017 at 12:35 AM, pierremgi said:

For 5 quads, you can just add:

this addEventHandler [
  "GetIn", {
   params ["_veh","_pos","_unit"];
   if (side _unit != EAST) then {
    _unit action ["eject", _veh];
   };
  }
 ];

on each init field of quad.

 

 

this ejects everyone who is not east, is there a way to eject ONLY west?

i know it might seem like a stupid question, but i need civilians to also be able to enter this vehicle and i cant have them switching sides from civilian to east with joinSilent becouse that will mess up triggers

Share this post


Link to post
Share on other sites

Sure. The current condition for ejection is 

side _unit != EAST

which is to say, "if the unit's side is not 'EAST.'"  You just need to change it to "if the unit's side is 'WEST.'" 

side _unit == WEST

 

  • Like 2

Share this post


Link to post
Share on other sites

Thanks man, that was a lot simpler then what i imagined it would be.

Share this post


Link to post
Share on other sites

Bump, sorry guys! Would anybody here have an idea on how to make a vehicle locked but only for a player who is currently carrying a flag (CTF mission)?

Share this post


Link to post
Share on other sites

The simple way I guess (NOT TESTED), is for player carrying a flag by forced flag texture (should be the case).

So, in init.sqf, and related to this post:


 

{

   _x  addEventHandler [ "GetIn", {
      params ["_veh","_pos","_unit"];
      if (getForcedFlagTexture _unit != "") then {
         _unit action ["eject", _veh];
      };
   }];

} forEach (yourArrayOfVehiclesHere);      // vehicles by default, for all edited vehicles

 

Spoiler

For just specific vehicle, from editor, say named car1, it's simple as car1 addEventHandler [....];

On the other hand, if you spawn some vehicles during the mission and you want to add this EH on them, you need to check a loop with new vehicles.

 

 

  • Like 1

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

×