Forum Jump :

Author Message


Posts: 20
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2009-08-06 12:32        
     
I've got a few vehicles being created by scripts for a multiplayer mission. I'm wanting to make these vehicles only usable for their side (East/West).

What can I add in this script to eject a player on the west (BLUFOR) side if they try to enter the vehicle?
vehicle01 = createVehicle ["UAZ_MG_INS", [(getMarkerPos "veh01") select 0,(getMarkerPos "veh01") select 1,0], [], 3, "GROUND"];


Author Message

Tom_48_97  

Master lord of the head in the cloud!


Posts: 502
Rank:


Level: Member

Country: 00
Location:
Occupation: Bohemia Interactive Developer
Age:
In-game name: Tom_48_97

 
#2 Posted at 2009-08-06 13:11        
     
As far I know, not possible.... But maybe, take a look at the check for the heli/plane. In some missions, if you're not a pilot, you can't drive a plane or heli. Maybe the test is possible with a side check.

I don't have in mind a mission with this feature...

@Tom_48_97 - Bohemia Interactive

Advertisement


Author Message


Posts: 53
Rank:


Level: Member

Country: uk
Location: West Yorkshire
Occupation: Proffesional Developer SQL/ C#/C/C++
Age:
In-game name:

 
#3 Posted at 2009-08-06 14:40        
     
Look at the getIn event handler...

http://community.bistudio.com/wiki/ArmA:_Event_Handlers


Author Message


Posts: 20
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#4 Posted at 2009-08-06 14:43        
     
Found this script that might work.

_u = _this select 0;
{
_x action ["eject", vehicle _x];
sleep 0.2;
} forEach units group _u;

exit;

I'm thinking I could replace (_u = _this select 0) with the groups that are in my missions (west01, west02, west03, west04).
How could I add all 4 of those groups in the script? Something like (_u = west01 or west02 or west03 or west04)?


Author Message

Tom_48_97  

Master lord of the head in the cloud!


Posts: 502
Rank:


Level: Member

Country: 00
Location:
Occupation: Bohemia Interactive Developer
Age:
In-game name: Tom_48_97

 
#5 Posted at 2009-08-07 07:07        
     
this addEventHandler ["getIn",{_veh = _this select 1; { if (side _X == west) then {_X action ["GETOUT",_veh]} } forEach crew _veh}];
this addEventHandler ["getIn",{_veh = _this select 1; { if (side _X == east) then {_X action ["GETOUT",_veh]} } forEach crew _veh}];

You've to put this in each init line of vhl

@Tom_48_97 - Bohemia Interactive

Author Message


Posts: 20
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#6 Posted at 2009-08-07 19:00        
     
Thank you! I got help on the official forums with the same solution, only I tried adding it to my script which spawns my vehicle.

vehicle01 = createVehicle ["UAZ_MG_INS", [(getMarkerPos "veh01") select 0,(getMarkerPos "veh01") select 1,0], [], 3, "GROUND"];
vehicle01 addEventHandler ["getIn",{_veh = _this select 1; {if(side _X == west)then{_X action ["GETOUT",_veh]}} forEach crew _veh}];

This didn't work, but you're saying I need to add it into the vehicles init line. Since my vehicles are created by the scipt, I just need to figure out how to get that in the init line when the vehicle spawns.


Author Message


Posts: 20
Rank:


Level: Member

Country: us
Location:
Occupation:
Age:
In-game name:

 
#7 Posted at 2009-08-07 22:37        
     
this addEventHandler ["getIn",{_veh = _this select 1; { if (side _X == west) then {_X action ["GETOUT",_veh]} } forEach crew _veh}];
Just tested this with an empty vehicle placed with the editor and my west units were still able to get into the vehicle. Am I missing something?

Thanks again.


Author Message

fenix  



Posts: 1
Rank:


Level: Member

Country: 00
Location:
Occupation:
Age:
In-game name:

 
#8 Posted at 2009-08-08 18:12        
     
If it's MP, you might have a client loop running, doing various checks etc, in which case you can add a line to check whether the vehicle is the same side as the player.


if (side vehicle player != side player) then {player action ["eject", vehicle player]};

I think vehicles have a side... or this won't work.