Jump to content
Sign in to follow this  
curtcooll

Getin/Getout help

Recommended Posts

Trying to make it so that when i get in a vehicle my AI group mates will get in without me having to issue command.

if (!isServer) exitWith {};

_playergrp = group player;

if (player Getin) then
   {
	_playergrp doGetIn;
};
if (true) exitWith {};

Share this post


Link to post
Share on other sites

You have to check if the player is in the vehicle then assign the group to the vehicle before ordering them to get in.

[_unitOne, _unitTwo] orderGetIn true 

Share this post


Link to post
Share on other sites

oh ok dunno then not great at scripting understand what you mean though.

---------- Post added at 19:15 ---------- Previous post was at 19:03 ----------

Ok so i use this player in VehicleName would check if im in a vehicle how would i account this for all vehicles rather than just one with specific name.

if (!isServer) exitWith {};

_group	= group;
_unitsGroup = units (group);


if (player in vehicle) then
   {
	[_unitsGroup] orderGetIn true;
};
if (true) exitWith {};

What am i doing wrong?

---------- Post added at 20:46 ---------- Previous post was at 20:23 ----------

ive even tried this cant seem to get the AI unit to auto get in vehicle when im in vehicle.

if (!isServer) exitWith {};

//_group	= group;
//_unitsGroup = units (group);
//_veh = vehicle player;


if(! isPlayer(leader (group (vehicle player)))) then 
{
    forEach (units (group player));
	group player orderGetIn true;

};
if (true) exitWith {};

---------- Post added at 22:16 ---------- Previous post was at 20:46 ----------

anyone? im trying to understand how it all works ive got player detected if in vehicle but how do i make it so that within if statement it allows ai group members to enter when i enter

if (!isServer) exitWith {};

_group	= group;
_unitsGroup = units (group);
//_veh = vehicle player;


if (vehicle player == player) then
{
    forEach (units (group player));
	[__unitsGroup] orderGetIn true;

};
if (true) exitWith {};

---------- Post added at 22:39 ---------- Previous post was at 22:28 ----------

Ok tried this where am i going wrong ive tried if statements ive tried for loop this should work.

if (!isServer) exitWith {};

Varibles
_unit = _this select 0;

_group = group;
_unitsgroup = units (group _unit);

if(vehicle player == player) then {

for [{ _loop = 0 },{ _loop < count  _unitsGroup},{ _loop = _loop + 1}] do
{
_guy = _unitsGroup player select _loop;
if (_loop == 0) then {[_guy] orderGetIn true;};

sleep 0.1;
};
};

---------- Post added at 23:19 ---------- Previous post was at 22:39 ----------

Ok im close what am i missing?

while {true} do  
{
_playerGrp = group player;
_unitsPlrGrp = units _playerGrp;

_veh_plr = vehicle player;

if(vehicle player = player) then {
for [{ _loop = 0 },{ _loop < count  _unitsPlrGrp},{ _loop = _loop + 1}] do
{
_unit = _unitsPlrGrp select _loop;
_unit assignascargo _veh_plr;
[_unit] orderGetIn true;

sleep 0.1;
};
};

Edited by curtcooll

Share this post


Link to post
Share on other sites

can replace while loop with event handler - add mp event handler to the vehicle. Not tested but should help you along the way

in the said vehicle(s)

veh = [] execVM "vehiclegetin.sqf";

vehiclegetin.sqf

// [vehicle, position, unit]

_vehicle addEventHandler ["GetIn", "if (player == (_this select 2)) then {[(_this select 0),(_this select 2)] execVM 'groupinvehicle';hint 'leader in vehicle';}"];

groupinvehicle.sqf

_unit = _this select 1;
_vehicle = _this select 0;

{
_x assignascargo _vehicle ;
[_x] orderGetIn true;
} foreach units group _unit;

Share this post


Link to post
Share on other sites

Yeah tried that no luck, what im using is a shop where you buy AI units and they get added to your group, i also made a script that when you die you re spawn into reaming AI units so i know that its not conflicting and works but ive been trying 5 days solid to get ai units to enter any vehicle i get in as its way to slow for me to sit there and tell the unit and causes death when trying to evac playing MP ai gamemode.

Share this post


Link to post
Share on other sites

yeah tried that didn't work don't see why its so difficult to make AI get into the damn thing, looking at code it should just do as it says, ive checked around the internet and even arma 2 no one scripted it cant see why because it saves so much time. if your able to get it to work ill be grateful fella i just think it summit that should have been scripted just dont see why it has not lol.

Edited by curtcooll

Share this post


Link to post
Share on other sites

in that case - i have no idea - the commands above i have used to place units in vehicle with no probs - strange indeed

Share this post


Link to post
Share on other sites

Not tested, this should assign the units automatically when they are near landvehicles.

_group = _this select 0;
_groupleader = leader _group;
_vehicles = nearestObjects [_groupleader, ["LandVehicle"], 50];

while {alive _groupleader} do
{
{ 
	if (count _vehicles > 0) then
	{
		//hint format ["%1",_vehicles];
		_x assignascargo (_vehicles select 0);
		[_x] orderGetIn true;
	};
} foreach (units _groupleader);

sleep 1;
};

Share this post


Link to post
Share on other sites

hmmm tried that no luck either i made fresh new map to see if my other scripts conflicted with anything but still no luck strange indeed. i appreciate the help if anyone does get it working happy days mikie boy did you say it worked for yourself if so could you make a mission and send me over pbo possibly.

Cheers

---------- Post added at 01:10 ---------- Previous post was at 00:31 ----------

I even tried a trigger to do this (vehicle player) in thislist or vehicle player in thislist and set the activation to playername moveincargo unitname; i think vehicle player for arma 3 does not work.

---------- Post added at 01:39 ---------- Previous post was at 01:10 ----------

i found this https://community.bistudio.com/wiki/in_vehicle you have to use player in vehicle from what i can understand ?

Edited by curtcooll

Share this post


Link to post
Share on other sites

Ok so i got this i know im doing summit wrong but what.

// null=[veh] execvm "in_out_veh.sqf"
_unit = _this select 0;
_members = units group player;
//_vehicleNew = ObjNull;

for [{_x = 0}, {_x < count _members}, {_x = _x + 1}] do
{
//_unitX = _members _x;
if (vehicle player != player) then
{
    _vehicleX = vehicle player;

    _x assignAsCargo _vehicleX;

   [_x] moveincargo _vehicleX; 

 } foreach units group _unit;
};
};

Share this post


Link to post
Share on other sites

I think your over complicating it

while {alive player} do {

waitUntil {vehicle player != player};

{
    _x assignAsCargo vehicle player ;
      _x moveincargo vehicle player;
}  foreach units group player;



waitUntil {vehicle player == player};
{
    unassignVehicle _x ;
      moveOut _x
}  foreach units group player;


};

You may have to replace moveout with action["ejetct" ect for choppers when parachutes are introduced.

Edited by F2k Sel

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  

×