Jump to content

[WIP] Bank/Single Currency System using Humanity


Recommended Posts

Bank/Single Currency System using Humanity

 

Overview

 

This is a mod aimed at replacing the current gold system was a single currency, I know you all know of maca134's really a work of magic that system. 

 

My initial mind map of this was to have a different column in the database called coins and write from the hive but my research showed this wasnt possible. I realised the humanity system is really only used for traders etc. 

 

So I am deciding to make these traders both neutral and same prices and items on my server.

 

Development Phases [Current Phase [#1]]

 

Phase 1. 

 

  • Override all in game features, medical and killing that adds humanity, means people can't kill zombies and get themselves 5 coins etc. 
  • Simple smelting of CURRENT coins on person into normal currency such as gold and briefcases. 
  • Missions spawning with coins. 

Phase 2

  • The bank, I know this is going to be pretty easy, just a simple self action and a call for humanity and add the entered amount onto the [humanity] 
  • I'm still unsure whether to add a dialog or just a few actions such as (Add 100 Coins)(Add 1000 Coins)

Phase 3

  • Collecting coins off dead bodies. The way I have planned on my mindmaps is that when you have LOCAL coins on your person to save it in a simple variable on your local character, I am still unsure on how to access the variable from another character on a dead body. I will have to play with this. 
  • Along with this comes looking at another player and being able to transfer some of your LOCAL coins to there LOCAL coins. 
  • This point brings me to the next point, This is my biggest obstacle right now and that is saving LOCAL coins that are on your person to the database and when you log in next time you can still have local coins and everytime you log out you dont have to go to the bank or use internet banking(explained soon ;-))

Phase 4

  • Phase 4 I hope to be able to pay for things like fuel, maintenance and anything really in game you have to pay for(except traders) 
  • Internet banking you may saw me talk about this in phase 3, This I am completely aware on how to do, using maca134 script I will have a right click function on a radio(acting as a cellphone) From here you can deposit money on the go. 

Phase 5.

  • So Phase 5, really for me when I reach here soon this is the final home run, and we all know what it is, to use gold coins at traders (btw I amen't going to call the currency gold coins, probably something made up just not sure yet so that is a placeholder) In terms of this I am just gonna have to fuck around with the code and see how to replace the currency. 

 

 

I hope to have this released by at least, Phase 3 or 4. HOPEFULLY This time next week, as I am off school and just gonna work hard on this 

 

Just like to leave a final note. I am not copying any of maca134 code as I know someone will say this here. This is ALL completely my own code. 

 

So I hope you guys like this idea and stay here to see the progress,development and release. 

 

Thanks! 

 

~Mochan

Link to comment
Share on other sites

Got that all done already lol :P but it is not a good way to do it really.... Too much stuff to mess with trust me, you will have a lot of trouble of getting all the calls from where humanity is changed etc etc etc... You would need to change a lot, really a lot. From player login and setup...

Then you will need 2 variables one for the character money AND one for the bankmoney so another problem as humanity is not gonna do the trick.

So you would need to change another variable to something else and again get all the calls that are gonna change the value of that variable and so on. Your mission file will be huge, you will still experience bugs and it just will not work perfectly.

What you have listed as last element is actually one of the easiest ones to do, the trading at traders. Not much to change there, only a the prices and using different action files for trading.

The propper way to do this is using Arma2NET and creating new rows in character data or a completely new table, and adding the SQL functions to write in there and read from it..

It is quite a task and took me a long time but if you need help or have a question you can always hit me up and i will try my best at doing so..

Link to comment
Share on other sites

Got that all done already lol :P but it is not a good way to do it really.... Too much stuff to mess with trust me, you will have a lot of trouble of getting all the calls from where humanity is changed etc etc etc... You would need to change a lot, really a lot. From player login and setup...

Then you will need 2 variables one for the character money AND one for the bankmoney so another problem as humanity is not gonna do the trick.

So you would need to change another variable to something else and again get all the calls that are gonna change the value of that variable and so on. Your mission file will be huge, you will still experience bugs and it just will not work perfectly.

What you have listed as last element is actually one of the easiest ones to do, the trading at traders. Not much to change there, only a the prices and using different action files for trading.

The propper way to do this is using Arma2NET and creating new rows in character data or a completely new table, and adding the SQL functions to write in there and read from it..

It is quite a task and took me a long time but if you need help or have a question you can always hit me up and i will try my best at doing so..

 

I WAS planning on using the Arma2Net, I am currently using GtxGaming for my server, I could get a dedi, but not worrying just now, I also wanted to change this as most of the server and people who come here to get the new mods are people who have to learn to install stuff, so most of the time they don't have dedicated boxes. yes this dosen't apply to everyone, but you understand im sure. 

 

Also in terms of changing things from where humanity is changed there can't be that much just simple

  • Bandage
  • Painkillers
  • Morphine
  • Transfusion
  • Killing other players

I have already stopped people getting humanity for the above things except killing as I am still trying to find the file to override. 

 

This is still early stages, my plan for variables is that there will be a variable for the character, LOCAL coins, this is the coins ON the characters person, the ones they can withdraw or deposit. Only problem I see with this is being able to have it saved upon log out and relogging back in. I have a few placeholders for this, but I'm sure I may find a way. 

 

However, I must completely thank you for taking the time to drop a comment on this thread and helping me and pointing me in the right directions, also a huge thanks for offering to help you and I will be sure to pm you if I have any issues. 

 

Thanks

 

~Mochan

Link to comment
Share on other sites

So awesome that someone is working on this. I for one really want this.

 

And please do a dialog for the menus, the scroll wheel option looks so meh and has been done already a few times.

 

There will be dialogs for the withdraw and deposit yes. 

 

Just a simple scroll wheel for smelting coins as really no point wasting time on dialogs for this.

Link to comment
Share on other sites

Well Mochan the files to override humanity on kill will be the main huge problem.. It is multiple functions that are called in player setup, player death etc etc..(getDiff2 function for example)

And as the Epoch (and Dayz Devs) created a huge mess with humanity it will be very difficult to find all the redirecting and such.....

I just went past their mess by doing it with custom tables, but it might be doable allthough it will require some searching and tweaking of a looot of files. I wish you best luck though ;)

Link to comment
Share on other sites

Well Mochan the files to override humanity on kill will be the main huge problem.. It is multiple functions that are called in player setup, player death etc etc..(getDiff2 function for example)

And as the Epoch (and Dayz Devs) created a huge mess with humanity it will be very difficult to find all the redirecting and such.....

I just went past their mess by doing it with custom tables, but it might be doable allthough it will require some searching and tweaking of a looot of files. I wish you best luck though ;)

 

