How To Include Modified DayZ Files & Community Fixes In Your Maps
This post was updated on .
This is something everybody can do and it should help consolidate the multitude of map and DaiyZ version releases as well as fix things Rocket hasn't gotten to yet, or is simply ignoring in favor of other things.
This guide assumes you are familiar with the following:
-Know how to decompile a *.pbo file
-Know how to use the ArmA 2 in-game 2D editor
-Know how ArmA 2 missions (maps) files are structured
-Know basic scripting (syntax adjustments; cut & paste) using Notepad, Notepad++, ArmaEdit, etc.
-Know how to compile the map (*.pbo) once changes are made
We will use my recent edits that enable Zombies to attack players in vehicles since this is a perfect example of how and where you should use this method:
1) The files I edited where originally found in the dayz_code.pbo. So, I used Eliteness and decompiled the .pbo into its various source directories, sub folders and script files.
2) I then edited the following files:
3) Normally I would have to repack the "dayz_code.pbo" and include this as part of my download package along with my map... But this forces players to have to back up files in their DaiyZ addon folder and this means more chances to screw things up if they are not tech savvy. So, instead, we are going to use the method dedicated ArmA 2 (DayZ) servers use to push out bug fixes and game play tweaks to their clients without them having to download anything even if changes in the core game files (e.g. dayz_code.pbo) are made.
4) You should already have a version of a DaiyZ map you are currently working on e.g. DaiyZ_v42F_Chernarus.
It should be in the following directory where custom ArmA 2 missions (SP and MP) are saved:
6) Following the example from above, paste the two files I edited into this new sub folder:
7) Open up the file init.sqf using Notepad, Notepad++, etc.
It will have a lot of code, but the important thing you want to look for is...
isServer = false;
This tells the game whether or not you are running the mission on a LAN, or Internet server. Since most of you will be releasing SP missions, this is the section you want to paste all of your edits & fixes under since you are NOT running the mission on a LAN, or dedicated server.
8) Now, here is the key that allows the changes I made to "payer_spawnCheck.sqf" and "player_zombieAttack.sqf" to take effect without players having to download anything else except the map they are included in.
Paste the following (everything below the dashed lines) in your init.sqf file under "isServer=false;":
Tells the game what files and functions to override in the original "dayz_code.pbo".
// original function
player_spawnCheck_orig = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_spawnCheck.sqf";
player_zombieAttack_orig = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieAttack.sqf";
Tells the game to confirm the original functions are working before allowing the files in the "fixes" sub folder to override them.
Like I said, it is kind of backward, but the result is what matters.
9) Now that we have set up our mission file so it overrides the commands in the original "dayz_code.pbo" we need to recompile the map (mission), so we can distribute it to other players.
There are two ways to do this:
A) The easiest way is to load up the mission in the editor (after changes to the "init.sqf" are made) and just export it as a SP mission.
B) The second method is to use a program like Eliteness, or cpbo to repack the mission files directly.
Either method is fine, but I prefer the in-game mission editor because it is 100% error free versus other tools.
All you have to do is put your map file up for download and any changes you made/include in the mission should work on the players machine when they load the map.
NOTE: Not all modifications can be done this way.
For example, if you want to unban all ArmA 2 weapons and vehicles you cannot use this method. You have to install a third-party mod and run it alongside DaiyZ. The same goes for anybody who wants to play your map if it is dependent on third-party mods. They must also have the third-party addon installed and running or else they will get errors saying they can't play the map because it is dependent on content that is missing, or deleted.
My hope is this method will not only reduce the number of custom DaiyZ installs, but also map versions, too.
The main benefit is whenever new versions of DayZ are released, custom functions should still work since this method overrides those functions regardless of version number (unless Rocket does a complete overhaul of the function, obviously).
The other major benefit of using this method is it also keeps things organized because all a developer has to do is look at the "init.sqf" and he/she can see exactly what files were modified instead of having to dig through each and every one if they simply want to adjust things further.
I note how you say "Not all modifications can be done this way."
Can we, for example, rip off cfgLoot from DayZ Takistan, adapt the DaiZy map for Takistan and end up with a DaiZy Takistan "mod" using the server push to client?
If so, you know what I'll be working on.
Cfg files can't be overwritten from the mission (map) level.
If it were this easy, we wouldn't have to use third-party mods to unlock all the default ArmA 2 weapons, vehicles and skins Rocket banned even before the hackers and script kiddies became a problem. This is something I hope ArmA 3 has by default because it will make modding that much simpler for legit players. The downside is well, you know...