hebssket02 发表于 2010-8-26 13:59

浅谈一下VPK文件的打包与解包

最近看到有人在谈论VPK的打包与解包,为了授人与鱼,不如授人与渔,索性写下这个帖子,好让更多的L4D2高玩能创作出更多的附加元件来造福新手.


首先,VPK文件放置于Left 4 Dead 2left4dead2addons文件夹下,要学会打包VPK,我们必须先了解VPK文件的结构,要打开VPK文件就要下载GCF,全名是:gcfscape
请不要问我下载地址,谷歌百度不会用的人不需要看此贴.

安装好后,右键VPK文件,用GCF打开,以真实武器声效VPK为例:



我们看到maps和sound文件夹,这2个文件夹的作用便是替代Left 4 Dead 2left4dead2目录下,原版游戏的maps和sound文件夹.
还有一个addoninfo文本文件,这个文件至关重要,以该VPK为例:
// The addoninfo.txt file is a metadata file that is required by all Source Engine Add-ons.

"AddonInfo"
{
   addonSteamAppID         550                                                // 550 is the app ID for Left 4 Dead 550代表游戏ID为L4D2
   addontitle            "Sound Mix Pack v1.0"                              // Add-on title that shows up in Add-ons list. ~20 chars max
   addonversion            1.0                                                // Version number of add-on version of the form <major>.<minor>
   addontagline            "Best sounds."                                        // Add-on tagline or wrap-up- a short description. ~100 chars max
   addonauthor             "Nepumax & Anders"                                        // Name/alias of the author
   addonSteamGroupName   ""                                                      // (Optional) Steam group related to the add-on. We use this to construct a URL to the group page.
   addonauthorSteamID      ""                                                      // (Optional) Steam ID of author. We use this to construct a URL to the author's page.
   addonContent_Sound             1                                                      // This addon provides muliple connected maps with a finale   允许该VPK替换所有游戏地图中的武器声效
   addonURL0               "http://www.fpsbanana.com/sounds/games/3456"      // An html home page for the add-on that includes a download link.

   // short description that appears in the Add-on list screen...
   addonDescription      "Replaces weapon sounds (fire & reload) plus some physics sounds."    这里是VPK文件的介绍.
}

在整段文本里面,最重要的便是addonSteamAppID 550,addonContent_Sound 1,它们分别代表了游戏ID和允许替换或添加的项目,可以替换和添加的还有:
   addonContent_Sound                                 1                                             
   addonContent_Campaign                        1                                                      
   addonContent_Map                                 1                                                         
   addonContent_Skin                                 1                                                      
   addonContent_Weapon                           1                                                      
   addonContent_BossInfected                     1                                                      
   addonContent_CommonInfected                  1                                                      
   addonContent_Survivor                           1                                                      
   addonContent_Script                              1                                                      
   addonContent_Music                              1                                                      
   addonContent_prop                                 1                                                      
   addonContent_Specified                           1

看到这里,我们要打包VPK的步骤便很明了.
第一,Left 4 Dead 2left4dead2文件夹下的所有文件夹和文件都可以通过VPK修改打包.(必须按照文件夹顺序)
第二,把改好的文件夹例如maps,在旁边添加一个addoninfo文本,在这个addoninfo文本里面按照上面的例子略微修改,添加一句   addonContent_Map 1
第三,找到求生的SDK,以我的游戏目录为例F:Program FilesSteamsteamappscommonleft 4 dead 2bin文件夹下有一个vpk.exe,建立快捷方式.
第四,把要打包的maps文件夹和addoninfo文本放到一个新的文件夹,名字随意,把这个文件夹拖放到刚建立的快捷方式上面,它会在这个快捷方式的目录生成vpk文件.


如果没有正版的求生要想用SDK怎么办?下载steam,再下载免费的Alien Swarm,接着你可以在steam的工具里找到Alien Swarm的SDK,下载完和求生一代二代都通用.

kftflnee 发表于 2022-10-28 02:44

666666666666666666666666666

唐僧洗头用飘柔O 发表于 2022-12-9 09:21

请问一下,能否知道原始的语音列表文件夹在哪里,我需要弄出来搞个自制语音,百度了半天也找不到解决
页: [1]
查看完整版本: 浅谈一下VPK文件的打包与解包