Vehicle question.
by Ferret · in Technical Issues · 07/15/2003 (2:03 pm) · 4 replies
Hi,
How can i make the default buggy take damage and die?
I added a ::damage and ::ondamage function to car.cs, i used player.cs as example.
When the buggy takes damage i get the red flash but this only happens once and the car won't die.
The console gives me this error:
game/server/scripts/car.cs (0): Unknown comand getState.
Object (1410) WheeledVehicle -> Vehicle -> ShapeBase -> GameBase -> SceneObject -> NetObject -> SimObject
How can i fix this?
Thx.
How can i make the default buggy take damage and die?
I added a ::damage and ::ondamage function to car.cs, i used player.cs as example.
When the buggy takes damage i get the red flash but this only happens once and the car won't die.
The console gives me this error:
game/server/scripts/car.cs (0): Unknown comand getState.
Object (1410) WheeledVehicle -> Vehicle -> ShapeBase -> GameBase -> SceneObject -> NetObject -> SimObject
How can i fix this?
Thx.
About the author
#2
07/16/2003 (10:18 am)
I haven't done this but I believe you need to add code to the vehicles on collision function in your car.cs
#3
07/16/2003 (5:05 pm)
I believe so too, I don't have damamge in my game, but I do have a lot of onCollision stuff and that would seem to be the best place for damamge..
#4
I am messing around with adding damage to my vehicles and I started similar to what you have done. The error that you are seeing is because Torque is searching through the inheritance of your object for "getState". when it doesn't find it in the first place it looks it goes up the chain that is why you get
WheeledVehicle -> Vehicle -> ShapeBase -> GameBase -> SceneObject -> NetObject -> SimObject.
when this happens the first thing I would say to do is dump the object. this can be done while you are playing the game in the console.
1) hit f11 while playing the game to get into the world editor
2) write down the 4 digit handle for the object in question I will use 1234 as ex.
3) type the ~ key to bring up the console
4) type 1234.dump(); and press enter
the out put is basically a very usefull dump of commands and info that can be used with this object. You may notice that "getState" is not in the dump but you can try getDamageLevel() or getDamagePercent() or even getDamageState()
02/17/2005 (7:17 am)
**I know this post is old but this may help solve some scripting issues if you are new to Torque.I am messing around with adding damage to my vehicles and I started similar to what you have done. The error that you are seeing is because Torque is searching through the inheritance of your object for "getState". when it doesn't find it in the first place it looks it goes up the chain that is why you get
WheeledVehicle -> Vehicle -> ShapeBase -> GameBase -> SceneObject -> NetObject -> SimObject.
when this happens the first thing I would say to do is dump the object. this can be done while you are playing the game in the console.
1) hit f11 while playing the game to get into the world editor
2) write down the 4 digit handle for the object in question I will use 1234 as ex.
3) type the ~ key to bring up the console
4) type 1234.dump(); and press enter
the out put is basically a very usefull dump of commands and info that can be used with this object. You may notice that "getState" is not in the dump but you can try getDamageLevel() or getDamagePercent() or even getDamageState()
Ferret
This is the car.cs i'm using.(removed link)
I don't have a player.cs and start as the car.