Jump to content
  • 0

Rotate vehicle


BetterDeadThanZed

Question

Since it's not possible to set the direction a vehicle spawns at a trader (It apparently always spawns facing north), would someone be able to make a script that allows a player to rotate a vehicle? I am asking this because I have 100% custom traders and I just added airplane traders, but the planes don't face down the runway. I'd like to have a scroll menu option to rotate the plane so a player that buys a plane can get it facing down the runway. Infistar has something built into it that puts a plane facing the right direction, because if I spawn one on a runway, it is facing the north intially, then is automatically adjusted to be aligned with the runway very quickly.

Link to comment
Share on other sites

21 answers to this question

Recommended Posts

  • 0

Can you not just move the spawn point so the player has enough room to turn and take off ? That's how i did it with my custom traders.

Moving the planes will need BE exceptions and isn't really realistic when 1 guy starts moving a C130 :unsure:

 

No, I can't move the traders and I don't sell C-130's.

Link to comment
Share on other sites

  • 0

 

Doesn't work for vehicles purchased at traders. Although AWOL says vehicles purchased are set in a random direction (), during my testing at the new airplane trader, every plane spawned facing north. Setting the helipad to face towards the direction of the runway doesn't work. That fact has been discussed in several threads and is not in dispute, thus the need to rotate the plane or have it automatically snap to the right direction like in Infistar.

Link to comment
Share on other sites

  • 0

Doesn't work for vehicles purchased at traders. Although AWOL says vehicles purchased are set in a random direction (), during my testing at the new airplane trader, every plane spawned facing north. Setting the helipad to face towards the direction of the runway doesn't work. That fact has been discussed in several threads and is not in dispute, thus the need to rotate the plane or have it automatically snap to the right direction like in Infistar.

 

as i said

 

https://community.bistudio.com/wiki/setDir

 

xD

 

spawn and rotate after with that command.

//place vehicle spawn marker (local)
_veh = createVehicle ["Sign_arrow_down_large_EP1", _location, [], 0, "CAN_COLLIDE"];

_location = (getPosATL _veh);

//["PVDZE_veh_Publish",[_veh,[_dir,_location],_part_out,false,_keySelected]] call callRpcProcedure;
PVDZE_veh_Publish2 = [_veh,[_dir,_location],_part_out,false,_keySelected,_activatingPlayer];
publicVariableServer  "PVDZE_veh_Publish2";

_veh setDir 0;
Link to comment
Share on other sites

  • 0

as i said

 

https://community.bistudio.com/wiki/setDir

 

xD

 

spawn and rotate after with that command.

 

I really don't follow. I already have the setDir command in the mission.sqf but that does not affect the direction that the vehicles spawn:

_vehicle_39 = objNull;
if (true) then
{
  _this = createVehicle ["HeliHEmpty", [15190.244, 16194.443, -5.9127808e-005], [], 0, "CAN_COLLIDE"];
  _vehicle_39 = _this;
  _this setDir -41.028904;
  _this setPos [15190.244, 16194.443, -5.9127808e-005];
};
Link to comment
Share on other sites

  • 0

 

I really don't follow. I already have the setDir command in the mission.sqf but that does not affect the direction that the vehicles spawn:

_vehicle_39 = objNull;
if (true) then
{
  _this = createVehicle ["HeliHEmpty", [15190.244, 16194.443, -5.9127808e-005], [], 0, "CAN_COLLIDE"];
  _vehicle_39 = _this;
  _this setDir -41.028904;
  _this setPos [15190.244, 16194.443, -5.9127808e-005];
};

.

lol, not the marker...

 

the vehicle xD

 

WAIT this code is incorrect, give ma a min

//place vehicle spawn marker (local)
_veh = createVehicle ["Sign_arrow_down_large_EP1", _location, [], 0, "CAN_COLLIDE"];

_location = (getPosATL _veh);

//["PVDZE_veh_Publish",[_veh,[_dir,_location],_part_out,false,_keySelected]] call callRpcProcedure;
PVDZE_veh_Publish2 = [_veh,[_dir,_location],_part_out,false,_keySelected,_activatingPlayer];
publicVariableServer  "PVDZE_veh_Publish2";

_veh setDir 0;
Link to comment
Share on other sites

  • 0

 

.

lol, not the marker...

 

the vehicle xD

 

WAIT this code is incorrect, give ma a min

