Game Development Community

Triggers and Loading Missions Help Needed

by Randy Mlinarcik · in Torque 3D Professional · 06/07/2011 (8:43 am) · 7 replies

I've been searching for a little bit and even tried a couple of examples that are similar to my situation, but never got anything to quite work right. Hopefully, one of you Torquescript gurus can point me in the right direction.

Here's what I'm trying to do:

I have a mission (we'll call it Mission 1) with multiple spawn points, however I want the player to ALWAYS spawn at the starting spawn point. While playing Mission 1, I want a trigger area to launch another mission (Mission 2). While playing mission 2, I want a trigger area that can reload Mission 1 but force a different spawn point.

I'll post an example diagram for a visual aid:
www.doomlab.com/images/screenshots/example.gif
Any help would be greatly appreciated.

About the author

* Master's Degree in Business Administration * Graduate Certificate in Entrepreneurship * Bachelor's Degree in Game & Simulation Programming * 7 Years Game Development and Modding Experience


#2
06/07/2011 (6:52 am)
As elvince says, you need a variable somewhere - one that won't get deleted on cleanup - so ... maybe a global, and then check on loadout (I'd suggest a custom gametype ... or mod the existing) for what the map loading on the server is, what the variable is, and then choose the spawnpoint from there.
#1
06/07/2011 (9:09 am)
Why don t you keep a variable on the client/ player class that host the Spawn point?
It might not be the best approach but that will do the trick.
#3
10/19/2011 (10:16 pm)
I'm sorry Randy - I missed your post. I'll dig out that script for you by this weekend.
#4
10/20/2011 (9:35 am)
There's a simple yet tedious addition that can be made to allow specific spawnpoint usage on a level change. Basically you add an additional parameter to the level loading management code which allows you to pass in a variable of your choosing as the spawnpoint to use. The tedious bit is that the level loading progression is scattered between client & server code in both the core and game scripts so all of these methods have to be modified to read/use/pass the new parameter.
#5
10/20/2011 (9:40 am)
As per my preious post see the various missionDownload.cs scripts (client and server), clientConnection.cs, missionLoad.cs -- I think those are the key scripts whose methods will need the additional parameter. And of course the spawn function will have to be modified as well.
#6
10/20/2011 (11:12 am)
Ah, but I cheated. I stuck the name of the target spawnpoint in a global at onEnterTrigger from a dynamic field on the trigger, then scheduled the load of the target mission from another dynamic field on the trigger. All I had to do was write my TransitionTriggerData::onEnterTrigger function and modify the GameCore::spawnPlayer function to search for and drop the player at the spawnpoint indicated in the global, or use the default if no name was defined. But it is a cheat and won't work right in a multiplayer game.

For a multiplayer game you'd have to decide if you want Neverwinter Nights style area changes (harder) or Neverwinter Nights 2 style area changes (easier).

For the first you'd probably have to spawn a new server process to host the new mission file and then transfer the triggering player to the new server instance. If you intend to allow chat between players in different areas you'd have to build a chat server and fit it in, I think.

For the second you would have to make it multiplayer safe, but basically just shove everyone into the next mission together. I found this very annoying in NWN2 because a party member would enter a store and we would all end up there no matter where we had been at the time he walked in.

Michael's way seems like it would work for method two since he's done the proper client/server setup for it.
#7
11/18/2011 (8:39 am)
And because I didn't ever get back to you on this - I apologize, and I must ruefully inform you that I managed to delete that project. I'll look around some more, though - I might actually have packaged it for installation.