Jump to content

[Release] Dayz.Epoch.3d.Editor.Live.Mission


Sandbird

Recommended Posts

Dayz.Epoch.3d.Editor.Live.Mission

 

2s0fde8.jpg
-=Youtube Demo=-

 

What is this

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.
  • 99% of your scripts should 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

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 in 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.

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.

    /*
        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

    /*
        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.

    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.

findDisplay 46 does not work in the editor :/ so scripts like the CCTV wont work

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:

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 enable this in the init.sqf if you want more details:

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 :)

 

Example on how to use the superadmins.sqf (for actions restricted to admins only, just add your fake UID in the array)

 

(In your fn_self_actions.sqf)

 //_adminList = call compile preProcessFileLineNumbers "superadmins.sqf";  // This line is already at the top of the file.

 _cursorTarget = cursorTarget;
 _typeOfCursorTarget = typeOf _cursorTarget;
 _ownerID = _cursorTarget getVariable ["CharacterID","0"];
 _playerUID = player getVariable ["playerUID", 0];

     // Example on how to use _adminList
  if((typeOf(cursortarget) == "Plastic_Pole_EP1_DZ") and _ownerID != "0" and (player distance _cursorTarget < 2)) then {
  if (_playerUID in _adminList) then {
     cutText [format["Plot Pole Owner PUID is: %1",_playerUID], "PLAIN DOWN"];
   };
  };

Bugs

  • I disabled the call player_switchModel, on the Fake database method..meaning it wont switch the player to your skin when you press Preview, because it deletes one player and creates a new one. When this happens it kinda breaks tons of stuff. If you want to enable it its at line 70 in the dayz_code\init\setupChar_Database.sqf
  • Sometimes the player will spawn twice. That's because when you Preview the map you are also the Server and the Player. The code runs twice....hence the bugs with the 2nd method with the fake database.
  • Sometimes the dayz_Login and Setup method get all messed up cause in the 3d editor you have to have a Playable character for the mission to start...but dayz server doesnt work this way. I did my best to 'ignore' the manually added player in the beidi file and use the player the game makes (2nd method) but sometimes this whole isServer isPlayer as well messes up things.
  • There are no .fsm files so dont try to include them. 3d editor will not work with them, thats why i broke the player_monitor.fsm to 2 .sqf files...One emulates 'login to the server', and one 'setup of player'.
  • findDisplay 46 doesnt work :/ in editor...if anyone knows a way to make it work...please post it.

 

Final Notes

These files took me alot of time to make. It wasnt easy, and i am sure you'll find bugs or some things could have been writen a better way.
The whole purpose of this project was to not waste any more time trying to code on this god forsaken Arma engine. I cant believe that there isnt an option to write code 'on the fly'. With a proper debugger...
Sure there are little tricks and hacks you can add to diag_log variables, but to write an actual script that requires interaction with the environment or beta testing custom script ??? Forget it.
I've included the Deploy bike and Self bloodbag scripts in the pack...just to see how easy it is to add/run/debug them. (Check the youtube video).

 

And a personal note....You will NEVER find an easier way to code stuff for Dayz....period. I've been begging both here and on Opendayz for a Guru to point me to the right direction for fast coding/debugging code in  Dayz and i got nothing. Only some debuggers for a glorified diag_log option. This is the fastest way to write code and see it in action.

Hope this code will help you write code faster and easier :)

Link to comment
Share on other sites

I cant get it running. There is no mission file to select in the editor.

 

You extracted it in your mission folder right ? Not the MPMissions folder.

My Documents\ArmA 2\missions\DayzEpochTemplate.Chernarus

 

Just make a new empty mission, add a Center, a Group and a player unit and save it as a normal mission, just to see where it saves it, and also the structure of the folder so you can get an idea on how and where it should go...Its really easy :)

Is this your first try on SP missions ?

Link to comment
Share on other sites

Yeah you are lucky. This will save you HOURS and HOURS in debugging.

Dont expect it to work for database queries etc...but still its the only way to test things fast.

You'll see when you get deeper into scripting and you need to do the whole server/client thing how time consuming it is to debug stuff :/

BIS should have thought about this when they were making the game.

Sure Arma was not meant to be Dayz or with databases etc. But after they got so much $$$ from Dayz they should have done something about it :/

Link to comment
Share on other sites

I can tell you it's even time consuming with a modern engine. Offline is always easy. In most new engines it's just a one button solution. Press play and you can test after 2 sec.

But it's getting messy as soon as you try to something in network. At work it takes up to 3min to test something with 2 clients connected. And that with the quite new UE4 engine. Haven't seen an awesome solution for that yet. :D

Link to comment
Share on other sites

  • 2 weeks later...

Hey this template is great! Is just what i was looking for! but i can see that when i run it, it has your custom made traders, is there a way to get a template of the default ones that come with default epoch mission?

 

If so, how do i do it?

 

thanks in advance!

Link to comment
Share on other sites

Hey this template is great! Is just what i was looking for! but i can see that when i run it, it has your custom made traders, is there a way to get a template of the default ones that come with default epoch mission?

 

If so, how do i do it?

 

thanks in advance!

 

Its easy, just replace my mission.sqm, server_traders.sqf with the files found in the dayz epoch 11 folder.:

 

DayZ_Epoch_Server_1.0.4.2a_Release.7z\MPMissions\DayZ_Epoch_11.Chernarus\

 

Of course traders dont work....they need database interaction to work.

Link to comment
Share on other sites

Hey! i just replaced your mission.sqm and server_traders.sqf with the default ones from (\MPMissions\DayZ_Epoch_11.Chernarus\) and your trade zone edits are still there. 

 

Oops my bad...i forgot i left the default value in the init.sqf.

Search for lines (in init.sqf)

    call compile preprocessFileLineNumbers "dayz_server\missions\DayZ_Epoch_17.Chernarus\dynamic_vehicle.sqf";    
    _nil = [] execVM "dayz_server\missions\DayZ_Epoch_17.Chernarus\mission.sqf";

replace with:

	call compile preprocessFileLineNumbers "dayz_server\missions\DayZ_Epoch_11.Chernarus\dynamic_vehicle.sqf";	
	_nil = [] execVM "dayz_server\missions\DayZ_Epoch_11.Chernarus\mission.sqf";
Link to comment
Share on other sites

Ok i figured it out, after you replace mission.sqm, server_traders.sqf and replace the line in the init.sqf:

call compile preprocessFileLineNumbers "dayz_server\missions\DayZ_Epoch_11.Chernarus\dynamic_vehicle.sqf";	
	_nil = [] execVM "dayz_server\missions\DayZ_Epoch_11.Chernarus\mission.sqf";

you need to go into @dayZ_Epoch_Server\addons then unpack the dayz_server.pbo, after that you go into missions and copy DayZ_Epoch_11.Chernarus folder into DayzEpochTemplate.Chernarus\dayz_server\missions

 

Is just something "Sandbird" forgot to mention and got me a little bit confused but i managed to figure it out!

 

Thanks so much :D

Link to comment
Share on other sites

Ok i figured it out, after you replace mission.sqm, server_traders.sqf and replace the line in the init.sqf:

call compile preprocessFileLineNumbers "dayz_server\missions\DayZ_Epoch_11.Chernarus\dynamic_vehicle.sqf";	
	_nil = [] execVM "dayz_server\missions\DayZ_Epoch_11.Chernarus\mission.sqf";

you need to go into @dayZ_Epoch_Server\addons then unpack the dayz_server.pbo, after that you go into missions and copy DayZ_Epoch_11.Chernarus folder into DayzEpochTemplate.Chernarus\dayz_server\missions

 

Is just something "Sandbird" forgot to mention and got me a little bit confused but i managed to figure it out!

 

Thanks so much :D

 

Yeah, basically

 

Server traders have to be in the root folder (whichever you want, 11 or 17)

call compile preprocessFileLineNumbers "server_traders.sqf";

mission.sqm file is loaded automatically by the editor when you Load the mission....so just extract the one you want from the dayz epoch server files (in the dayz_server.pbo yes)

 

mission.sqf is created automatically by the editor when you Save the mission, and its based on the mission.biedi file....So dont play with this .sqf...it will get overwritten by the editor if you ever Save the mission in the editor

instead extract the dayz_server\missions\DayZ_Epoch_11.Chernarus\ in the root mission folder (as you can see i have already a dayz_server folder there for that reason)

and call the new files like this:

call compile preprocessFileLineNumbers "dayz_server\missions\DayZ_Epoch_11.Chernarus\dynamic_vehicle.sqf";    
_nil = [] execVM "dayz_server\missions\DayZ_Epoch_11.Chernarus\mission.sqf";

If you want to play with the Trader's menu, i would suggest to do that tweak that loads the trader menu from .sqf files instead of the database. The 'tweaks' are mentioned somewhere here in the forum.

 

I've managed to get database interaction in the editor...I just have to tweak the whole mission file to (including the fake login method) to fully get a server/client emulation.

My plan is to make everything to work properly (with database interaction, even traders).

I am talking about building options, trader buy/sell, everything...to fully emulate the server and the client operations.

Link to comment
Share on other sites

Could we possible get a default template for other maps such as NAPF? Also if I place items while in preview mode, will they show up in the SQF after a save. If so this could allow a whole knew level of map additions as placement and snapping would allow us to build massive structures easily and import them as sqfs to the server.

Link to comment
Share on other sites

Napf shouldnt be a problem...if epoch files are the same in every map...all you have to do is change any reference to instance id 11 or 17 to the one napf uses and also use your napf mission.sqm but adding my mission.sqm additions. The player, and bot but at some coordinates relative to napfs'.
Also in the init.sqf change the mission file from the dayz_server folder and then add your napf mission to the folder.
That should do it.

About the SQF saving...thats a problem.. Whatever you build with your character is not 'selectable' in the editor after. If it was then you could.

To make sure the sqf produced when saving the mission file is a correct...manually delete the old one so new one is created when you save.

 

ps: also change the .beidi file....the references from Chernarus to Napf. And the folder name as well...

Anything has .Chernarus  should be changed.

Link to comment
Share on other sites

  • 2 weeks later...

Update:
I got great news. I managed to rewrite all the vehicle CHILD type queries like this:

_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 ? Talk about hours and hours earned in debugging scripts :)

 

Demo in action:

Link to comment
Share on other sites

  • 2 weeks later...

Should the sensors in the mission.sqm be working? They don't seem to be on my system.

 

Outside of that, this has already saved me a ton of time by letting me play around and see what small script changes do without having to start up a server then load in.

 

thanks!

Link to comment
Share on other sites

Yeah i also had problems with the sensors to show on the map. Small thing though.
I will be releasing an update soon. I just need to rewrite some more hiveext functions to make it almost a full server / client emulator.
I was able to make traders work(buy and sell), publish vehicles to the database, make Master key mod work, and more.
Just need to make it spawn vehicles on Start like the normal server does and should be done.
Most of the dayz_server functions work by default now..i rewrote most hivext calls so no big changes needed.
After that i'll restore the normal way of Playet init and setup instead of the 2 ways hack (fake db and manual init)i did now.

Just remember getPlayerUID doesnt work...and also if you see Publicvariable values to make them work you have to manually call or spawn the public variable / function instead.

Example:

PVDZE_veh_publish2 = [........];
Publicvariableserver "PVDZE_veh_publish2"

Should also have this after:
[PVDZE_veh_publish2] spawn server_publishVeh2;

Which is basically what the public variable was calling.

Link to comment
Share on other sites

Would it be possible to use my current mission file and server pbo? 

 

Well yeah, thats the idea..From your server pbo you could copy your custom buildings..i dont know what else you would want from there (like i said no database interaction yet)

And from your mission file most scripts (pay attention to public variables and getPlayerUID...they need a one line trick for them to work) should work fine.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...