Kimarik Posted May 13, 2017 Report Share Posted May 13, 2017 Hello. This is for Single Currency This is a small script that allows you to change your humanity at a trader. I do not take credits since this script has been written and updated by different people. Cedits are going to DAmNRelentless , juandayz and Tweety Create a humanity_up.sqf and past following in it. Spoiler private ["_cost","_wealth"]; _cost = 100000; _wealth = player getVariable[Z_moneyVariable, 0]; _humanity = player getVariable["humanity", 0]; if (_humanity >= 25000) exitWith {"You have reached the maximum humanity we can provide" call dayz_rollingMessages;}; if (_wealth < _cost) then { cutText[format["You need %1 coins to change your Humanity!",_cost], "PLAIN DOWN"]; } else { player setVariable[Z_moneyVariable, (_wealth - _cost), true]; titleText["Your Humanity has been changed!","PLAIN DOWN"]; titleFadeOut 5; sleep 0.1; [500,0] call player_humanityChange; }; Create a humanity_down.sqf and past following in it. Spoiler private ["_cost","_wealth"]; _cost = 100000; _wealth = player getVariable[Z_moneyVariable, 0]; _humanity = player getVariable["humanity", 0]; if (_humanity <= -25000) exitWith {"You have reached the minimum humanity we can provide" call dayz_rollingMessages;}; if (_wealth < _cost) then { cutText[format["You need %1 coins to change your Humanity!",_cost], "PLAIN DOWN"]; } else { player setVariable[Z_moneyVariable, (_wealth - _cost), true]; titleText["Your Humanity has been changed!","PLAIN DOWN"]; titleFadeOut 5; sleep 0.1; [-500,0] call player_humanityChange; }; The blue marked areas are coins and humanity which you can change to your own wishes. Make a new folder called humanity, put both files in it and copy the folder in your script folder. fn_selfActions: The red marked is the trader who offers this option. This can be changed to your own choice. paste the following Spoiler ///////////////add humanity// private["_playerPos","_nearadd"]; _playerPos = getPosATL player; _nearadd = count nearestObjects [_playerPos, ["TK_GUE_Soldier_3_EP1"], 3] > 0; if (_nearadd) then { if (s_player_addhumanity < 0) then { s_player_addhumanity = player addaction[("<t color=""#c400f9"">" + ("Add Humanity") +"</t>"),"scripts\humanity\humanity_up.sqf"]; }; } else { player removeAction s_player_addhumanity; s_player_addhumanity = -1; }; ////////////////end of add humanity///// ////////////////remove humanity/////////// private["_playerPos","_nearremove"]; _playerPos = getPosATL player; _nearremove = count nearestObjects [_playerPos, ["TK_GUE_Soldier_3_EP1"], 3] > 0; if (_nearremove) then { if (s_player_removehumanity < 0) then { s_player_removehumanity = player addaction[("<t color=""#c400f9"">" + ("Remove Humanity") +"</t>"),"scripts\humanity\humanity_down.sqf"]; }; } else { player removeAction s_player_removehumanity; s_player_removehumanity = -1; }; ////////////////end of remove humanity/// after Spoiler //Towing with tow truck /* if(_typeOfCursorTarget == "TOW_DZE") then { if (s_player_towing < 0) then { if(!(_cursorTarget getVariable ["DZEinTow", false])) then { s_player_towing = player addAction [localize "STR_EPOCH_ACTIONS_ATTACH" "\z\addons\dayz_code\actions\tow_AttachStraps.sqf",_cursorTarget, 0, false, true]; } else { s_player_towing = player addAction [localize "STR_EPOCH_ACTIONS_DETACH", "\z\addons\dayz_code\actions\tow_DetachStraps.sqf",_cursorTarget, 0, false, true]; }; }; } else { player removeAction s_player_towing; s_player_towing = -1; }; */ and past Spoiler player removeAction s_player_removehumanity; s_player_removehumanity = -1; player removeAction s_player_addhumanity; s_player_addhumanity = -1; after Spoiler player removeAction s_givemoney_dialog; s_givemoney_dialog = -1; player removeAction s_bank_dialog; s_bank_dialog = -1; player removeAction s_bank_dialog1; s_bank_dialog1 = -1; player removeAction s_bank_dialog2; s_bank_dialog2 = -1; player removeAction s_player_checkWallet; s_player_checkWallet = -1; variable.sqf paste Spoiler s_player_addhumanity = -1; s_player_removehumanity = -1; after Spoiler s_givemoney_dialog = -1; s_bank_dialog = -1; s_bank_dialog1 = -1; s_bank_dialog2 = -1; s_player_checkWallet = -1; iben, Hooty and juandayz 3 Link to comment Share on other sites More sharing options...
iben Posted May 13, 2017 Report Share Posted May 13, 2017 Hello mate, thx for this! :) If you want, I reworked zupas dev functions to fnc_SC_uniCoins for 1.0.6.1+. You can grab it from here, then use in your code: // @parameters: // [_player,_amount,_action,_target] call fnc_SC_uniCoins; // '_player' : object : player, _killer...etc // '_amount' : number : 1000 // '_action' : string : 'add' / 'remove' // '_target' : string : 'cache' / 'bank' if (Z_SingleCurrency) then { if !([player,5000,'remove','cache'] call fnc_SC_uniCoins) then {... }; // or exitWith... }; Cheers... Link to comment Share on other sites More sharing options...
azzdayz Posted May 14, 2017 Report Share Posted May 14, 2017 Ok I wanted to try this on my own, but epic fail. Need some scripter input. What would be the best way to add to this code a stop so that if your humanity is above a curtain number then "Your humanity is to high or low for us to change your humanity more". Link to comment Share on other sites More sharing options...
Relentless Posted May 14, 2017 Report Share Posted May 14, 2017 @Kimarik Nice to see that you are publishing this to the community. Although it's simple it's a good start for you but you should always keep in mind that you should give credits to the people that helped you with it as this isn't your own work (not everything I meant). Link to comment Share on other sites More sharing options...
Relentless Posted May 14, 2017 Report Share Posted May 14, 2017 4 minutes ago, azzdayz said: Ok I wanted to try this on my own, but epic fail. Need some scripter input. What would be the best way to add to this code a stop so that if your humanity is above a curtain number then "Your humanity is to high or low for us to change your humanity more". Make another condition in the humanity_up.sqf and the humanity_down.sqf with something like if (_humanity >= 1000000) exitWith {hint "Your humanity is too high to rise/decrease it!";}; Link to comment Share on other sites More sharing options...
azzdayz Posted May 14, 2017 Report Share Posted May 14, 2017 I kind of tried something like that, but the issue I am having is getting it to work correctly. I tried to find something to compare and get any ideas from, but LOL ya.... Here is what I have tried with what you gave me, but I know I do not have it written correctly private ["_cost","_wealth","_humanity"]; _cost = 100000; _wealth = player getVariable[Z_moneyVariable, 0]; _humanity = player getVariable["Humanity", 0]; if (_humanity >= 20000) exitWith {hint "Your humanity is too high to rise/decrease it!";}; if (_wealth < _cost) then { cutText[format["You need %1 coins to change your Humanity!",_cost], "PLAIN DOWN"]; } else { player setVariable[Z_moneyVariable, (_wealth - _cost), true]; titleText["Your Humanity has been changed!","PLAIN DOWN"]; titleFadeOut 5; }; sleep 0.1; [500,0] call player_humanityChange; Link to comment Share on other sites More sharing options...
Relentless Posted May 14, 2017 Report Share Posted May 14, 2017 12 minutes ago, azzdayz said: Here is what I have tried with what you gave me, but I know I do not have it written correctly What's the error? Link to comment Share on other sites More sharing options...
theduke Posted May 14, 2017 Report Share Posted May 14, 2017 @azzdayz if (_humanity >= 20000) exitWith {"Your humanity is too high to rise/decrease it!" call dayz_rollingMessages;}; Link to comment Share on other sites More sharing options...
azzdayz Posted May 14, 2017 Report Share Posted May 14, 2017 Ok sorry about that. It does work, but it pops up where the debug menu would go and goes right away. I tried titleText, But that just did say anything so I will try "theduke's" Suggestion. That should work. The first one does work, but I cant have it in the debug menu. Link to comment Share on other sites More sharing options...
azzdayz Posted May 14, 2017 Report Share Posted May 14, 2017 Yep it is working, Like I said they both work, but this one works best for me. I just wanted to not make it so players could just increase to the highest possible number, LOL. This is the decrease. Doing the same for increase. Thanks for everyones help. I tried on my own and was overthinking it for sure. private ["_cost","_wealth","_humanity"]; _cost = 500000; _wealth = player getVariable[Z_moneyVariable, 0]; _humanity = player getVariable["humanity", 0]; if (_humanity <= -25000) exitWith {"You have reached the minimum humanity we can provide" call dayz_rollingMessages;}; if (_wealth < _cost) then { cutText[format["You need %1 coins to change your Humanity",_cost], "PLAIN DOWN"]; } else { player setVariable[Z_moneyVariable, (_wealth - _cost), true]; titleText["Your Humanity has been decreased by 500!","PLAIN DOWN"]; titleFadeOut 5; }; sleep 0.1; [-500,0] call player_humanityChange; Corpulio_Hun 1 Link to comment Share on other sites More sharing options...
Relentless Posted May 14, 2017 Report Share Posted May 14, 2017 38 minutes ago, azzdayz said: Yep it is working, Like I said they both work, but this one works best for me. I just wanted to not make it so players could just increase to the highest possible number, LOL. This is the decrease. Doing the same for increase. Thanks for everyones help. I tried on my own and was overthinking it for sure. Reveal hidden contents private ["_cost","_wealth","_humanity"]; _cost = 500000; _wealth = player getVariable[Z_moneyVariable, 0]; _humanity = player getVariable["humanity", 0]; if (_humanity <= -25000) exitWith {"You have reached the minimum humanity we can provide" call dayz_rollingMessages;}; if (_wealth < _cost) then { cutText[format["You need %1 coins to change your Humanity",_cost], "PLAIN DOWN"]; } else { player setVariable[Z_moneyVariable, (_wealth - _cost), true]; titleText["Your Humanity has been decreased by 500!","PLAIN DOWN"]; titleFadeOut 5; }; sleep 0.1; [-500,0] call player_humanityChange; No problem. Your idea was really easy to add to the script. I just suggested you the hint function because I personally think that this is the easiest and fanciest way to display a message if you don't have an own script or an eventhandler for that. I personally use my own dynamic messages to make them more fancy but I just didn't know that you are using a debug monitor. That's why people always have to watch what other people sent them to make sure whether this is working with the actual own server. Nice to see that this is working now (there are many other display methods aswell btw :D) and that you learned something from it. This is the point when it's good to help someone when the result is that this person learned something. :) Link to comment Share on other sites More sharing options...
Corpulio_Hun Posted May 17, 2017 Report Share Posted May 17, 2017 hi guys, i have a little problem with this script. Player buy humanity but does not drain money! Humanity changes but coin not. How can i solve this? thx, Corpulio_Hun Link to comment Share on other sites More sharing options...
Kimarik Posted May 17, 2017 Author Report Share Posted May 17, 2017 Hi . I have updated the humanity_down.sqf and humanity_up.sqf Past the new one into your. Now it will work Corpulio_Hun 1 Link to comment Share on other sites More sharing options...
Corpulio_Hun Posted May 17, 2017 Report Share Posted May 17, 2017 2 hours ago, Kimarik said: Hi . I have updated the humanity_down.sqf and humanity_up.sqf Past the new one into your. Now it will work Hi, For me this one is working fully: humanity_up.sqf Spoiler private ["_cost","_wealth","_humanity"]; _cost = 400000; _wealth = player getVariable[Z_moneyVariable, 0]; _humanity = player getVariable["humanity", 0]; if (_humanity >= 25000) exitWith {"You have reached the maximum humanity we can provide" call dayz_rollingMessages;}; if (_wealth < _cost) then { cutText[format["You need %1 coins to change your Humanity!",_cost], "PLAIN DOWN"]; } else { player setVariable[Z_moneyVariable, (_wealth - _cost), true]; titleText["Your Humanity has been changed!","PLAIN DOWN"]; titleFadeOut 5; sleep 0.1; [500,0] call player_humanityChange; }; humanity_down.sqf Spoiler private ["_cost","_wealth","_humanity"]; _cost = 400000; _wealth = player getVariable[Z_moneyVariable, 0]; _humanity = player getVariable["humanity", 0]; if (_humanity <= -25000) exitWith {"You have reached the minimum humanity we can provide" call dayz_rollingMessages;}; if (_wealth < _cost) then { cutText[format["You need %1 coins to change your Humanity!",_cost], "PLAIN DOWN"]; } else { player setVariable[Z_moneyVariable, (_wealth - _cost), true]; titleText["Your Humanity has been changed!","PLAIN DOWN"]; titleFadeOut 5; sleep 0.1; [-500,0] call player_humanityChange; }; juandayz and Hooty 2 Link to comment Share on other sites More sharing options...
DieTanx Posted May 21, 2017 Report Share Posted May 21, 2017 Tested and working great! i use the hero and bandit taders so people cant "accidentally" click the wrong action Link to comment Share on other sites More sharing options...
juandayz Posted June 6, 2017 Report Share Posted June 6, 2017 @Kimarik in your main post you forgot define _humanity see: if (_humanity >= 25000) exitWith {"You have reached the maximum humanity we can provide" call dayz_rollingMessages;}; must be: _humanity = player getVariable["humanity", 0]; if (_humanity >= 2500) exitWith {.............. Link to comment Share on other sites More sharing options...
juandayz Posted June 6, 2017 Report Share Posted June 6, 2017 and here you got a simple script to made the inverse.. sell humanity points. Its uses the @iben fnc_SC_uniCoins. change by false the _Use_Fnc_SC_unicoins if u dont have it- private ["_moneyTarget","_cost","_Reward","_wealth","_Use_Fnc_SC_uniCoins","_isHero","_isBandit"]; _moneyTarget = "cache";//"bank" the other option _Reward = 2000; _Use_Fnc_SC_uniCoins = true;//change by false if dont have this function. _humanity = player getVariable["humanity", 0]; _isBandit = (_humanity <= -2500); _isHero = (_humanity >=5000); fn_coins = { if (_Use_Fnc_SC_uniCoins) then { [player,_Reward,"add",_moneyTarget] call fnc_SC_uniCoins; }else{ _wealth = player getVariable[Z_moneyVariable, 0]; player setVariable[Z_moneyVariable, (_wealth + _Reward), true]; }; }; if (!_isBandit && !_isHero) then { systemchat ("you need be a hero or bandit"); }else{ if (_isHero) then {[-500,0] call player_humanityChange;systemchat format["you change 500 point of positive humanity by %1 coins",_Reward];call fn_coins; }else{ if (_isBandit) then {[500,0] call player_humanityChange;systemchat format["you change 500 point of negative humanity by %1 coins",_Reward];call fn_coins; }else{ }; }; }; azzdayz 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now