Jump to content

Recommended Posts

hi i need answers to this
How would I make the vehicle move after touching the ground.
And yes, I have looked at the forum pages for help, but others have had the same problem.

 

here is my script

I know that here there is no command for the vehicle to move to X location. 

Spoiler

 


_HeliSpawnPos = AttackCenterPoint getRelPos [3000, random 360];
_dir = [_HeliSpawnPos, AttackCenterPoint] call BIS_fnc_dirTo;
_cargoHeliType = "O_Heli_Transport_04_F";
_CargoHeli = [_HeliSpawnPos, _dir, _cargoHeliType, east] call BIS_fnc_spawnVehicle;
_HeliSlingLoadVehicle = selectRandom ["rhsgref_BRDM2_msv","rhs_brm1k_vdv","rhs_bmp1k_vdv","rhs_bmd2","rhs_bmp2e_vdv"];
_CHeli = _CargoHeli select 0;
_CHeliGroup = _CargoHeli select 1;
_CHelicrew = _CargoHeli select 2;
_CHeli setVehicleLock "LOCKEDPLAYER";
_CHeli allowDamage false;
                    
 {
   _x setCaptive true;
   _x allowFleeing 0;
   _x setUnitAbility 1;
   _x setSkill 1;
   _x setUnloadInCombat [false, false];
   _x allowDamage false;
   _x disableAI "TARGET";
   _x disableAI "AUTOTARGET";
   _x disableAI "LIGHTS";
   _Infantry = _Infantry + 1;
 } forEach units _CHelicrew;

_LandVehicleSpawn = [_HeliSpawnPos, 500, 1500, 35, 0, 0, 0] call BIS_fnc_findSafePos;
_Vehicle = [_LandVehicleSpawn, random 360, _HeliSlingLoadVehicle, east] call BIS_fnc_spawnVehicle;
_SiVehicle = _Vehicle select 0;
_SiVcrew = _Vehicle select 1;
_SiVGroup = _Vehicle select 2;
_SiVehicle setVehicleLock "LOCKEDPLAYER";
_TransportVehicleXposition = [AttackCenterPoint, 500, 1000, 35, 0, 1, 0] call BIS_fnc_findSafePos;

_WP1 = _CHelicrew addWaypoint [_LandVehicleSpawn, 0];
_WP1 setWaypointType "HOOK";
_WP1 setWaypointSpeed "NORMAL";
_WP1 setWaypointStatements ["true", "_CHeli land 'get in'; _CHeli setSlingLoad _Vehicle; _CHeli land 'NONE';"];

_WP2 = _CHelicrew addWaypoint [_TransportVehicleXposition, 10];
_WP2 setWaypointType "UNHOOK";
_WP2 setWaypointSpeed "NORMAL";
_WP2 setWaypointStatements ["true", "_CHeli land 'get in'; _CHeli setSlingLoad _Vehicle; _CHeli land 'NONE';"];

_WP3 = _CHelicrew addWaypoint [_HeliSpawnPos, 0];
_WP3 setWaypointSpeed "FULL";
_WP3 setWaypointType "MOVE";
_WP3 setWaypointStatements ["true", "{deleteVehicle _x} forEach crew (vehicle this) + [vehicle this];"];

 

Share this post


Link to post
Share on other sites

Just insert some lines:


 

////////////////////
_LandVehicleSpawn = [_HeliSpawnPos, 500, 1500, 35, 0, 0, 0] call BIS_fnc_findSafePos;
_Vehicle = [_LandVehicleSpawn, random 360, _HeliSlingLoadVehicle, east] call BIS_fnc_spawnVehicle;
_SiVehicle = _Vehicle select 0;
_SiVcrew = _Vehicle select 1;
_SiVGroup = _Vehicle select 2;
_SiVehicle setVehicleLock "LOCKEDPLAYER";
_TransportVehicleXposition = [AttackCenterPoint, 500, 1000, 35, 0, 1, 0] call BIS_fnc_findSafePos;


[_siVehicle,_siVGroup] spawn {
  params ["_siVehicle","_siVGroup"];
  waitUntil {sleep 2; !isTouchingGround _siVehicle};
  sleep 3;
  waitUntil {sleep 2; isTouchingGround _siVehicle};
  private _wp = _siVGroup addWaypoint [getpos player,0]
};

// CORRECTION FOR YOUR CODE:
_WP1 = _CHeliGroup addWaypoint [_LandVehicleSpawn, 0];
_WP1 setWaypointType "HOOK";
_WP1 setWaypointSpeed "NORMAL";
// delete this waypoint statement line, sam for _WP2
///////////

 

Edited by pierremgi
Waypoint statements are unconsistent. Remove the for _WP1 & 2

Share this post


Link to post
Share on other sites

 

On 5/17/2023 at 6:02 PM, Casio91Fin said:

_WP1 setWaypointStatements ["true", "_CHeli land 'get in'; _CHeli setSlingLoad _Vehicle; _CHeli land 'NONE';"];
_WP2 setWaypointStatements ["true", "_CHeli land 'get in'; _CHeli setSlingLoad _Vehicle; _CHeli land 'NONE';"];

 

You cannot use the local variables _CHeli and _Vehicle in the waypoint statements as they will be out of scope.

 

Rather than having the _vehicle spawn a script that is always waiting from its initial inception as shown by @pierremgi use the waypoint where you unhook it to start adding waypoints once it's touching the ground.

  • 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

×