View Single Post
04-14-10, 06:10 PM   #3
spiel2001
nUI's Author
 
spiel2001's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2008
Posts: 7,724
Just to follow up on my conversation with myself... here's what's going on...

Code:
function AIPlayer::spawn(%name,%spawnPoint, %type)
{
   // Create the demo player object
   if( %type $= "player") {
       %useThisDatablock = DemoPlayer;
   }else if( %type $= "enemy1") {
       %useThisDatablock = DemoPlayer2;
    }else if( %type $= "strykerGun") {
        %useThisDatablock = DefaultPlayerData;
    }else if( %type $= "tankGun") {
        %useThisDatablock = TankTurret;
    }else if( %type $= "box") {
        %useThisDatablock = testBox;
   }
   %player = new AiPlayer() {
      dataBlock = %useThisDatablock;
      path = "";
   };
   MissionCleanup.add(%player);
   %player.setShapeName(%name);
   %player.setTransform(%spawnPoint); // this line works without error
   return %player;
}

function AIWheeledVehicle::spawn( %name, %spawnPoint, %type )
{
   %player = new AIWheeledVehicle() {
      dataBlock = DefaultCar;
      path = "";
   };

   MissionCleanup.add(%player);
   %player.setShapeName(%name);
   %player.setTransform(%spawnPoint); // this line causes the game to sigseg
   
   return %player;
}
In the above two methods... one to spawn an AI player, the other to spawn an AIWheeledVehicle, if I pass in a %spawnPoint to the AIPlayer::spawn() it will work. Pass the same %spawnPoint in to the AIWheeledVehicle::spawn() method and the app will abort immediately on the function call.

I'm all ears for what the problem might be.

(PS: The above it not my code... it's legacy stuff I'm trying to wrap my head around)
__________________

What people don't get is that I am, ultimately, an artist at heart.
My brush has two colors, 1 and 0, and my canvas is made of silicon.



Official nUI Web Site: http://www.nUIaddon.com
Official nUI Support Forum: http://forums.nUIaddon.com
My day job: http://www.presidio.com/
  Reply With Quote