I have indeed been having some difficulties with finding exactly where the server says if player Mochan kills xxxxxxxxx _humanity + 1200. blah blah blah. 

 

Although what you said, Why would it grant humanity for a killing on player setup? it is also not serveR_playerdeath.sqf. 

 

I would think it would be mission file override file from one of the dayz_code files? 

 

~Mochan

Link to comment
Share on other sites

Just found this in player_death.sqf

_array = _this;
if (count _array > 0) then {
	_source = _array select 0;
	_method = _array select 1;
	if (!isNull _source) then {
		if (_source != player) then {
			_canHitFree = 	player getVariable ["freeTarget",false];
			_isBandit = (player getVariable["humanity",0]) <= -5000;
			_isPZombie = player isKindOf "PZombie_VB";
			if (!_canHitFree and !_isBandit and !_isPZombie) then {
			_myHumanity =	((player getVariable ["humanity",0]) / 10);
			_myKills = 		((player getVariable ["humanKills",0]) / 5) * (1000 - _myHumanity);
				//Process Morality Hit
				_humanity = -(1000 - _myKills); //2000
				_kills = 	_source getVariable ["humanKills",0];
				_source setVariable ["humanKills",(_kills + 1),true];
				_wait = 300;
			} else {
				if (_isBandit and !_isPZombie) then {
					//Process Morality Gain
					_myHumanity =	((player getVariable ["humanity",0]) / 35);
					_myKills = 1 min (0 + (player getVariable ["humanKills",0]) / 15);
					_humanitylevel = (player getVariable ["humanity",0]);
					
					if (_humanitylevel >= -100000) then { 
						_bonus = 100; 
					} else {
						_humanitylevel = (_humanitylevel / -1000);
						_bonus = 500 min _humanitylevel; 
					};
		
					_humanity = (-(_myHumanity * _myKills)); //  500 min   (+ 25) ()
					_humanity = 1000 min (_humanity + _bonus); // 25 _bonus
					_killsB = 	_source getVariable ["banditKills",0];
					_source setVariable ["banditKills",(_killsB + 1),true];
					_wait = 0;
				};
				if (_isBandit and !_isPZombie and (_humanity != 0)) then {
					/* PVS/PVC - Skaronator */
					PVDZE_send = [_source,"Humanity",[_source,_humanity,_wait]];
					publicVariableServer "PVDZE_send";
				};
			};
			
			if (_humanity < 0) then {
				_wait = 0;
			};
			if (!_canHitFree and !_isBandit and !_isPZombie and (_humanity != 0)) then {
				/* PVS/PVC - Skaronator */
				PVDZE_send = [_source,"Humanity",[_source,_humanity,_wait]];
				publicVariableServer "PVDZE_send";
			};
			
			if (_isPZombie) then {
				_humanity = 100; //25
				_killsZ = 	_source getVariable ["zombieKills",0];
				_source setVariable ["zombieKills",(_killsZ + 1),true];
				_wait = 0;
				/* PVS/PVC - Skaronator */
				PVDZE_send = [_source,"Humanity",[_source,_humanity,_wait]];
				publicVariableServer "PVDZE_send";
			};
			if (_canHitFree) then {
				//_humanity = 100; //50
				_killsB = 	_source getVariable ["banditKills",0];
				_source setVariable ["banditKills",(_killsB + 1),true];
				_wait = 0;
			};
		};
	};
	_body setVariable ["deathType",_method,true];
};

