Disable vehicle
by Very Interactive Person · in Torque Game Engine · 11/22/2003 (6:14 am) · 14 replies
Any way to disable a vehicle trough scripts? I don't mean preventing the player to mount it.... but really disable it so it can't drive. And offcourse a way to enable it too.
#2
11/22/2003 (3:04 pm)
Hmm, tried some stuff, but nothing really seemed to work.
#3
11/22/2003 (5:48 pm)
Yeah, did you try disableMove? It's accessible through the world editor.
#5
11/22/2003 (6:59 pm)
That's another way to do it, too... disableMove might be better, it sort of kills most of the physics for the object.
#6
and setState gives a console message saying "unknown command setState"
11/23/2003 (3:50 am)
Yeah well... I can indeed disable it trough the world editor. But I can't seem to get it to work trough scripts. My car keeps on driving ;)and setState gives a console message saying "unknown command setState"
#7
if maxWheelSpeed = 40;
then maxWheelSpeed = 0;
at least thats were i would start looking, but then im not a coder.
just a thought, probably a function that can set the maxWheelSpeed = xx; to maxWheelSpeed = 0; would it.
As a note i just set the maxWheelSpeed = 0;
car was undrivable, didnt move, all you have to do i think (as i say im not a coder) is create a function that switch's the maxWheelSpeed = xx; to maxWheelSpeed = 0; and back to enable it.
another approach could be to disable the movement keybindings under certain conditions on that client.
Something like this would be a start
function WheeledVehicleData::onDisable(%this,%obj)
{
maxWheelSpeed = 0;
}
function WheeledVehicleData::onEnable(%this,%obj)
{
maxWheelSpeed = 30;
}
im sure there is a lot more involved, havent even tryed the above, and as i say im primarilary an artist, best get back to that before, a programer comes in here and starts throwing old boots at me for suggesting bad ideas
11/23/2003 (5:01 am)
Hmmmif maxWheelSpeed = 40;
then maxWheelSpeed = 0;
at least thats were i would start looking, but then im not a coder.
just a thought, probably a function that can set the maxWheelSpeed = xx; to maxWheelSpeed = 0; would it.
As a note i just set the maxWheelSpeed = 0;
car was undrivable, didnt move, all you have to do i think (as i say im not a coder) is create a function that switch's the maxWheelSpeed = xx; to maxWheelSpeed = 0; and back to enable it.
another approach could be to disable the movement keybindings under certain conditions on that client.
Something like this would be a start
function WheeledVehicleData::onDisable(%this,%obj)
{
maxWheelSpeed = 0;
}
function WheeledVehicleData::onEnable(%this,%obj)
{
maxWheelSpeed = 30;
}
im sure there is a lot more involved, havent even tryed the above, and as i say im primarilary an artist, best get back to that before, a programer comes in here and starts throwing old boots at me for suggesting bad ideas
#8
// Remove Power from all Wheels
%obj.setWheelPowered(0,false);
%obj.setWheelPowered(1,false);
%obj.setWheelPowered(2,false);
%obj.setWheelPowered(3,false);
11/23/2003 (5:42 am)
You might want look at this too// Remove Power from all Wheels
%obj.setWheelPowered(0,false);
%obj.setWheelPowered(1,false);
%obj.setWheelPowered(2,false);
%obj.setWheelPowered(3,false);
#9
11/24/2003 (7:00 am)
K, after some digging and some help from other people I figured out what's going on. The disableMove field should be renamed to "cruiseControl". Why? Well, when you set it to 1 when the vehicle is standing still, it stays that way and you can't drive it. Otherwise it keeps driving at the same speed it was driving, and its impossible to stop it unless you set it back to 0. Or the field has a bad name, or its a bug. "disableThrottle", or "cruiseControl" would have been better names.
#10
11/24/2003 (7:17 am)
It probably keeps resending the same Move object to the vehicle, effectivly disabling the client Move.
#11
11/24/2003 (10:17 am)
Well it just makes it impossible to change the throttle, but assumes the throttle is 0, it doesn't set it to 0 if it isn't.
#12
Then just enable the move again when you want.
11/24/2003 (4:36 pm)
What you do is run the disable move and then setVelocity to 0. Boom, disabled.Then just enable the move again when you want.
#13
11/26/2003 (2:17 am)
Even if you set velocity to 0 the throttle is still locked at the value it was at when disablemove was flagged true. So the vehicle would start going again.
#14
08/14/2006 (8:43 pm)
There is no Vehicle::setVelocity method. It doesn't exist.
Associate Kyle Carter