Game Development Community

Player dies causes crash for fxSunlight.cc

by Andy Hawkins · in Torque Game Engine · 02/18/2007 (10:41 pm) · 3 replies

Now that I've got Skeletons with fireballs attacking the player who is a Skeleton with an Mp5 , the engine crashes and can be trace to the line below marked with an arrow, when then fireballs kill the player...

in fxSunlight.cc
// Calculate screen point, on screen?
   if (dglPointToScreen(ObjectPoint, ScreenPoint))
   {
		// Yes, so get Server Connection.
		GameConnection* conn = GameConnection::getConnectionToServer();
		// Problem?
		if (conn)
		{
			// Get the Control Object.
			ShapeBase* ControlObj = conn->getControlObject();

		// Fetch Eye Position.
			Point3F	eyePos;
			MatrixF	eye;
			ControlObj->getEyeTransform(&eye);  <---- ControlObj is 0x00000000
			eye.getColumn(3, &eyePos);

There is a fix for this code by changing conn->getControlObject(); to conn->getCameraObject(); but that doesn't fix my problem.

If I make the player a Skeleton with Fireballs (like the enemy) rather than one with an MP5, it doesn't crash.

It's seem that because the Skeleton with Fireballs and Skeleton with MP5 both use PlayerData functions in separate scripts they may be conflicting but what does that have to do with fxSunlight?? Other than the eye vector?

Anyone know of a fix for this? I don't want an engine change because its for the content pack.

EDIT: Something else I noted was I know it's going to crash when the camera doesn't switch to 3rd person to show the player dying - it is stuck on 1st person, shakes the camera, the gun fades then the game crashes. If it switches to 3rd person as expected, shows the player dying, then it doesn't crash - the problem is intermitten.

#1
02/19/2007 (1:12 am)
Maybe some script code is setting the control object to 0 before you want it to.
#2
02/19/2007 (1:47 am)
What exactly is the control object? Is it where the camera is or something?
#3
02/19/2007 (10:01 pm)
I fixed it. I was controlling the death sequence manually when it should be left to the original scripts to kill off the player.