Jump to content

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


Axe Cop

Recommended Posts

glad it is working for you guys, some other admins had weird problems yesterday. :D

 

anyway I am working on some restrictions to switch the character, just read the topic there are some good ideas already.

I guess we need at least a timer or countdown, what I can do atm is this:

  • see what character was used last (based on last login time)
  • switch to any character who is a fresh spawn/dead (there should be no harm if you choose a character slot and spawn fresh)

with the current database I can not see when the player has switched his character slot, only based on the login time but if you get a disconnect, server restart or whatever and use the same slot I cannot detect it and it resets the last login time of course.

 

I could add a restriction that you can only switch to another character slot if he either is a new spawn or the last login time of ALL chars was at least X minutes ago (hard to explain, but X can be 30 minutes or whatever set via a config variable), maybe needs an example, this are 3 chars:

  1. last login 5 minutes ago (last used character)
  2. last login 2 hours ago
  3. last login 3 days ago (dead char)

if you now set a 30 minute restriction, you could choose char 1 (because last char) or 3 (dead -> new spawn), what do you think about that?

there might still be a problem if you are playing with a character for hours without relogging you can of course switch to any character when you log out (or die), that might be tricky and I dont think i can do anything about it without changing the database structure or do you have any better ideas?

Link to comment
Share on other sites

last or fresh would be fine too, after 30 minutes he could join any slot wouldnt he ?

yes only if all characters have a last login time > 30 min

 

but as I've said that is no solution in some cases, if you are defending your base and die you may be able to switch to another character if you were logged in longer than 30 mins with the dead char..

Link to comment
Share on other sites

Lets use 30minutes as the timer here.

 

If all slot logins > 30 minutes > Activate spawn button for all slots. - This when used creates a most recent logged in slot

 

If all slot logins not > 30 minutes > Activate most recent login button only. - Which would be the one from above meaning you have to wait 30minutes at least to switch character.

 

If most recent login is dead > activate respawn button on this slot and activate spawn next most recent logged in char. - This would allow for a new character to be made and an existing slot to be used.. however >

 

If most recent login is XX distance from most recent dead character > Do not activate spawn button on this slot > Offer button to spawn randomly on coast? - The issue I see with this, is people could freshspawn and then kill themself and switch to the other char and if this char is where their char died, its likely setup on purpose or setup inside their base, though this would still take a few minutes at least to do and would be easy to catch people doing it. Perhaps something could be done with previous generations on the slots, if recent deaths are close together (30 minutes between deaths) then it deactivates other slots due to what appears to be cycling spawns or trying to access other slots to get back to where another slot died.

 

Alternatively, if there is a fresh spawn slot then you could force people to HAVE to use this slot first and then wait the timer down outside of game or use this new char. - The issue with this is, apart from stopping people from playing, if someone dies and disconnects from the server.. when they come back they have to select a fresh spawn. Unless you code it so that the other slots are open for use if the dead characters have been dead for over 30 minutes.

 

At the end of it, you want people to still be able to play. They need to remember that if they didn't have extra slots to use, they'd have to be a fresh spawn anyway and this needs to be the risk, or they risk not being able to play for XX amount of minutes. It would probably work better at 60minutes+ to force people to play their freshspawns or wait the timer out.

 

I hope that all made sense, its a lot of "if" this "goto" that scenarios. Maybe a flow chart would better show it :)

Link to comment
Share on other sites

yes thanks again ToejaM, I will try to code something like that tomorrow. your first two suggestion should be simple and work pretty good, problem is when the most recent character is dead.

I think your idea with checking the surroundings of the other chars is the best option I think, so instead of just activating the second last slot I would still enable all slots, if they are far enough away from the dead char (why only activate the next recent?). that should be possible to implement with the game, of course for the timer to work i may need to refresh the last login values if the player stays in the character login screen and wait for the slot to become available maybe.

 

Also one problem that may arise is checking the surroundings of the dead char if you are using some 3rd party anti hack tool, I am not really familiar with any of them but i think some of them disable functions to check the surroundings of the player because of obvious reasons so that that be a problem?

 

so for the next release I might add 2 global variables you can customize for the login wait time and minimum distance to your own dead character if you want to respawn. since the dead characters should be saved on the server it should not matter if you have died and respawned 5 times, I should be able to check against all dead chars and not just the ones displayed as dead on the character selection screen (that should eliminate the problem with respawn as a fresh spawn and kill yourself to switch to the other char near your old dead one)! :)

Link to comment
Share on other sites

Hi Axe,

i do now have the Problem that some Players dont get a selection screen and do always spawn on slot one. By now 3 players have that problem, 10 worked fine...

