Creating a single-player campaign with a customizable map order: doable?

ATTN: pro scripters and code monkeys!

My good friend and colleague and I have been discussing a mod project in the Source Engine (I’m assuming we’re talking a HL2-based mod, but if would be way easier with LUA in Gmod please let me know). He has this idea that may or may not be feasible in this particular engine.

Basically the concept is a sci-fi campaign in the vein of Mass Effect. The “default map” would be a spaceship interior*, which I posted some shots from a couple times here. In the spaceship, the player can travel to different planets in order to investigate leads to his final objective.

The problem is twofold. Firstly, is it possible to have a kind of ingame trigger that allows players to choose whether to go from Map A to Map B, or from Map A to Map C? And, having done so, return to any of those maps again?

Secondly, is there a way to dump certain datums of interest regarding the state of any given map (e.g. which objectives have been completed, which NPCs have been killed, relationship between the player and local factions, etc) into a file or the game memory, so that if the player returns to a planet they’ve already played through it won’t be exactly how it was when they arrived the first time?

Ultimately, he’d also like to make it a multiplayer campaign in which teams of players in different ships can visit different planets at the same time in the same game. But that’s a whole new can of worms and seems the least likely to me.

in space*

**the exterior is there too don’t worry

You can use multiple trigger_levelchange’s in a map to my knowledge. Therefor you set up one to go to A and one to go to C.

You’d use the same process to get back.

And you’d have to go to the coding section for factions and datums of interest.

Global entity name in properties?

“Name by which this entity is linked to another entity in a different map. When the player transitions to a new map, entities in the new map with globalnames matching entities in the previous map will have the previous map’s state copied over their state.”

[editline]12:11PM[/editline]

So simply have each NPC or whatever with a unique name, and in each map except the one with the NPC have a func_breakable with the corresponding name. If the NPC’s state is killed, then it theoretically will kill the func_breakable right? and vice versa when it reloads.

Probably a better idea to store the possible variables with a few global logic entities, like some math_counters for each possible mission’s checkpoint. It would be a little tedious to do it through Hammer alone, but it is possible.

This is the best system for creating global booleans. It may be a bit tedious, but it’s the best hammer way to make such a system.

Perhaps subtract one when you switch maps and add one when you load the next map, to trigger OnHitMax?

Yeah, I’m doing this in my mod.

If you want once specific hallway to branch off into multiple levels, you can pull up a VGUI screen when you reach the trigger and tell it which one to activate.