Left 4 Dead 2

Left 4 Dead 2

Left 4 Fun Sample Mods
 此主题已被置顶,因此可能具有重要性
smilzo  [开发者] 2019 年 4 月 25 日 上午 11:22
How to make a mod for the L4F mod system
Simply create a text file in the 'left4dead2/ems/left4fun/mods/' folder and name it <the name you want>_<gamemode>.txt (game mode is the game mode this mod will work on, example: coop).
Open the file with any text editor and start adding lines in the format 'cvar value' for any cvar you want to change, save the file, done.
Just make sure to reset all the changed cvars to their defaults in the mod's "_undo" file (Since the Last Stand update the cvars do reset at the end of each map so the _undo file for your mod is not needed anymore).

This is an example mod file from the 'l4f_fun_coop.txt' contained in this addon:
l4f_include "include/l4f_fun" boomer_leaker_chance 15 z_tank_health 5000 z_boomer_limit 4 z_charger_limit 4 z_hunter_limit 4 z_jockey_limit 4 z_smoker_limit 4 z_spitter_limit 4 l4f_supershove all l4f_supershove_type stagger l4f_supershove_onadmin true l4f_director.AggressiveSpecials 0 l4f_director.cm_AggressiveSpecials 0 l4f_director.MaxSpecials 4 l4f_director.cm_MaxSpecials 4
With 'l4f_include "<include file name without .txt>"' you can tell L4F to include the cvars contained in the specified file, this is useful if you have cvar changes that will be in common with other mods.

Click here for the list of the official game cvars.
Click here for the list of "extra" cvars.

Now open the game, activate your mod on L4F by typing '!settings mod <your mod file name without _coop.txt>' and then '!restart' to make L4F load your mod.
You can make changes to your mod file while you play without the need to restart the game, just type '!restart' or wait till the next chapter to see the changes.

If you want to see the other mods of this Sample Mods addon, open the relative .vpk file from the left4dead2/addons/ with GCFScape and extract the content to your pc, you will find all the mods in the 'root/ems/left4fun/mods/' folder.

In the 'ems/left4fun/zombiedrops/' folder you will find the configuration files used by the by L4F to spawn certain items when an infected dies (if the fake cvar l4f_zombiedrops is set to true).
There is one file for each map, if the file does not exists, L4F will create a default one for that map.
Example of a configuration file:
// common (this is just a comment and will be ignored by L4F) common,5,0,melee,pistol_magnum common,2,0,pistol common,5,0,molotov,pipe_bomb,vomitjar // special special,50,35,tier1 special,50,0,pain_pills,adrenaline special,40,0,first_aid_kit // witch witch,90,35,tier1 witch,50,0,first_aid_kit,defibrillator // tank tank,100,45,tier1 tank,80,45,tier1 tank,60,45,tier1 tank,100,0,first_aid_kit tank,90,0,first_aid_kit tank,90,0,first_aid_kit,defibrillator tank,80,0,first_aid_kit
Each line is in the format:
<infected type>,<chance of spawning one of the following items>,<chance that the spawned item will get a laser sight>,<comma delimited list of items to choose from>

NOTE: each line spawns only 1 item, which is randomically chosen from the given list.

The infected type can be one of the following: common, special, tank, witch.
In the list of items you can use the name of the item or one of the following keywords: melee (random melee weapon), tier1 (random tier 1 gun), tier2 (random tier 2 gun).

You can tell L4F to spawn one or more of an item (with same or different spawn chance) at the same time by adding multiple lines for the same infected type like in the example above.
最后由 smilzo 编辑于; 2020 年 10 月 7 日 上午 10:30