Are you using the default anti hack from epoch? I have experienced some issues with that, it just closes the character dialog for some reason so it gets skipped, that is why I have added the 5 seconds waiting time when you log in if you've noticed that.. usually that is not needed but weird things happen in ArmA/Epoch and it closes the dialog for no reason and nothing can stop it so you just have to wait for all scripts to be loaded before the dialog opens.. pretty silly but I don't know any better way. :/

 

what you can try is either delay the execution of the antihack.sqf or increase the wait timer when you are logging in. maybe some of you have played DayZ origins before and you may have noticed it has an annonying 1 minute timer before you can join the game, origins has many dialogs for the spawn selection and also character classes that might be one reason you have to wait that long. :(

 

ok now the possible solutions.

increase the wait time to 10 seconds or something: open my custom file player_monitor.fsm and change line 1670 there should be a condition:

(diag_tickTime - _myTime) > 5 

replace the 5 with 10 seconds or whatever you may have to test some values.

 

Another option would be delaying the antihacks.sqf, I did not try this but should be fine if you start the script a little later or even wait for the character selection screen to be closed.

in the init.sqf replace 

[] execVM "\z\addons\dayz_code\system\antihack.sqf";

with

[] spawn {
	waitUntil {!isNil "dayz_characterSlot"};
	sleep 5;
	[] execVM "\z\addons\dayz_code\system\antihack.sqf";
};

that will wait until the character dialog is open the and wait another 5 seconds before the antihack script gets started..the "spawn" is necessary or it will delay everything following that line in the init.sqf.

 

I think the "stupid" plant check in the antihack.sqf is messing with the dialogs.

Link to comment
Share on other sites

yes thanks again ToejaM, I will try to code something like that tomorrow. your first two suggestion should be simple and work pretty good, problem is when the most recent character is dead.

I think your idea with checking the surroundings of the other chars is the best option I think, so instead of just activating the second last slot I would still enable all slots, if they are far enough away from the dead char (why only activate the next recent?). that should be possible to implement with the game, of course for the timer to work i may need to refresh the last login values if the player stays in the character login screen and wait for the slot to become available maybe.

 

Yeah that makes sense. I guess next most recent will always be irrelevant and dependant on the timer its self. So technically the other two slots should always be 30 min+ if a character dies

 

Also one problem that may arise is checking the surroundings of the dead char if you are using some 3rd party anti hack tool, I am not really familiar with any of them but i think some of them disable functions to check the surroundings of the player because of obvious reasons so that that be a problem?

 

The best anti hack is a good admin with full access to the logs! ;)

 

so for the next release I might add 2 global variables you can customize for the login wait time and minimum distance to your own dead character if you want to respawn. since the dead characters should be saved on the server it should not matter if you have died and respawned 5 times, I should be able to check against all dead chars and not just the ones displayed as dead on the character selection screen (that should eliminate the problem with respawn as a fresh spawn and kill yourself to switch to the other char near your old dead one)! :)

 

That sounds ideal, when setting a default value remember that running 1km in game takes three minutes. Thats not a lot of time, I think personally I'll be setting the distance to a minimum of 3km, probably even 5km. Otherwise people will just sit outside the area of bases ready to zerg in again, in many cases it would take more than three minutes to get out and loot the bodies and if several people are attacking a base, forget about it until the clone wars are over.

 

I think the biggest issue will be people who die, respawn as a fresh spawn, dying again quite a distance away to then use a character closer to where their other main char died but if your solution works then great but how does it work now with the gravestones/crosses as the bodies are cleaned up after 30minutes. Perhaps your script might need to log recent deaths and their locations but then that won't persist through a restart so it would have to be a database check on character IDs at server start?

 

Maybe also force a wait between selecting an existing char after dying to 15minutes (customizable again) before unlocking the other slots for use which then follow the distance rules to dead char, while still allowing a fresh spawn to be created for the first 15 minutes if they want to play immediately. This would mean the player would have to make a choice of waiting at least 15minutes after dying to switch char, so even if they wanted to use the fresh spawn trick of getting back to their body, they are forced into at least a 15 minute wait minimum or they have to play their fresh spawn so it makes it not worth doing.

 

Ontop of this, there will be the distance requirement, If its set to 15 minutes, with a 5km range, that means a 15minute wait if they are within 5km. Alternatively, if its possible.. there could be a diminishing timer on this.. if a player is within 5km, make them wait 15 minutes. Then the distance they must be slowly reduces over time, so if they wanted to camp the base, putting them at <100m distance theyd end up having to wait the full 30minutes (15minute forced wait + 15minutes distance timer).. I'll explain.. player dies and has to wait 15minutes before swapping chars and a time on top for the amount of distance they are to their recent dead body:

 

