Jump to content

[Release] Multiple Character Support (now compatible with Epoch 1.0.5.1)


Axe Cop

Recommended Posts

My new mod may change the way you play DayZ, simply put this mod enables all players on the server to get the choice of using multiple characters (without having to buy multiple copies of ArmA2:CO  :P).
I've set up a prototype on my test server with a 3 character selection dialog (see picture below), this may be improved but the base mechanics itself are working great so far.
 
So when you join a server after the loading screen you see a dialog like this:
W7SFgrY.png
you have to chose one of 3 character slots every time you log into the server, each character slot is completely independent (different humanity and other stats, like different players). the slot count isn't static but I though 3 is a good start, admins can change the character selection dialog to a different number of slots, if you want you can have 100 slots for each player. :D
 
This mod can't be archived with a little script, but I've tried to made the installation as easy as possible.
For an overview this is what I've done to get this mod working:
  • Database schema: added one extra column "Slot" to the "character_data" table (the database stays fully compatible to the default HiveExt.dll)
  • Custom HiveExt.dll to add a new method for loading all character data of a player (CHILD:100), also a small change to the current load player method to support multiple characters (CHILD:101). I could have made completely new methods for the login process, but this way only a very few modifications are necessary in the Hive code and the script files, but this also means my modified HiveExt.dll is not compatible with servers who don't have the "Slot" column in the "character_data" table
  • one new script for the server and a small change in the server_playerLogin.sqf (to send the slot id to the hive)
  • for the client files I've changed the player monitor to inject the character selection before the login process (see player_monitor.fsm changes below)

To visualize the changes made to the login process, take a look at this state machine diagram of the player_monitor.fsm (changes are highlighted in green):

sf7sfit.png

 
 
Download latest version for Epoch 1.0.5 and 1.0.5.1: http://dl.bintray.com/vos/dayz/multichar1.3.3.zip
Older versions are available here (for other Epoch version since 1.0.3.1).
 
Installation instructions
I've tried to make the installation as easy as possible and still do it the proper way and change the files like the Epoch devs would do it. Some steps could be changed and the code simply be put in the init.sqf instead of changing the Epoch files, if you have some experience with ArmA script you can do that but if you follow my instructions it is the best way to do it like this in my opinion.
 
Pre-requirements: a PBO manager and basic knowledge of ArmA script editing.
 
