How to turn OFF python scripts?

Hi!

Say for example, your using the vehicle wrapper, and you want to press a button and have the whole thing just fall apart, (because the python script is turned off)…how do you do this?

rules: It can’t be an animation or replaced vehicle, it needs to be the same one, just with the script turned off. :spin:

Changing states doesn’t work, but there just has to be a way to turn OFF python scripts…

any ideas? :confused:

perhaps you could use variables or if then property statements

Ok, the python script is on an always sensor right? So just make a property called intact, int, set it to 0 and conect a property sensor to the python script, make it the one you just made, and then when something happens that you want your vihicle to fall apart have it change the property to 1 or somthing, then your Equal sensor will be negative, therefore turning off the script.

That should work

Do you know that the vehicle wrapper is not the script?

The vehiclewrapper script just mounts together the parts of the vehicle. If that is done the script is not needed anymore.

If you think about the powertrain script, that just applies some input to the (still mounted) vehicle wrapper. If you do not run that script, the vehicle objects still work. But does not receive any input (steering, power etc.) and therefore just staying around (maybe rolling down a hill).

-> conclusion not running the scripts do not remove the vehicle. You just do not use it.

An alternative way would be:
Remove all objects of the vehicle (body + wheels). Replace them with the same objects, but not mounted.

Unfortunalty if you run 2.49b and you remove the wheels, the BGE will crash :(.

That means you can’t remove a vehicle without switching the scene (this is possible).
I haven’t checked if the BGE crashes if you disable physics before removing the wheels.

Sorry I can’t help you with that.

Or he could use a true false bool statement,

Yeah, but I always like to use the int option so that you can add in a third party ability later without having to change propertys.

I tried a bunch of that stuff, but it seems the vehicle script (if you tear it down to the bare bones, it’s a script) is applied to the vehicle object…is there some way to stop the script from running, or somehow tell blender that you don’t want the script to be applied to this car object any more?

How often do you run this script?

I run the script once and then change states.

Your qestion:

answered by yourself: