Entropy : Zero 2

Entropy : Zero 2

53 ratings
[Hammer] Custom Player Characters
By 1upD and 2 collaborators
This guide will show you how to set up a map where the player character is a Civil Protection officer / metrocop instead of a Combine elite like in the Entropy : Zero 2 campaign. Knowledge of Hammer is assumed.
3
   
Award
Favorite
Favorited
Unfavorite
About this guide
This guide will give information about how to set up a map with a custom character, in this case a Civil Protection officer similar to Bad Cop in Chapter Zero.

It is assumed that you already know how to make maps using Hammer editor and that you have Hammer configured for Entropy : Zero 2.

Requirements
  • Hammer configured to map for Entropy : Zero 2
  • Knowledge of how to make maps with Hammer
  • GCFScape (or another tool which can open VPK files)
Custom weapon viewmodels
As a feature of Mapbase, weapon scripts can be overwritten on a map by map basis. You can use weapon script overrides to replace the viewmodels used by a weapon.

Example

Navigate to Steam/steamapps/common/EntropyZero2/entropyzero2/maps. This is where all the maps installed with the game are stored.

In the maps folder, you should see some text files related to particular maps. For an example, look at ez2_c0_1_weapon_pistol.txt.

ez2_c0_1_weapon_pistol.txt is a copy of weapon_pistol.txt from Entropy : Zero 2's "scripts". (You can find all the scripts within EZ2's vpk files) However, it has this line:

"viewmodel" "models/weapons/madcop/v_pistol.mdl"

This tells weapon_pistol use "models/weapons/madcop/v_pistol.mdl" as its view model. This is a viewmodel that was made particularly to represent Bad Cop in Chapter Zero.

Step 1: Locate the weapon script you want to override

For our example, let's say you want to update the 357 to use metropolice arms.

Make sure you are using the latest version of EZ2 (not opted into any betas)

Navigate to Steam/steamapps/common/EntropyZero2/entropyzero2/ez2. Open up ez2_dir.vpk with GCFScape or another VPK tool.

Look in the "scripts" folder within the VPK. Locate weapon_357.txt. This is the weapon script for the 357.

Extract this file.

Step 2: Create a weapon script override for your map

Take the copy of weapon_357.txt from the previous step. Place it in your "maps" folder, adjacent to the map you are working on. Rename the file to <your_mapname>_weapon_357.txt.

WARNING! The file name must match the name of your map without the extension exactly, otherwise it will not apply.

Step 3: Update your viewmodel

Open up <your_mapname>_weapon_357.txt. Find the line for "viewmodel".

"viewmodel" "models/weapons/ez2/v_357.mdl"

Update this line to reference your viewmodel. In our case, we want the EZ1 as opposed to EZ2 version.

"viewmodel" "models/weapons/ez1/v_357.mdl"

Save the file. You now have a weapon override that will make your weapon 357 in your map into a Metrocop version.

Custom weapon viewmodels conclusion

If you are shipping a workshop addon, be sure to include your weapon script overrides in the maps folder adjacent to your map file. You can repeat this for all of the weapons. If your addon has multiple maps, you will need to make a copy for each map.
Custom suit equip model
About item_suit equip animations

The view model which item_suit uses for hands when you first pick up the item is stored in a ConVar. This model will be instantiated at the moment item_suit is picked up.

The model path of the suit equip animation is stored at:
sv_player_hands_modelname

You may also wish to disable the equip animation for the suit altogether. You can do this with a key value on the item_suit entity in Hammer.


About game_convar_mod

Entropy : Zero 2 is based on Mapbase. Mapbase adds an entity called game_convar_mod which can be used to change ConVars from within a map.

Mapbase entity list: https://github.com/mapbase-source/source-sdk-2013/wiki/Entity-List

Changing item_suit hands viewmodel in Hammer
Create a game_convar_mod anywhere in your map. Cal it "<mapname>_mod" or whatever name you think is appropriate.

In the "ConVars" key in entity properties, assign the value to this:
sv_player_hands_modelname "models/weapons/ez1/v_hands.mdl"

This assumes your model path is "models/weapons/ez1/v_hands.mdl". Use the correct path for whatever hands model you would like for your inspect animation.

Create a logic_auto entity. From the output "OnMapSpawn", trigger the input "Activate" on the entity "<mapname>_mod".

WARNING - You may only have one game_convar_mod active at a time! If you need to modify more than one convar, please add the extra convars to the ConVar field separated by semicolons.

Example:
sv_player_hands_modelname "models/weapons/ez1/v_hands.mdl"; some_other_convar 1
Custom player character voice
About player responses

Bad Cop's voice is controlled by the same response system as NPCs. You can read more information about the response system on the VDC.
https://developer.valvesoftware.com/wiki/Response_System

In particular, there is a response context which tells the game that the speaking entity is the player. This context is called "classname" and normally corresponds to the entity classname of a speaking entity.

Mapbase allows you to override this context within a map, which can be used to swap the voice of any character.

Changing the player's voice in-game using the developer console

  1. Open the developer console.
  2. Enter the following command:
    ent_fire !player AddContext "classname:npc_metropolice"
  3. Test out different voicelines by entering combat. You should no longer hear Bad Cop's voice, but instead a metrocop's.

Changing the player's voice in Hammer

Create a logic_auto entity. From the ouptut "OnMapSpawn", trigger the input "AddContext" on "!player". Set the parameter to classname:npc_metropolice.

Custom player character voice conclusion

You can use this technique to swap the player's voice to any existing NPC that uses responses. Some NPCs will not have compatible response rules with the players' responses.

If you want the player to be silent altogether, you can just assign a classname that has no responses. For example "classname:none".

You can also use this technique to create entirely custom voices. For more information, please see the response system guide:
https://sp.zhabite.com/sharedfiles/filedetails/?id=3249391340
Changing max armor back to 100
About max armor

The maximum armor the player can have in EZ2 is controlled by a ConVar. These are variables you can set in the developer console or in configuration files.

The value for maximum armor is:
sk_suit_maxarmor

About game_convar_mod

Entropy : Zero 2 is based on Mapbase. Mapbase adds an entity called game_convar_mod which can be used to change ConVars from within a map.

Mapbase entity list: https://github.com/mapbase-source/source-sdk-2013/wiki/Entity-List

Changing max armor in Hammer
Create a game_convar_mod anywhere in your map. Cal it "<mapname>_mod" or whatever name you think is appropriate.

In the "ConVars" key in entity properties, assign the value to this:
sk_suit_maxarmor 100

Create a logic_auto entity. From the output "OnMapSpawn", trigger the input "Activate" on the entity "<mapname>_mod".

WARNING - You may only have one game_convar_mod active at a time! If you need to modify more than one convar, please add the extra convars to the ConVar field separated by semicolons.

Example:
sk_suit_maxarmor 100; some_other_convar 1
Changing NVG color
About NVG color

The NVG color is applied using Source's color correction system. We have a separate color correction file for the red NVG. When you turn on NVG, this color correction is applied.

The filename to look in for NVG is actually stored in another convar. Please see the previous step in this guide for information about convars.

The ConVar that stores the name of the NVG color correction file is:
sv_flashlight_cc_filename

Changing color correction in Hammer
Per the previous step in the guide, create a game_convar_mod anywhere in your map. Cal it "<mapname>_mod" or whatever name you think is appropriate.

In the "ConVars" key in entity properties, assign the value to this:
sv_flashlight_cc_filename ez2_overworld_simple.raw

ez2_overworld_simple.raw is a color correction filter that happens to have a nice Cyan blue color that lines up well with the metrocop vision. It is used for metrocop NVG in Chapter Zero.

Create a logic_auto entity. From the output "OnMapSpawn", trigger the input "Activate" on the entity "<mapname>_mod".

WARNING - You may only have one game_convar_mod active at a time! If you need to modify more than one convar, please add the extra convars to the ConVar field separated by semicolons.

Example:
sk_suit_maxarmor 100; sv_flashlight_cc_filename ez2_overworld_simple.raw
Change the player character's kick model
About the kick

Kicking uses a separate viewmodel that is distinct from the weapon / hands model. Normally it is stored in models/weapons/ez2/v_kick.mdl.

You can change the kick viewmodel by firing an output to a logic_playerproxy entity. You can read more about logic_playerproxy on the VDC.
https://developer.valvesoftware.com/wiki/Logic_playerproxy

Assigning a new kick viewmodel in Hammer

Create a logic_playerproxy entity. Name the entity "playerproxy" or some other name.

Create a logic_auto entity. From the output "OnMapSpawn", trigger the input "SetLegModel" on the entity "playerproxy". Give the input a parameter of models/weapons/ez1/v_kick_police.mdl.
Change the player's ragdoll
In Entropy : Zero 2, when the player character dies, they drop a ragdoll like an NPC. In order to change the ragdoll, simply change the world model of the player entity. You can test this in the developer console with this command:
ent_fire !player SetModel "models/police.mdl"

In Hammer, you can fire an output from a logic_auto Entity "OnMapSpawn" to trigger the player's SetModel input just like the command above.
20 Comments
jimothy 11 Dec, 2023 @ 7:06pm 
*Fixed, sv_player_hands_modelname "models/weapons/ez1/v_hands.mdl"
Remove the "s.
Thank you dimitri
jimothy 11 Dec, 2023 @ 3:49pm 
Hey, I`m having trouble with the ConVar for changing the suit equip to a metrocop one. I receive an error in the console once compiled and a model error.
`Late prechache of model models/weapons/ez1/v_hands.mdl`
Portable Water 20 Mar, 2023 @ 8:39pm 
straight fax
1upD  [author] 10 Mar, 2023 @ 6:01pm 
I know, I created instance_player_is_metrocop. For the purposes of the guide, it's better not to use that instance. Because a metrocop is just an example - mappers might wish to have any custom character they want to create stories about. That instance is a good example but for the purposes of the guide I wanted to go through each aspect separately.
Portable Water 10 Mar, 2023 @ 2:35pm 
There is a func_instance in mapsrc/DreamSeq that has all of the relevant hammer editor settings in play already. It's called instance_player_is_metrocop.
Danskart 27 Feb, 2023 @ 10:15am 
alr is working thank you :steamthumbsup:
1upD  [author] 27 Feb, 2023 @ 10:09am 
When you said "I don't see the input", did you mean in the I/O window in Hammer? As in, you're trying to add an output to an entity that dispatches an input to a different entity. If "SetLegModel" is not an input in the drop down list, just type it into the box.
Danskart 27 Feb, 2023 @ 10:04am 
im sorry but where exactly?
1upD  [author] 27 Feb, 2023 @ 10:02am 
It should work in-game. Just type it in in Hammer.
Danskart 27 Feb, 2023 @ 10:01am 
i mean in hammer