Note: I've added all changed files to the download package, so you can see how they should look like with the changes applied. If you didn't make any custom changes to those files you can also just use them instead of following my instructions to change the files below.
 
  1. run the SQL query to add the "Slot" column to the "Character_DATA" table in your Epoch database:
    ALTER TABLE `Character_DATA` ADD COLUMN `Slot` TINYINT UNSIGNED NOT NULL DEFAULT 1 AFTER `PlayerUID`;
  2. copy the file HiveExt.dll to the @DayZ_Epoch_Server folder (overwrite the Epoch file)
    Note: the source code of the HiveExt with my changes can be found here.
  3. unpack your dayz_server.pbo and copy the file server_playerCharacters.sqf to the compile sub-folder
  4. open the file compile\server_playerLogin.sqf, around line 47 replace
    _key = format["CHILD:101:%1:%2:%3:",_playerID,dayZ_instance,_playerName];

    with

    _key = format["CHILD:101:%1:%2:%3:%4:",_playerID,dayZ_instance,_playerName,_this select 2];
  5. open the file init\server_functions.sqf and add the line
    server_playerCharacters =	compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_playerCharacters.sqf";
    

    after the line 9

    BIS_Effects_Burn =			{};
  6. repack your dayz_server.pbo
  7. unpack your mission.pbo (e.g. DayZ_Epoch_11.Chernarus.pbo) if necessary and copy the file RscDisplayCharacterSelect.hpp into the mission folder,
    open the file description.ext and add this line at the very bottom:
    #include "RscDisplayCharacterSelect.hpp"
  8. unpack your dayz_code.pbo (on your PC @DayZ_Epoch\addons\dayz_code.pbo) and copy the files init\publicEH.sqf and system\player_monitor.sqf
    to a "custom" folder in your mission folder (if you don't already have custom versions of those files),
    change the references to those files in your init.sqf to something like "custom\publicEH.sqf" and "custom\player_monitor.sqf"
  9. copy my custom file player_monitor.fsm to your "custom" folder (the changes in this file are not easy to reproduce, so it may be best you use my custom file instead of adding the changes yourself)
  10. open the file publicEH.sqf and add this line above the line starting with "PVDZE_plr_Login" (around line 54):
    "PVDZE_plr_Characters"	addPublicVariableEventHandler {_id = (_this select 1) spawn server_playerCharacters};
  11. open the file player_monitor.sqf and change the path to my custom player_monitor.fsm so that the line looks something like this:
    _id = [] execFSM "custom\player_monitor.fsm";
  12. repack your mission.pbo if necessary
 
That's it! Yeah I know not the easiest mod to install, but that is DayZ/Epoch.. I Hope I didn't forget anything, but I think that is all.  :P
 
 
Restrictions (since version 1.1)
I've added two restrictions to minimize the possibilities for players to abuse quick character switching:
  • character switch timeout - how often a player can switch to another living character (in minutes), the last used slot is always available and the player can also spawn fresh if he has a dead character or never used slot
  • minimum distance to dead bodies of the same player - calculates the distance to previously died characters of the player (in meters), this will prevent the player from "stacking" two or more characters at the same place (like a base) and switch to another character if one dies

There are global config variables for changing the default settings for the restrictions:

DZE_CharacterSwitchTimeout = 30; // default 30 minutes timeout (0 to disable)
DZE_CharacterMinDistance = 1000; // default 1000 meters min distance (0 to disable)

You can add those variables to the config section in the init.sqf.

 

Here a screenshot how it may look like with active restrictions:

OG8Z3DD.png

Disabled character slots are displayed with a red disabled button (cannot be pressed) with info text on the button.

If one or more restrictions apply there is also be an info text displayed at the bottom of the screen.

 

Note: at the moment there is no automatic timer or anything to count the timeout down, you have to manually press the refresh button to refresh the character data and last login time.

 

 

Suggestions and ideas welcome. Also for the character selection dialog what do you like to see on there?
Edited by Axe Cop
Link to comment
Share on other sites

Very tempting to have a bandit account Hero and admin one... Hmmmmm. I have a couple players who like to play bandit and hero...

Yes that is possible of course, but with an admin character i dont know, since it is still the same player id and GUID you have to check for playerUID and slot-ID :D

I think there are many use cases for this, you could have 1 char in your base and one in elekro for PvP or something.. also if you die just use another char :P

one problem might be if you have 2+ chars in your base or whatever and you die and can just switch chars, thats why there has to be some sort of countdown timer how often you can switch chars and when?

Link to comment
Share on other sites

I've set up myself and another admin on my server with an option to go undercover and play along with Bandit AI's during missions, this is to give the players more of a challenge.  The AI are just too dumb no matter how high you set them lol.  So anyway, I'm wondering could this system be used just by Admins and maybe have one of the accounts immune to logging for deaths and kills ? Say as an undercover Bandit AI , I kill player Z, I'd like this NOT to be logged for viewing at the notice boards etc, and on the other side if someone kills me I'd like it also not to be logged and for my dead body to be treated just like the AIs .. 

 

Would be a nice feature :p

Link to comment
Share on other sites

I've set up myself and another admin on my server with an option to go undercover and play along with Bandit AI's during missions, this is to give the players more of a challenge.  The AI are just too dumb no matter how high you set them lol.  So anyway, I'm wondering could this system be used just by Admins and maybe have one of the accounts immune to logging for deaths and kills ? Say as an undercover Bandit AI , I kill player Z, I'd like this NOT to be logged for viewing at the notice boards etc, and on the other side if someone kills me I'd like it also not to be logged and for my dead body to be treated just like the AIs .. 

 

Would be a nice feature :P

Well possible yes, but maybe not within the scope of this mod haha, you have to change the files where the kill messages are send and add exceptions for your admin characters.

 

And about the timer I have to think about how to do that, should players be able to switch characters when they die? If you get killed in your base and can immediately switch do another char can also be a problem..

I need ideas how and when should players be able to switch character slots?

Link to comment
Share on other sites

Well possible yes, but maybe not within the scope of this mod haha, you have to change the files where the kill messages are send and add exceptions for your admin characters.

 

And about the timer I have to think about how to do that, should players be able to switch characters when they die? If you get killed in your base and can immediately switch do another char can also be a problem..

I need ideas how and when should players be able to switch character slots?

 

Personally, if I was running this on my server I would only want players to be able to change character once per server restart.  Or at the most once every hour, but certainly not any less.  So the short answer is No, I don't think they should be able to switch characters if they die :)

Link to comment
Share on other sites

Damm Axe Cop, another fine script coming out of that head of yours....

 

Looks awesome BTW, if you need others testing it mate,I'm sure there are a few of us that are willing

 

Bags

 

 

edit I'd say that have a limit of one change per hour would be fine.....timed from when you changed last

Link to comment
Share on other sites

I'd say that have a limit of one change per hour would be fine.....timed from when you changed last

yeah problem is that is not saved in the datebase at the moment, could of course be saved but that need additional change of the database and i want to keep it simple first, another way the server could save that temporarily so you can change the slot with every restart or "x" minutes or whatever condition, but onyl saved until server restart.

 

Btw I was not home today, so didnt make much progress, I hope I get the first release finished tomorrow

Link to comment
Share on other sites

Ok sorry guys I was busy today with some other stuff, but I just updated to epoch 1.0.3.1 and everything is working so I will release this mod tomorrow, finally! :D

also updated the screenshot in the first post, this is how it looks for now...

 

Edit: the mod is now live on my server, if you want check it out here: 176.57.142.101:2302 (if you have no character in that slot it will just show up empty for now, click on the "spawn" button to choose a slot, there are no restrictions yet so you can switch slots as much as you like by going to the lobby and join back in)

Edited by Axe Cop
Link to comment
Share on other sites

Well if it would be that easy do you think i would just show the guy from the gender selection? :p

Problem is epoch has no images of the skins.. Of course you could do screenshots of all skins but then the images need to be placed in the mission file which might be some MB i think :/

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