Author Topic: Changing vehicle state?  (Read 1366 times)

I was wondering if theres anyway to change a vehicles state such as from flying to land to flying again
my plan was to remove the brake command and leave the brake key for the state changer

if this is possible could someone please explain?

I feel bad that this topic hasn't gotten any replies.

I would assume that you would have to have both datablocks in the script, and then use a toggle function to switch between them.

... i wonder if you understand what your asking.

"change state from flying to land, and back"

so if the vehicle is flying 500 units in the air.. and you change state
   ... what do you want to have happen?   
      teleport to ground? fall and crash?  or something else?
keep in mind you will have to script all this.

then if the vehicle is driving, and runs off the edge of a cliff.  currently the vehicle falls, but if you "change state" to flying,  then what?

I bet he was thinking of a harrier.

... i wonder if you understand what your asking.
???
All he wants is to switch from flying to driving. Not hard to understand, mate.

@OP: Just change the datablock when they press a certain key. Unfortunately the space bar brake is in the engine code, if I recall. You'll need to choose another key.

???
All he wants is to switch from flying to driving. Not hard to understand, mate.

@OP: Just change the datablock when they press a certain key. Unfortunately the space bar brake is in the engine code, if I recall. You'll need to choose another key.
you can't use that code that GSF used on his helicopter and modify it?
from what i remember it was like, trigger something.

He means a harrier. Like the jet that can hover.

???
All he wants is to switch from flying to driving. Not hard to understand, mate.

@OP: Just change the datablock when they press a certain key. Unfortunately the space bar brake is in the engine code, if I recall. You'll need to choose another key.
It is brake, but you can still use it. I used it in an engine modifier script I made a while back.

Code: [Select]
package PlaneCar {
function CarPlane::onTrigger(%this,%obj,%triggerNum,%val) {if(%val && %triggerNum == 2) { %this.setDatablock(PlaneCar); }}
function PlaneCar::onTrigger(%this,%obj,%triggerNum,%val) {if(%val && %triggerNum == 2) { %this.setDatablock(PlaneCar); }}
};
activatePackage(PlaneCar);

I'm assuming that you can swap datablocks between WheeledVehicle and FlyingVehicle. If you can't, it's a lot more complicated and just about not worth it. You'd have to delete the car, create the plane exactly where the car was, mount the player into the plane, and give the plane the exact speed the car was going. This doesn't seem so bad on the ground, but in the air if you're in the middle of turning and you hit space your plane will spawn angled, but the turn will start over again and cause some wobbles and possible spin outs. Not to mention, space is still brake reguardless of the vehicle type. If you don't just tap space you'll come to a screeching stop if you're on the ground.


EDIT:
He means a harrier. Like the jet that can hover.
That's not at all what he described, how did you even come to that conclusion?
« Last Edit: April 04, 2011, 10:23:09 PM by TripleNickels »

Just ask Bushido how he made his masterpiece helicopter. Its really well done and would work for a VTOL (Vertical Take Off and Landing) plane. You just need to make the model for it. Or ask him if you can even "use" his script. The only other thing is that you would have to animate the engine nozzles swiveling down into hover mode or vice versa.
« Last Edit: April 09, 2011, 11:14:43 AM by Bobinatoran »