$modcoun"> Simple modding questions... I think? | Torque Game Engine | Forums | Community | GarageGames.com

Game Development Community

Simple modding questions... I think?

by Gary "ChunkyKs" Briggs · in Torque Game Engine · 09/01/2006 (6:22 pm) · 1 replies

I'm converting a bunch of stuff I've done before that *was* full games [ie copies of starter.fps] to be just mods.

Each mod is contained within a torquescript package. In my top level main.cs, I have
$defaultGame = "starter.fps";
<snippage>
$modcount = 4;
$userMods = "jmtorque;oderocks;creator;" @ $defaultGame;

Then each mod's main.cs has all the code in it wrapped in stuff like:

package JMTorquePackage {
  function onStart() {
    Parent::onStart();
    echo("\n--------- Initializing MOD: JMTorque ---------");
    exec("./client/init.cs");
    exec("./server/init.cs");

    initServer();
    if (!$Server::Dedicated)
      initClient();
  }
}; // Client package
activatePackage(JMTorquePackage);

All this is fine, so far. Stuff that I want loaded on game loadup, loads. Now what I want is to be able to run stuff on the client, or server, when the mission is finished loading, as part of these mods. I read through this:tdn.garagegames.com/wiki/Torque/Networking/ConnectionSequence

In each of the mod packages I defined function onMissionDownloadComplete. So as I understand it, there'd be a bunch of packages defined at this point; JMTorquePackage, ODEScriptPackage. Each of these has a function in it, JMTorquePackage::onMissionDownloadComplete and ODEScriptPackage::onMissionDownloadComplete... I think?

In my mind, torque would then iterate across every activated package for each phase of the mission loading, and call packagename::onMissionDownloadComplete()... but it doesn't. In practice, what happens is torque calls onMissionDownloadComplete in the first package, since that's the first one defined, and then never calls any others.

So, uh, basically I'm just heavily confused. How am I supposed to write mods? I want stuff to be executed in each mod on the server when all the loading is complete, and stuff to be executed on the client when loading is completed.

Are packages even the way to go? Are there other functions that torque calls in each mod it has installed for when certain things happen?

Thanks,
Gary (-;

#1
09/01/2006 (7:07 pm)
*smacks self*

OK, so, I had read this page: tdn.garagegames.com/wiki/TorqueScript#Packages, but it hadn't occurred to me the answer was right there.

onMissionLoaded is called in the most-recently-loaded package... in the onMissionLoaded() in each package, I wasn't calling Parent::onMissionLoaded() which is why only one was being called.

This also answers my question of how to slap an actionmap on the top of the stack; do it after the Parent::onMissionLoaded() in my mod's onMissionLoaded() function.

Blah.

You know, I've been looking at this for three days now and not being able to work it out. So I finally post, and bam! thinking about it on the drive home the answer comes to me.

Gary (-;