Game Development Community

Possible DeactivatePackage bug (1.1b1.1)

by Scott Lahteine · in Torque Game Builder · 03/06/2006 (6:11 pm) · 3 replies

I'm trying to make a game that has a few different modes of play. I'm encapsulating each game type in its own package block, with generic functions like CreateControls() and InsertGameObjects(). I've just finished making a simple set of GUIs for exiting the game and starting a new one, but I'm having a problem!

When the user selects a game type I call a function that deactivates all the game-type packages and then activates just the selected game-type package.

However, when I then call the CreateControls() function it doesn't call the one from the newly activated package. It calls the one from the package that was first activated.

Is this a bug in package handling, or a feature of package handling, or is there something I'm not doing to make sure the right package is being activated?

Here's what my code looks like:
function StartGame(%game)
{
	ClearGameMenu();

	DeactivatePackage(Blobs);
	DeactivatePackage(Stacks);
	DeactivatePackage(Trumps);

	switch$ (%game)
	{
	case "blobs":
		ActivatePackage(Blobs);
	case "stacks":
		ActivatePackage(Stacks);
	case "trumps":
		ActivatePackage(Trumps);
	default:
		ActivatePackage(Blobs);
	}

	InitAndStartGame();
}

#1
03/14/2006 (5:10 pm)
I just tried a different approach. I created a "dummy" package that I activate before activating the game-type package. Then instead of deactivating all three game type packages, I first deactivate the "dummy" package and then immediately activate it. This should clear whatever package was activated, since as I understand it packages are "stacked."

Well, although this made my code look a little more interesting, it didn't solve the problem. This bug still plagues me. Does anyone have any suggestions for what I can do to fix this in the T2D engine? I'd like to get this bit working before GDC next week, as we're going to be bringing our demo to show off.

Has anyone else used packages in this manner with any success? Would anyone suggest an entirely different - or more appropriate - approach?
#2
01/18/2010 (3:52 am)
hmmm....old post

i had the exact same problem...instead of activating the package right after deactivating all packages, i scheduled it to get activated after some time and it works fine now
#3
01/18/2010 (4:11 am)
i take my words back!

the previous package is still active...does anyone know a solution to this?