[Release] Dayz.Epoch.3d.Editor.Live.Mission WITH database interaction!

Sandbird

Valued Member!
Dayz.Epoch.3d.Editor.Live.Mission

2s0fde8.jpg

What it does....
A custom mission file for the purpose of testing/writing scripts for DayZ Epoch without the need of a server.
It emulates the dayz_server and dayz_mission files, for live testing of code inside the 3d editor.

Features
  • Fully working GUI, zombies, hit registration, addactions, everything!
  • Write code and execute it on the fly. No need to start a server and join with a client to test things.
  • Use 99% of your init.sqf and it will work ! (dynamic weather, default loadouts, custom scripts etc)
  • 2 setups. DefaultLoadout from init.sqf or a Fake database entry. (copy/paste your character info from the database)
  • Includes most of BIS_fnc functions, so actions like BIS_fn_invAdd will work (with some changes, see bellow)
Installation
Easy = Blue <10

DayzEpochTemplate.Chernarus
  1. Head over to the -=GitHub=- where the project is.
  2. Click -=Download=- on the right sidebar
  3. Extract the Chernarus mission file in your \My Documents\ArmA 2\missions
  4. Copy the DayzEpoch.bat file (included in the .zip) in your Arma2 OA root directory and execute it
  5. When the game launches, press Alt+E, select Chernarus, then Load and select mission DayzEpochTemplate
  6. Start editing your files located in \My Documents\ArmA 2\missions\DayzEpochTemplate with your customizations.
Customizing and Important Notes

Default setup vs Fake Database setup
There are 2 ways of initializing your player.
  1. The default Epoch loadout (like the one if your init.sqf)
  2. A manually entry of fake database data (coordinates, medical states, inventory etc)
The 1st way has no bugs (so far), and its the easiest thing you could start with.
Just open the dayz_code\init\setupChar.sqf and at the bottom of the file change the values to your liking.
Make sure in the init.sqf, DefaultTruePreMadeFalse is set to true; and also from there you can change the Default loadout of the player.

The 2nd option is a bit more complicated. It works, but sometimes it bugs out, when you select Restart instead of Loading again the Mission file.
I left the PlayerUID in the debug monitor...so IF you see that it is set to 0 then you know something went wrong...Just reload the mission file and you should be fine.
To setup your character with the second method open dayz_code\init\variables.sqf. The first 55 lines until //Model Variables is where the magic happens.

Some things have to be set twice. CharacterID and playerUID so we set them up here at first.

Code:
player setIdentity "My_Player";  //check description.ext file....There is no way to get the name of player otherwise in the editor.
player setVariable ["CharacterID", "1", true];  // same as the line 28 (Your charID. Must be the same number)
player setVariable ["playerUID", "111111", true]; // Your player's UID
Further down is our first fake database entry. The first and second value, leave it like that. The 3rd has to be the same value as the one above.
The only extra addition to this is the _survival state of the player. That is created in the dayz_server.pbo so i had to emulate the values.

Code:
  /*
     OK or Error   = _primary select 0;
     Is newPlayer (true/false) = _primary select 1;
     _charID           = _primary select 2;
     _isInfected (1/0)      = _primary select 3;
     _inventory         = _primary select 4;
     _backpack          = _primary select 5;
     _survival          = _primary select 6;  //last ate+ last drunk +totalminutes alive
     _model           = _primary select 7;
     _hiveVer           = _primary select 8;
   */
   primaryPre = [
   "OK",
   false,
   "1", // My charID
   "0",
   [["ItemMap","ItemWatch","ItemToolbox","ItemFlashlightRed","Binocular_Vector","M9SD","NVGoggles","ItemRadio","ItemEtool","ItemHatchet_DZE","ItemCrowbar","ItemMatchbox_DZE","M4A1_HWS_GL_SD_Camo","ItemKnife","ItemCompass"],["30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","FoodSteakCooked","ItemSodaCoke","PartGeneric","PartGeneric","PartWheel","PartWheel","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","ItemBandage","ItemBandage","ItemBandage"]],
   ["DZ_Backpack_EP1",[["AK_47_S"],[1]],[["ItemBloodbag"],[2]]],
   [4320,114.9,42.753],  // ------ This is the only extra thing i had to add: 4320 means 3 days (survival time) in minutes, 114.9: last ate, 42.753: last drunk  -----
   "TK_Commander_EP1_DZ",
   11];

The second part is this

