Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → A little help with a game crashing bug...
A little help with a game crashing bug...
2003-03-22, 4:48 PM #1
Alright, I've made a cog in which you activate an arcade machine, and you play a wipeout style game. Rather than mess with controlling another template, I opted for changing the player 3do/physics. Now, the problem comes in if the player is killed while in the game (nothing hurts you, so the only way to do it is t-tab-kill) What should happen is, the player gets transported back to the arcade machine, 3do changed back to normal, physics back to normal, and the placeholder template (one that is created to look like the player playing the machine) is removed. But instead, the game crashes. The odd thing is, it worked untill recently, when I fixed some code that has nothing to do with this. Here is the code:

Code:
if(GetThingHealth(player) < 1)  
{
 SetThingModel(player, GetThingModel(guy));
 TeleportThing(player, guy);
DestroyThing(guy);
DestroyThing(attatchment);
ParseArg(player, "puppet=ky2.pup");
ClearPhysicsFlags(player,0x400);
ClearPhysicsFlags(player,0x100);
ClearPhysicsFlags(player,0x40000);
SetInvAvailable(player,1,weap1);
SetInvAvailable(player,2,weap2);
SetInvAvailable(player,3,weap3);
SetInvAvailable(player,4,weap4);
SetInvAvailable(player,5,weap5);
SetInvAvailable(player,6,weap6);
SetInvAvailable(player,7,weap7);
SetInvAvailable(player,8,weap8);
SetInvAvailable(player,9,weap9);
SetInvAvailable(player,10,weap10);
SetInvAvailable(player,21,ki);
SetInvAvailable(player,25,charging);
SetInvAvailable(player,25,kaoken);
SetInvAvailable(player,30,throw);
SetInvAvailable(player,31,sense);
SetInvAvailable(player,32,melee);
SetInvAvailable(player,40,bact);
SetInvAvailable(player,41,ir);
SetInvAvailable(player,42,field);
ClearActorFlags(player,0x800000);
StopSound(hs, 0);
SetMaterialCel(arcademat,0); 
SetPulse(0.0);
}


The reason it's set up like that is because the code refuses to run while under the killed message. I'd preferr it there, so if you could help with that too, I'd be gratefull [http://forums.massassi.net/html/smile.gif]

[come to think of it, the game-winning code is virtually the same. Could it be teleporting the player after he's dead thats screwing it up?]

------------------
Project leader of TDIR

[This message has been edited by Shred18 (edited March 22, 2003).]
Jedi Knight Enhanced
Freelance Illustrator
2003-03-22, 7:14 PM #2
Alot of crashes are caused by people using DestroyThing at the wrong time - when something doesnt exist or has already been destroyed.

Maybe try adding some checks before doing the destroything and seeing if that helps, something like

if(guy != 0 && GetThingType(guy) != 10) DestroyThing(guy);

if(attatchment != 0 && GetThingType(attatchment) != 10) DestroyThing(attatchment);

------------------
- Wisdom is 99% experience, 1% knowledge. -

[This message has been edited by The_New_Guy (edited March 22, 2003).]
- Wisdom is 99% experience, 1% knowledge. -
2003-03-22, 7:34 PM #3
If you put your code in the kyle.cog, the killedmessage will be called, and if you set an inventory value though the wipeout game, you can check it in kyle.cog, then you will know if the player was playing the game, and do your code, but most likely your code destroys something that doesnt exist, or destroys the player himself, these will cause crashes.

------------------
I'm just an old man with a skooma problem.
I'm just an old man with a skooma problem.
2003-03-23, 1:46 PM #4
Ha, your right, i was destroying attatchment instead of attachment. It sure didn't like that! It works fine now, thanks.

------------------
Project leader of TDIR
Jedi Knight Enhanced
Freelance Illustrator

↑ Up to the top!