Not sure, but by a quick glance it looks like it is calculating humanity depending on kills? 

Link to comment
Share on other sites

Certainly looks good, is a shame you feel the need to sacrifce the humanity system, I suspect that will lead to a lot of pain in the long run especially with updates to epoch and merging your add on with others. Someone will break the 'non humanity' and players will be either boss hog or screaming for their lost coinage.

Considering the amount of work you are undertaking wouldn't the suggestion of storing the values in the database be the way to go ?

Link to comment
Share on other sites

Ye i mean that is what i am saying it would be a lot cleaner to do it with an extra table in database at least that is how i do it...

For your question with player_setup. It goes there and calculates the differences of humanity after you died and applies them to your new character in the database

Link to comment
Share on other sites

Ye i mean that is what i am saying it would be a lot cleaner to do it with an extra table in database at least that is how i do it...

For your question with player_setup. It goes there and calculates the differences of humanity after you died and applies them to your new character in the database

 

Ah yes I see now, if im right I will have to remove these calculations as this could / the humanity by 10, when really its coins etc? 

 

Certainly looks good, is a shame you feel the need to sacrifce the humanity system, I suspect that will lead to a lot of pain in the long run especially with updates to epoch and merging your add on with others. Someone will break the 'non humanity' and players will be either boss hog or screaming for their lost coinage.

Considering the amount of work you are undertaking wouldn't the suggestion of storing the values in the database be the way to go ?

 

Axeman, my main plan for this project was mainly for people without root access, as this will mainly be all mission file related, so people with likes of gtxgaming,survival servers, dayz.st etc, who dosen't allow the installation of arma2net. They can use this system instead, I am personally with GtxGaming, I could get a dedicated but I'm not sure if nearly the x2 or x3 price a month is worth it for a single plugin.

 

The cut of humanity system I think will only really be a problem to them old school 'noob' zombie pve'rs. 

 

I don't see any conflict with my current add-ons when removing humanity.

 

Yes ofc with every add-on comes the pain of the new epoch updates :D But for me personally no=one is a hero so the hero trader really is 'useless'. So making them both neutral and renaming them to the Blackmarket or Something like that with the same prices and combine the clothing so you can buy both is the best way. 

 

However I must thank you for dropping in here axeman! A epoch developer! I hope you enjoy the development and progress of this project :D

 

Also storing values in database, well you might of saw my scripting help post about grabbing distanceFoot, this is where the 'coins' on body is going to go. Really I am using the database and really using in my eyes with a PVP server using redundant values in the database. 

 

If I can't grab distancefoot then what I am planning with my code, is to have on playerDisconnect to write to the infected part of the table, the number of coins and when the player joins set the localCoins to this and then set the infected back to 0. I'm still mainly trying to find the ways to make that localCoins variable saved into the database. 

 

So far the development is going great:D 

 

~Mochan

Link to comment
Share on other sites

Ye i mean that is what i am saying it would be a lot cleaner to do it with an extra table in database at least that is how i do it...

For your question with player_setup. It goes there and calculates the differences of humanity after you died and applies them to your new character in the database

 

Hey, got a question for you.

 

I had a single currency server/script before epoch changed their dll's to be more secure which didnt allow 999 and 998 database calls anymore. Since they changed it i couldn't be arsed to change whole my code to the new dll/db system calls since i was gonna take a break of dayZ.

 

My question is now. Is the new database call system a bit clear and easy to use for custom querries to the db?

Link to comment
Share on other sites

Guess I should get a update here; 

 

Been working a lot on this, I guess we are in Phase 2, I am being careful and trying to reduce all the possible ways to get humanity (especially killing) 

 

Although due to since I upgrade my server to Overpoch I have gained almost 500 players so have been super busy with new players. 

 

I will continue working on this and try get this released ASAP! 

 

Also I have been looking for dialogs but really do not know where to start with dialogs? If anyone can link me some resources that would be great:D 

 

~Mochan

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...
  • 4 weeks later...

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
  • Advertisement
  • Discord

×
×
  • Create New...