Game Development Community

WheeledVehicleData problem with Recon Vehicle Pack

by Andy Hawkins · in Torque Game Engine · 05/14/2008 (7:50 am) · 4 replies

I just purchase the awesome Recon Vehicle Pack and while I can get the mission to load the Recon vehicle no problem. But when I load my Landcruiser after it, is spawns this error..

setWheelTire:  datablock does not exist (or is not a tire)
setWheelSpring:  datablock does not exist (or is not a spring)
setWheelTire:  datablock does not exist (or is not a tire)
setWheelSpring:  datablock does not exist (or is not a spring)
setWheelTire:  datablock does not exist (or is not a tire)
setWheelSpring:  datablock does not exist (or is not a spring)
setWheelTire:  datablock does not exist (or is not a tire)
setWheelSpring:  datablock does not exist (or is not a spring)

I'm pretty sure it's because both my Landcruiser has the Humvee have the same ::onAdd function, the Humvee is declared last and that gets called instead.

While I want mine to get called like this...
function WheeledVehicleData::onAdd(%this,%obj)
{
   // Setup the car with some defaults tires & springs
   for (%i = %obj.getWheelCount() - 1; %i >= 0; %i--) {
      %obj.setWheelTire(%i,LandcruiserwCarTire);
      %obj.setWheelSpring(%i,LandcruiserCarSpring);
      %obj.setWheelPowered(%i,false);
   }

it calls this instead and so TyreDB and TyreSpringDB are not set for Landcruiser.
// Setup the car with some defaults tires & springs
   for (%i = %obj.getWheelCount() - 1; %i >= 0; %i--) {
      %obj.setWheelTire(%i,%this.tireDB);
      %obj.setWheelSpring(%i,%this.springDB);
   }

Any ideas how I can override this? Should I perhaps use ugly globals instead?

#1
05/14/2008 (8:15 am)
I would be careful to follow the way it is already working. These calls only set up the server, if I remember. It isn't clear if the messages you are getting are resulting from these calls, or from the setup on the client side (assuming you are running a client and server in the same process.) If you change this system too heavily, you might work OK on the server, but break the client side initialization.

I would step through it carefully in an IDE like Torsion or CodeWeaver and make sure where the errors are really occuring. Make sure that your datablock isn't mispelled: LandcruiserwCarTire
#2
05/14/2008 (8:50 am)
Thanks I fixed the typo and then stepped through it. It never gets to my Landcruiser 's WheeledVehicleData::onAdd function it just runs the Humvee one instead. On the first pass it's loaded the Landcruiser and tries to use %this.tireDB which is blank, and on the second time around the Humvee has set it properly. Should I just remove the Landcruiser 's WheeledVehicleData::onAdd and use the Humvee's onAdd function for both (and subsequent vehicles)?

Shouldn't I be overriding this? How would I override the WheeledVehicleData::onAdd function for each vehicle class?
#3
05/14/2008 (7:08 pm)
Parent::onAdd(%this, %obj);

What's wrong in the approach of putting this line inside your LandCruiser::onAdd block? Then continuing to initialize with your custom block for LandCruiser?

Sorry to ask, but I try to pick up as many 'correct' Tscripting workhabits as I can scrabble.
#4
05/14/2008 (11:45 pm)
Yeah I'll try that thanks. The other thing I was thinking was having a WheeledVehicle_Common.cs file that did all the "common" things vehicle should have, regardless of their derivation like tyres.