Jump to content
  • 0

createVehicle on top of building


kelso000

Question

I'm trying to make some edits to a vehicle spawning script to allow players to deploy their mozzie on their landing pad. The vehicle is created by:

_object = _vehicle createVehicle(position player);

However, position player returns the XY coordinates and sets Z to 0, creating the vehicle on the ground.

I figured I could use the createVehicle and set the position to getPosATL player. So my new code looked like:

_pos = getPosATL player;
_object = createVehicle[_vehicle,_pos,[],0,"CAN_COLLIDE"];

However, when I do this the vehicle spawns in the air above me. The bike falls and can be ridden, but the mozzie is stuck. One bullet will cause it to fall but then it blows up.  I did a little testing last night before I went to bed and it seems like the higher my player is, the higher the vehicle spawns.

My next course of action would be to see if I can come up with a formula for the z axis based on the getPosATL player: create a plot with my pos vs spawn pos and find an equation for the line of best fit for an accurate z coordinate.

Another idea I had would be to make it so the vehicle wouldn't take damage and could be shot down for say 60 seconds after deploying, allowing the player to shoot the vehicle out of the air when it first spawns and it land without blowing up.

Of course, those two are probably just over thinking it.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

modelToWorld results in the same as getPosATL

I stuck with modelToWorld to deploy in front of player. I wondered if setting the position again would work:

				_pos = player modelToWorld [0,3,0];
				_object = createVehicle [_vehicle,_pos,[],0,"CAN_COLLIDE"];
				_object setVariable ["ObjectID", _objectID, true];
				_object setVariable ["ObjectUID", _objectID, true];
				_object addEventHandler ["GetIn",{
					_nil = [nil,(_this select 2),"loc",rTITLETEXT,"Warning: This vehicle will disappear on server restart!","PLAIN DOWN",5] call RE;
				}];

				clearWeaponCargoGlobal _object;
				clearMagazineCargoGlobal _object;
				_object setVehicleAmmo 0;
				_object setPos _pos;
				player reveal _object;

And it worked in the live editor along with my test server. However, on the live server they fall, bounce, and eventually blow up. I'm stumped.

The script I'm editing is EVD.

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...