Trip down memory lane – the great Steampipe Update of 2013 and custom models

It was a dark and stormy night..

Back in 2013, Valve released the massive steampipe update. It was a pretty awesome change over all – differential updates were pretty important, but various changes to the VFS happened, and an annoying quirk that came out of it was the model chooser in HL2DM – it didn’t work anymore – and still doesn’t!

Way back in the day – Foo hacked up a quick work around for the Half-Life model chooser problem in Sourcepawn – sm_modelchooser_hl2dm.sp

In designing the interface for the plugin, we also wanted to make it super easy for players to change their model. We added a menu to the Sourcemod !settings menu, but also (and somewhat elegantly even) added support to make model setting even easier. Rather than worrying about players or admins needing to know exact model file names etc, we coded the command handler to search for partial matches within the array of models:

new String:Models[19][70] = {
	"models/combine_soldier.mdl",
	"models/combine_soldier_prisonguard.mdl",
	"models/combine_super_soldier.mdl",
	"models/police.mdl",
	"models/humans/group03/female_01.mdl",
	"models/humans/group03/female_02.mdl",
	"models/humans/group03/female_03.mdl",
	"models/humans/group03/female_04.mdl",
	"models/humans/group03/female_06.mdl",
	"models/humans/group03/female_07.mdl",
	"models/humans/group03/male_01.mdl",
	"models/humans/group03/male_02.mdl",
	"models/humans/group03/male_03.mdl",
	"models/humans/group03/male_04.mdl",
	"models/humans/group03/male_05.mdl",
	"models/humans/group03/male_06.mdl",
	"models/humans/group03/male_07.mdl",
	"models/humans/group03/male_08.mdl",
	"models/humans/group03/male_09.mdl"
}

This way, players could simply choose a team to play on using something like this:

!model female
!model male
!model combine

But if they wanted to be super-specific, they could use:

!model male_01
!model female_03 

instead. All in all, we were pretty happy with the easy work around for the problem of models back then, and looking back on this plugin – we’re still amused it’s alive and kicking 🙂

Configuring custom weapon modes on a per map basis

We were recently asked how to go about configuring a multiplayer Half-Life 2: Deathmatch server to support different game modes depending on maps. 

The owner wants to offer varying environments for players to play in, and luckily our weapon manager plugin was designed with this specific goal in mind!

We elected to use the most excellent mapconfigs plugin by bcserv to handle the actual task of setting which set of weapons maps would use.  In this case, we set it up so that maps prefixed with “de_” would use sniper weapons only, with remaining maps using default weapons.  

First things first though:  Deciding which weapons players would spawn with and whether other weapons would be allowed.  

We setup defined two weapon modes:

default” gives shotgun, crowbar, pistol, smg1, slam, 357, crossbow, frag, physcannon.  For giggles, we set the 357 magnum to allow firing under water – we were curious to see who figured out they can snipe with the fishes!  

sniperxbow” – my personal favorite, the perfect combination for a neo-style fire and forget physics weapon, and a 357 magnum for those times when you’re sneaking in the bushes.  For this mode, we set the option to not allow weapon pickups from the map.  

"default"
{
  "options"
  {
    "pickupothers"  "1"     // 1 - Players can pick up any weapons they find on the map.  0 = deny pickups of other weapons
  }

  "weapon_shotgun"
  {
    "default"       "1"     // Make the Shotfun the default weapon
  }

  "weapon_crowbar"
  {

  }

  "weapon_pistol"
  {
    "p_underwater" "1"    
  }

  "weapon_smg1"
  {
  }

  "weapon_slam"
  {

  }

  "weapon_357"
  {
    "p_underwater"  "1"     // Primary attack fires under water

  }

  "weapon_crossbow"
  {

  }

  "weapon_frag"
  {
  }

  "weapon_physcannon"
  {

  }
}


"sniperxbow"
{
  "weapon_crossbow"
  {
  }

  "weapon_357"
  {
    "default" "1"
  }
  "options"
  {
    "pickupothers"  "0"     // 0 - can't pick up any other weapons than those listed here
  }
}

With these settings added to addons/sourcemod/configs/weaponmanager.cfg it was now time to setup the sniper maps to use the sniperxbow weapon mode.

bcserv’s mapconfig plugin is pretty simple to configure.  mapconfig looks for a configuration file for the current map in based on map prefix, so if we’re playing a map named “de_xyzzy” – mapconfig will first try to read “de_.cfg”, then “de_xyzzy.cfg”.  More technical information about the mapconfig configuration and plugin can be found on the AlliedModders forum.

In this case we set it up as follows:

From the hl2mp server folder, create:

cfg/sourcemod/map-cfg/de_.cfg

and add the line:

sm_weaponmanager_defaultmode sniperxbow

With this in place, every map that starts with de_ will run the sniperxbow weaponmode.  The best part is for specific maps (eg: de_xyzzy), if we wanted to add a slightly different configuration (lets call it “xyzzy” mode, we could create a new weaponmode that grants the crossbow, 357 and crowbar!

"xyzzy"
{
  "weapon_crossbow"
  {
  }

  "weapon_357"
  {
    "default" "1"
  }
  
  "crowbar"
  {
  
  }
  
  "options"
  {
    "pickupothers"  "0"     // 0 - can't pick up any other weapons than those listed here
  }
}

Then in we would create a new mapconfig file named cfg/sourcemod/map-cfg/de_xyzzy.cfg

and add the command:

sm_weaponmanager_defaultmode xyzzy

We can also add extra commands too, so that only de_xyzzy runs them.  For example:

sv_gravity 600
sm_playerspeed_infiniterun "1"

would adjust the gravity for this map only and also let players run infinitely without recharging.

Easy peasy!