Time: 15:00 minutes - must be 5km away or more before spawn button is active

Time: 7:30 minutes - must be 2.5km away or more before spawn button is active

Time: 3:45 minutes - must be  1.25km away or more before spawn button is active

ect

ect to <1 distance

 

Of course vehicles negate the running time but this either requires forward planning on where you're going to die or a team mate, which risks more assets. Where as on foot, you only risk yourself.

 

For all the genuine reasons that people would like to switch to another fully kitted slot, its the malicious reasons which will cause server owners huge headaches with this.

 

I've yet to implement this but I think I definitely will do once some of the ways to exploit it are crushed.. as I have a very competitive server and I can see people getting heated and using what they can to legally win.

 

Urgh its 5am. I'm going to stop there, lemme know what you think :)

Link to comment
Share on other sites

okay axe, i did this:

[] spawn {
	waitUntil {!isNil "dayz_characterSlot"};
	sleep 5;
	[] execVM "\z\addons\dayz_code\system\antihack.sqf";
};

and it works for me but 2 of my players dont get a selection screen ...

Link to comment
Share on other sites

i could try to wait on all my custom scripts to load ...

yeah please try that, I don't know why the game is closing/skipping the dialog but there is not much I can do about it.. :(

 

@ToejaM: I have to say you really do have a lot of concerns about your players having malicious reasons haha :P

To be honest if you have a player like that there might be nothing you can do about it, my mod here is just for the majority of the players and to make it easy and fun to switch characters without spending extra money. BUT as you might be aware of you could do something similar like forever in DayZ, you just have to buy multiple copies of the game and switch your account to have multiple characters. You have to restart the game for that but still it may take 1 minute to switch characters and there is nothing you can do about it, no restrictions, you can have 5 characters in the same base and change them all the time.. I am just saying it might be pointless adding so many restrictions to my mod when you can just bypass all of that if a player really wants it (without hacks obviously). :(

 

That being said I will implement the basic timer and distance restrictions and see how that is working out and what can be done with the game before I do anything more complicated like persisting all that stuff in teh database is to much for this mod I think.. sure it can be done but is that really necesarry, if there is a restart you can spawn where you want with the timer restrictions still active (meaning you can use your last character after the restart or spawn fresh if you stay right to the restart). :)

Link to comment
Share on other sites

Better to only have to deal with one person than an entire server doing it because its an option that feel they need to use to succeed!

 

Theres always a loop hole in Arma coding isnt there lol

 

and hey, I'm not tarring my server.. you only have to look at the sheer volumes of skiddies that hit the servers daily to see how many people arent decent honest players, at least if it costs people to have to do it then its another deterrent :P

Link to comment
Share on other sites

hi axe

so the fix only worked for some people, probably it depends on how fast your internet/computer can process the scripts, i will try to activate antihack 5 minutes after spawning

Link to comment
Share on other sites

hi axe

so the fix only worked for some people, probably it depends on how fast your internet/computer can process the scripts, i will try to activate antihack 5 minutes after spawning

might be, if you find a solution please tell me.. this is some weird ArmA "bug":p

Link to comment
Share on other sites

okay, for now this seems to work:

	//anti Hack
[] spawn {
	waituntil {!isnull (finddisplay 46)};
	sleep 300;
	[] execVM "\z\addons\dayz_code\system\antihack.sqf";
};

at least i havent found anyone who did not have the selection screen when connecting (exception: first connect after server restart because everything is delayed due to spawning objects, but thats not really important)

Link to comment
Share on other sites

okay, for now this seems to work:

	//anti Hack
[] spawn {
	waituntil {!isnull (finddisplay 46)};
	sleep 300;
	[] execVM "\z\addons\dayz_code\system\antihack.sqf";
};

at least i havent found anyone who did not have the selection screen when connecting (exception: first connect after server restart because everything is delayed due to spawning objects, but thats not really important)

yeah all i know it seems to be a problem with the antihacks, but i dont see anything in the code what could close a dialog.. :/

Link to comment
Share on other sites

Hey Axe,

 

must say, Awesome script! Totally new playstyle and looks really nice!

 

I had the same problem as some others: Blackscreen or character slot select skipping so it just used the first char.

What i did to prevent this:

 

 

I put all my startup lines for the custom scripts/addons in a startupfile and put it in my missionfile:

 

custom\loadaddons.sqf

//Put any startupline in here, for custom scripts that are NOT needed before the player is ingame!
//################################################################################################

