Jump to content

Epoch Traders (Humanity Changes)


mdavidg

Recommended Posts

I was just Messing about in DayZ Epoch and thought of an idea, what if i could make "New" traders for say a "Hero" level 2, this hero would have 10k humanity in order to access this trader, and the trader would have a new list that only people with 10k+ humanity could access.

 

i was just wondering, whether this would be possible and if so, which files would i need to edit on my server?

Link to comment
Share on other sites

That should be possible. I haven't tested this, but i guess you can try it? :p

 

There are a few things you have to know how to do:

 

1. Adding new traders to the server. Here's a tutorial by mysticviperx:

 

2. Making a custom compiles.sqf & fn_selfactions.sqf (Step 1-3):

http://epochmod.com/forum/index.php?/topic/965-release-trader-menu-dialogs/?p=6646

 

3. Editing fn_selfactions.sqf for your purpose.

 

Find this in fn_selfactions.sqf:

            _low_high = "low";
            _humanity_logic = false;
            if((_traderMenu select 2) == "friendly") then {
                _humanity_logic = (_humanity < -5000);
            };
            if((_traderMenu select 2) == "hostile") then {
                _low_high = "high";
                _humanity_logic = (_humanity > -5000);
            };
            if((_traderMenu select 2) == "hero") then {
                _humanity_logic = (_humanity < 5000);
            };
            if(_humanity_logic) then {
                _cancel = player addAction [format["Your humanity is too %1 this trader refuses to talk to you.",_low_high], "\z\addons\dayz_code\actions\trade_cancel.sqf",["na"], 0, true, false, "",""];
                s_player_parts set [count s_player_parts,_cancel];
            } else {

Add one extra "if statement" below it, and lets call the new trader superhero + the 10k humanity so it will look like this:

			_low_high = "low";
			_humanity_logic = false;
			if((_traderMenu select 2) == "friendly") then {
				_humanity_logic = (_humanity < -5000);
			};
			if((_traderMenu select 2) == "hostile") then {
				_low_high = "high";
				_humanity_logic = (_humanity > -5000);
			};
			if((_traderMenu select 2) == "hero") then {
				_humanity_logic = (_humanity < 5000);
			};
                        if((_traderMenu select 2) == "superhero") then {
                                _humanity_logic = (_humanity < 10000);
                        };
			if(_humanity_logic) then {
				_cancel = player addAction [format["Your humanity is too %1 this trader refuses to talk to you.",_low_high], "\z\addons\dayz_code\actions\trade_cancel.sqf",["na"], 0, true, false, "",""];
				s_player_parts set [count s_player_parts,_cancel];
			} else {

Lastly you should edit server_traders.sqf (assuming you already added a new trader!)

 

Example of a newly added trader in server_Traders.sqf:

// Super Hero Vendor
menu_Tanny_PMC = [
    [["Ammunition",478],["Clothes",476],["Helicopter Armed",493],["Military Armed",562],["Trucks Armed",479],["Weapons",477]],
    [],
    "hero"
];

change the "hero" to "superhero" (same as in fn_selfactions.sqf) like this:

// Super Hero Vendor
menu_Tanny_PMC = [
    [["Ammunition",478],["Clothes",476],["Helicopter Armed",493],["Military Armed",562],["Trucks Armed",479],["Weapons",477]],
    [],
    "superhero"
];

This should work in theory :)

Link to comment
Share on other sites

i have tried Above, but im unable to get the trader menu to appear upon testing the first section >.> i dont know whether im doing it wrong or whether it no longer works, this is a pastebin link for my coding: the highlighted section is parts that ive edited http://pastebin.com/3bpwA0FQ

 

Huh? Where are you pasting that trader code? That should be in server_traders.sqf

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...
  • 1 month later...

Alright I'm trying to figure out what I'm doing wrong I am trying to make two new traders one for 30000 humanity and one for -30000 humanity. Both the traders are physically there, they have trader menus, however they aren't selling anything and are not turning me away for not having the required humanity. The only RPT errors I get are below.

 

12:35:48 Error in expression <menu_Soldier_Sniper_PMC_DZ;>
12:35:48   Error position: <menu_Soldier_Sniper_PMC_DZ;>
12:35:48   Error Undefined variable in expression: menu_soldier_sniper_pmc_dz
12:35:48 Error in expression <menu_Ins_Soldier_GL_DZ;>
12:35:48   Error position: <menu_Ins_Soldier_GL_DZ;>
12:35:48   Error Undefined variable in expression: menu_ins_soldier_gl_dz

server_traders.sqf

 

// Super Hero Trader
Soldier_Sniper_PMC_DZ = [
    [["Dangerous, Dangerous Weapons",694],["Dangerous Armed Vehicles",695]],
    [],
    "superhero"
];
// Terrorist Trader
Ins_Soldier_GL_DZ = [
    [["Dangerous, Dangerous Weapons",696],["Dangerous Armed Vehicles",697]],
    [],
    "terrorist"
];

mission.sqf

 

_unit_1500 = objNull;
if (true) then
{
  _this = createAgent ["Soldier_Sniper_PMC_DZ", [14248, 14133, 0], [], 0, "CAN_COLLIDE"];
  _unit_1500 = _this;
  _this setDir 0;
  _this setVehicleInit "this allowDammage false; this disableAI 'FSM'; this disableAI 'MOVE'; this disableAI 'AUTOTARGET'; this disableAI 'TARGET'; this setBehaviour 'CARELESS'; this forceSpeed 0;";
  _this setUnitAbility 0.60000002;
  _this allowDammage false; _this disableAI 'FSM'; _this disableAI 'MOVE'; _this disableAI 'AUTOTARGET'; _this disableAI 'TARGET'; _this setBehaviour 'CARELESS'; _this forceSpeed 0;_this enableSimulation false;};


_vehicle_1501 = objNull;
if (true) then
{
  _this = createVehicle ["HeliHCivil", [14236.6, 14152.1], [], 0, "CAN_COLLIDE"];
  _vehicle_1501 = _this;
  _this setDir 326;
  _this setPos [14236.6, 14152.1];
};


_unit_1502 = objNull;
if (true) then
{
  _this = createAgent ["Ins_Soldier_GL_DZ", [2664.3, 14216.7, 0], [], 0, "CAN_COLLIDE"];
  _unit_1502 = _this;
  _this setDir 208;
  _this setVehicleInit "this allowDammage false; this disableAI 'FSM'; this disableAI 'MOVE'; this disableAI 'AUTOTARGET'; this disableAI 'TARGET'; this setBehaviour 'CARELESS'; this forceSpeed 0;";
  _this setUnitAbility 0.60000002;
  _this allowDammage false; _this disableAI 'FSM'; _this disableAI 'MOVE'; _this disableAI 'AUTOTARGET'; _this disableAI 'TARGET'; _this setBehaviour 'CARELESS'; _this forceSpeed 0;_this enableSimulation false;};


_vehicle_1503 = objNull;
if (true) then
{
  _this = createVehicle ["HeliHCivil", [2649.8, 14200], [], 0, "CAN_COLLIDE"];
  _vehicle_1503 = _this;
  _this setDir 72;
  _this setPos [2649.8, 14200];
};

fn_SelfActions.sqf

 

// diag_log ("TRADER = " + str(_traderMenu));


_low_high = "low";
_humanity_logic = false;
if((_traderMenu select 2) == "friendly") then {
_humanity_logic = (_humanity < -5000);
};
if((_traderMenu select 2) == "hostile") then {
_low_high = "high";
_humanity_logic = (_humanity > -5000);
};
if((_traderMenu select 2) == "hero") then {
_humanity_logic = (_humanity < 5000);
};
if((_traderMenu select 2) == "superhero") then {
_humanity_logic = (_humanity < 30000);
};
if((_traderMenu select 2) == "terrorist") then {
_low_high = "high";
_humanity_logic = (_humanity > -30000);
};
if(_humanity_logic) then {
_cancel = player addAction [format["Your humanity is too %1 this trader refuses to talk to you.",_low_high], "\z\addons\dayz_code\actions\trade_cancel.sqf",["na"], 0, true, false, "",""];
s_player_parts set [count s_player_parts,_cancel];

Edit: Was able to get it working, didn't realize I was using the DZ instead of the normal classnames and I forgot menu_ in front of the traders in the servers_trader.sqf.

Link to comment
Share on other sites

I was just Messing about in DayZ Epoch and thought of an idea, what if i could make "New" traders for say a "Hero" level 2, this hero would have 10k humanity in order to access this trader, and the trader would have a new list that only people with 10k+ humanity could access.

 

i was just wondering, whether this would be possible and if so, which files would i need to edit on my server?

 

 

then people will just infect a friend and use hundreds of bloodbags to acces it? No, thanks.

Link to comment
Share on other sites

  • 1 month later...
hey guys losing the will to live with this one now lol so im trying to add a super hero vendor to the map. i used this tutorial to add him to the map (https://docs.google.com/document/d/17qG ... UiZuQ/edit) and this tutorial to make a humanitys requirement of 20000 () what i dont understand in the first tutorial is updating the object number, what do i update it to? i have tried many different ones and whatever i change it to, my trader is still on the map. and for the database, what instance do i set it to? it says 11 in that tuorial. anyway the trader is on the map and displayes the menu and items just fine, however anyone can acess it, heros bandits and neutral. im sure my problem is coming from either the object number or the instance but i am at a loss now, if anyone has the answer ill love you for ever lol.

here is what i added to my mission.sqf

_unit_146 = objNull;
if (true) then
{
_this = createAgent ["Tanny_PMC", [5898.0303, 10544.666], [], 0, "CAN_COLLIDE"];
_unit_146 = _this;
_this setDir -83.040123;
_this setVehicleInit "this allowDammage false; this disableAI 'FSM'; this disableAI 'MOVE'; this disableAI 'AUTOTARGET'; this disableAI 'TARGET'; this setBehaviour 'CARELESS'; this forceSpeed 0;";
_this setUnitAbility 0.60000002;
_this allowDammage false; _this disableAI 'FSM'; _this disableAI 'MOVE'; _this disableAI 'AUTOTARGET'; _this disableAI 'TARGET'; _this setBehaviour 'CARELESS'; _this forceSpeed 0;_this enableSimulation false;
};

here is what my server traders looks like, i have added the tanny_pmc at the top also

/*---------------------------------------------------------------------------
Super Hero Vendor
---------------------------------------------------------------------------*/

//super hero
menu_Tanny_PMC = [
[["Super Hero Trader",693]],
[],
"super"
];

here is my fn_selfactions

// All Traders
if (_isMan and !_isPZombie and _traderType in serverTraders) then {

if (s_player_parts_crtl < 0) then {

// get humanity
_humanity = player getVariable ["humanity",0];
_traderMenu = call compile format["menu_%1;",_traderType];

// diag_log ("TRADER = " + str(_traderMenu));

_low_high = "low";
_humanity_logic = false;
if((_traderMenu select 2) == "friendly") then {
_humanity_logic = (_humanity < -5000);
};
if((_traderMenu select 2) == "hostile") then {
_low_high = "high";
_humanity_logic = (_humanity > -5000);
};
if((_traderMenu select 2) == "hero") then {
_humanity_logic = (_humanity < 5000);
};
if((_traderMenu select 2) == "super") then {
_humanity_logic = (_humanity < 20000);
};
if(_humanity_logic) then {
_cancel = player addAction [format[localize "STR_EPOCH_ACTIONS_HUMANITY",_low_high], "\z\addons\dayz_code\actions\trade_cancel.sqf",["na"], 0, true, false, "",""];
s_player_parts set [count s_player_parts,_cancel];
} else {

he is also set to super in my database written exctly the same and everything and is instance 17 at the moment however i have tried others i will take a screen shot of my database if that helps. Thanks in advance for any help, my mind is boggled lol, Brett.
  •  
Link to comment
Share on other sites

  • 1 month later...

This is what I used:

_low_high = "low";
_humanity_logic = false;
if((_traderMenu select 2) == "friendly") then {
_humanity_logic = (_humanity < -5000);
};
if((_traderMenu select 2) == "hostile") then {
_low_high = "high";
_humanity_logic = (_humanity > -5000);
};
if((_traderMenu select 2) == "hero") then {
_humanity_logic = (_humanity < 5000);
};
if((_traderMenu select 2) == "hero2") then {
_humanity_logic = (_humanity < 10000);
};
if((_traderMenu select 2) == "hero3") then {
_humanity_logic = (_humanity < 20000);
};
if(_humanity_logic) then {
_cancel = player addAction [format[localize "STR_EPOCH_ACTIONS_HUMANITY",_low_high], "\z\addons\dayz_code\actions\trade_cancel.sqf",["na"], 0, true, false, "",""];
s_player_parts set [count s_player_parts,_cancel];
} else {

Only things I added were "hero2" (+10k requirement) and "hero3" (+20k requirement). Everything else is default.

Link to comment
Share on other sites

  • 1 year later...

Carefull: 

Don't forget to add "Menu_" before the classname, in server_traders.sqf. 

@Niverive

On 4/11/2014 at 10:56 PM, Niverive said:

 


12:35:48 Error in expression <menu_Soldier_Sniper_PMC_DZ;>
12:35:48   Error position: <menu_Soldier_Sniper_PMC_DZ;>
12:35:48   Error Undefined variable in expression: menu_soldier_sniper_pmc_dz
12:35:48 Error in expression <menu_Ins_Soldier_GL_DZ;>
12:35:48   Error position: <menu_Ins_Soldier_GL_DZ;>
12:35:48   Error Undefined variable in expression: menu_ins_soldier_gl_dz

server_traders.sqf


// Super Hero Trader
Soldier_Sniper_PMC_DZ = [
    [["Dangerous, Dangerous Weapons",694],["Dangerous Armed Vehicles",695]],
    [],
    "superhero"
];
// Terrorist Trader
Ins_Soldier_GL_DZ = [
    [["Dangerous, Dangerous Weapons",696],["Dangerous Armed Vehicles",697]],
    [],
    "terrorist"
];

 

 

Edit: Was able to get it working, didn't realize I was using the DZ instead of the normal classnames and I forgot menu_ in front of the traders in the servers_trader.sqf.

You forgot to add it. ;)

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

×
×
  • Create New...