Code:
 /*
     OK or Error     = _primary select 0;
     _medical      = _primary select 1;
     _stats        = _primary select 2;
     _state        = _primary select 3;
     _worldspace     = _primary select 4;
     _humanity       = _primary select 5;
     _lastinstance    = _primary select 6;
   */
   secondaryPre = [
   "OK",
   [false,false,false,false,false,false,false,6000,[],[0,0],0,[114.9,42.753]], // 6000 blood
   [10,20,1,22], // Kill stats
   ["M9SD","aidlpknlmstpsraswpstdnon_player_idlesteady02",42,["222222","333333"]],  //42 is the temperature, ["222222","333333"] are my friend UIDs
   [91,[4965.1968,10002.998,0.001]], // Coordinates
   11000,
   11];

This is the medical condition, kill stats, stance, friendlist, coordinates, humanity and instance of the player.

Like i said the 2nd option is a bit buggy, you have to reload or restart the mission sometimes, to get accurate results.
Most of the scripts you'll test/write should work fine...but if you want to write code for something that requires more complex stuff,
like for example that requires the friendsarray, then make sure the mission was loaded correctly.
Loading the mission again doesn not affect your custom scripts. It will reload the mission.beidi file.

The description.ext has your character's name in it. If you ever need to check player name...it will get it from there.

Code:
  class My_Player
   {
     name="DemoPlayer";
     face="Face20";
     glasses="None";
     speaker="Dan";
     pitch=1.1;
   };
Important info

Related to coding
Since this is an emulation of the dayz_server some things will never work.

For example:
_playerUID = getPlayerUID player; will never work in the editor.
To get the _playerUID you have to do this:
_playerUID = player getVariable ["playerUID", "0"];
This is the most important thing to remember. Lots of scripts use getPlayerUID. You have to remember to change it every time you want to use it.

Also some BIS_fnc functions have to be included in the dayz_code\init\compiles.sqf for them to work. For example i had to include:

Code:
BIS_fnc_invAdd = compile preprocessFileLineNumbers "dayz_code\system\functions\inventory\fn_invAdd.sqf";

If your code has BIS_fnc functions in it then check the folder dayz_code\system\functions for the function and include it in the compiles.sqf.

I am sure there is a way to parse the folder and add a BIS_ infront of all the files, like epoch does it...but i didnt want to waste time and ran into problems,
so manually adding the files is fine by me.

Use the debug option in the init.sqf if you are using the 2nd method (fake database entry). And ALWAYS check your RPT log file for debugging. Its located at : %AppData%\Local\ArmA 2 OA
Also you can enable this in your init.sqf :
Code:
DZEdebug = true; // Debug messages on log file

Dont let the file names trick you...These are heavily modified files...Dont overwrite them with your own files. Add to them instead of replacing them.

Related to mission file included
You'll notice when you start the mission there are 2 bots standing there. If you double click the soldier you'll see that he initiates this script scripts\BotInit.sqf.
I left that in purpose in case you want to do some scripting that requires 'another player', and you want to initialize the fake player like that.
The other bot can be deleted. I just left it there because i was testing a Tag Friendly script, and needed a 3rd 'player' that has me as a friend. (i got no friends lol).

In most of my scripts i use the playerUID to validate checks between owner and objects. Some default Epoch files use the characterID...meaning if you die...you lose ownership.
Thats why i changed most of the stuff to playerUID instead...If for some reason you are using scripts that check CharacterID instead of playerUID, i would suggest you change that, because some things (with the 2nd method) might not work...due to the fact that my files are checking playerUID for validation. Worst case scenario if you cant edit the files....just use the same CharacterID and playerUID...so its always the same :)

Hope this code will help you write code faster and easier
smile.png


-=Read more info in the Github. The forum doesnt allow more than 1000 characters=-​


 
Last edited:
Update:
- Rewrote the player_monitor.sqf and the setup_char for fake database entry. (Its cleaner now)
- Added definitions in description.ext hoping to fix if !(isNull (findDisplay 46)) then {} (its not working in the editor)
 
Update:
I got great news. I managed to rewrite all the vehicle CHILD type queries like this:
Code:
_key = format["CHILD:306:%1:%2:%3:",_objectID,_array,_damage];
And now i can normally spawn/retrieve vehicles, generate keys, unique UIDs, from a normal database using Arma2NET. I can unlock/lock cars and all checks come out fine !

One step closer to totally make this a true client/server emulator.
Still a long way to go to integrate player loadouts, epoch buildings etc....but now at least i know that it can be done.

This is gonna be epic. All functionality of a normal epoch server inside the editor.

Demo in action:
 
Back
Top