//Wait until player is ingame and is able to move with Char
waitUntil {!isNil "dayz_animalCheck"};

//Start Anti Hack excluding Admins (where server_admin_list is a defined array with admins playerUID's)
if (!((getPlayerUID player) in server_admin_list)) then {
	[] execVM "dayz_code\system\antihack.sqf";
};

//Start Safezone protection script
_nil = [] execVM "custom\safezones.sqf";
//Start Missionmarkers check for JIP
_nil = [] execVM "debug\checkmarkerstest.sqf";
//Start Towerlights script (custom)
_nil = [] execVM "custom\tower_lights.sqf";
//Start Admintools
_nil = [] execVM "admintools\Activate.sqf";
//Start Service Point script
_nil = [] execVM "custom\service_point\service_point.sqf";


//Log on finish
diag_log "### Custom Addons load - Finished ###";

and this is my "if (!isDedicated)" part in the missionfile startup:

 

init.sqf

if (!isDedicated && hasInterface) then {
	0 fadeSound 0;
	waitUntil {!isNil "dayz_loadScreenMsg"};
	dayz_loadScreenMsg = (localize "STR_AUTHENTICATING");
	_id = player addEventHandler ["Respawn", {_id = [] spawn player_death;}];
	_playerMonitor = 	[] execVM "dayz_code\system\player_monitor.sqf"; //custom player_monitor call for Multichar from Axe Cop
	_nil = [] execVM "custom\effects.sqf";

	[] spawn {
		// Waits for character selection for Axe Cops MultiChar script
		// and until the player login is complete, then starts the Custom Addons and Antihack

                //still problems? comment out this line and uncomment the next one
		waitUntil {!isNil ("PVDZE_plr_LoginRecord")};

                //waitUntil {!isNil ("dayz_characterSlot")};

		_nil = [] execVM "custom\loadaddons.sqf";
	};
};

If you followed all Installation steps from Axe Cop for the mod itself,

then this fixed all issues for me!

Hope it helps some others too ^^

Questions? write here or send PM.

 

Moo,

Otter

Link to comment
Share on other sites

Update, Version 1.1: Restrictions
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 timer or anything to count the timeout down, if you are staying a the character selection screen the buttons stay disabled forever for now (may change in a future release).

 

Upgrade info: if you want to update from the first version you just need to replace the two files RscDisplayCharacterSelect.hpp and my custom player_monitor.fsm.

Link to comment
Share on other sites

just a quick question...This doesnt create a new PlayerUID right ?

Cause i have a spawn script where the player selects a spawn location with scroll menu, plus i got some custom script checking user PlayerUID against a custom database that gives every player 1 vault.

But i dont want this way to get 3 vaults :P

Link to comment
Share on other sites

just a quick question...This doesnt create a new PlayerUID right ?

Cause i have a spawn script where the player selects a spawn location with scroll menu, plus i got some custom script checking user PlayerUID against a custom database that gives every player 1 vault.

But i dont want this way to get 3 vaults :P

No it is still just one player with multiple characters, I don't even think you can change the PlayerUID that is hard coded to your game account (serial number). :)

This mod just returns different characters from the database upon login, everything else after the login or when the player has spawned is not changed at all.

Link to comment
Share on other sites

Hey Axe,

 

thanks for the update, works as intended!

 

I changed it a little for the error with skipping character selection dialog.

Set

 

dayz_characterSlot = 0;

 

in the player_monitor.fsm on line 1756

Then i put in a routine that checks if dayz_characterSlot is not 0 after dialog close.

If it's 0 after dialog closed, may it due to error or skip by a mod or by pressing Escape, it goes to a retry of gettin the Character data from db again (5 secs wait) and shows the Character Selection Dialog again.

 

This way it makes proof you selected a char before the game begins.

Nice side effect is you are able to refresh the screen if you wanna wait for changing character timeout.

 

My players reported they not had a missing character slection again, just sometimes it goes 1 or max 2 times trough the loop for getting character data.

 

I attached my player_monitor.fsm if you wanna have a look at it.

 

 

Thanks for this nice mod again!

 

Moo,

Otter

player_monitor.zip

Link to comment
Share on other sites

@Otter nice work I might add something like this to the future releases.

Anyway you don't need to add the retry-state and your response-condition, since it is the same as my code (other than the retry text in the loading screen) you can just redirect your "nothing selected" condition back to the "Request Character Data" state and it should do the same. :)

 

I don't like that something like this is even necessary and why it closes the dialog sometimes but I guess we never know why some other scripts are interfering with dialogs :(

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