//place vehicle spawn marker (local)
_veh = createVehicle ["Sign_arrow_down_large_EP1", _location, [], 0, "CAN_COLLIDE"];

_location = (getPosATL _veh);

//["PVDZE_veh_Publish",[_veh,[_dir,_location],_part_out,false,_keySelected]] call callRpcProcedure;
PVDZE_veh_Publish2 = [_veh,[_dir,_location],_part_out,false,_keySelected,_activatingPlayer];
publicVariableServer  "PVDZE_veh_Publish2";

_veh setDir 0;

 

That would change the direction for every purchased vehicle. Not optimal if I decide I want to add another airplane dealer.

Link to comment
Share on other sites

  • 0

I placed _object setDir 151; at the bottom of that file and the planes still face north.

 

*edit* I got it working by putting it here:

	_object setVariable ["ObjectID", _oid, true];
	
	_object setVariable ["lastUpdate",time];
	
	_object setVariable ["CharacterID", _characterID, true];
	
	_object setDir 151;

	if(DZE_TRADER_SPAWNMODE) then {
		_object attachTo [_object_para, [0,0,-1.6]];
		sleep 1.0;
		WaitUntil{(([_object] call FNC_GetPos) select 2) < 0.1};
		detach _object;
		deleteVehicle _object_para;
	};
Link to comment
Share on other sites

  • 0

So I've not tried this but I just attempted a solution.

 

Open up server_publishVehicle2.sqf and find-

//_dir = _this select 4

Uncomment it.

 

Next, find this-

if(DZE_TRADER_SPAWNMODE) then {
	_object_para = createVehicle ["ParachuteMediumWest", [0,0,0], [], 0, "CAN_COLLIDE"];
	_object_para setPos [_location select 0, _location select 1,(_location select 2) + 65];
	_object = createVehicle [_class, [0,0,0], [], 0, "CAN_COLLIDE"];
} else {
	_object = createVehicle [_class, _location, [], 0, "CAN_COLLIDE"];
        // NEW LINE HERE!
};

And place the following where it says //NEW LINE HERE!-

_object setDir _dir;

Now open up trade_any_vehicle.sqf and find-

_helipad = nearestObjects [player, ["HeliHCivil","HeliHempty"], 100];
if(count _helipad > 0) then {
	_location = (getPosATL (_helipad select 0));
	// NEW LINE HERE!
} else {
	_location = [([player] call FNC_GetPos),0,20,1,0,2000,0] call BIS_fnc_findSafePos;
};

Then place the following where it says //NEW LINE HERE!-

_dir = getDir (_helipad select 0);

I've not tried this out, but it seems logical to me. If it works, just rotate all your HeliHEmpty spawns to whatever you like.

Link to comment
Share on other sites

  • 0

So I've not tried this but I just attempted a solution.

 

Open up server_publishVehicle2.sqf and find-

//_dir = _this select 4

Uncomment it.

 

Next, find this-

if(DZE_TRADER_SPAWNMODE) then {
	_object_para = createVehicle ["ParachuteMediumWest", [0,0,0], [], 0, "CAN_COLLIDE"];
	_object_para setPos [_location select 0, _location select 1,(_location select 2) + 65];
	_object = createVehicle [_class, [0,0,0], [], 0, "CAN_COLLIDE"];
} else {
	_object = createVehicle [_class, _location, [], 0, "CAN_COLLIDE"];
        // NEW LINE HERE!
};

And place the following where it says //NEW LINE HERE!-

_object setDir _dir;

Now open up trade_any_vehicle.sqf and find-

_helipad = nearestObjects [player, ["HeliHCivil","HeliHempty"], 100];
if(count _helipad > 0) then {
	_location = (getPosATL (_helipad select 0));
	// NEW LINE HERE!
} else {
	_location = [([player] call FNC_GetPos),0,20,1,0,2000,0] call BIS_fnc_findSafePos;
};

Then place the following where it says //NEW LINE HERE!-

_dir = getDir (_helipad select 0);

I've not tried this out, but it seems logical to me. If it works, just rotate all your HeliHEmpty spawns to whatever you like.

 

Where can I find trade_any_vehicle.sqf?

Link to comment
Share on other sites

  • 0

Can't the little gyro's be rotated? Maybe look in the fn selfactions and see if you can add classnames to the action????

Just a wild guess

 

Oh yes.. they can... I forgot about that. I will look into that, although Zupa's information got the planes facing the right direction. I'll look at as an alternative or simply an addon.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...