Jump to content

[Updated] Open Churches (Epoch 1.0.6.1)


hellraver

Recommended Posts

Hi Guys,

the original idea probably comes from user "cyrq". Therefore all credits go to him.

What have I done? I now have all the churches cleanly placed and straightened.

In the original version, almost every church was placed very stupidly and flawed.

Benches stood out in the church ..... My version should now be free of Errors ;-)

 

And now the tutorial:

Step 1:  Open your MPMission folder and then the dayz.epoch.chernarus folder.

If instead of the dayz.epoch.chernarus folder a dayz.epoch.chernarus.pbo file is present unpack the dayz.epoch.chernarus.pbo file.

 

Step 2: Open your "init.sqf" file with a Text Editor (Notepad++...) and search this line:

if (toLower(worldName) == "chernarus") then {
	diag_log "WARNING: Clearing annoying benches from Chernarus";
	([4654,9595,0] nearestObject 145259) setDamage 1;
	([4654,9595,0] nearestObject 145260) setDamage 1;
};

Replace it with this code and save it:

if (toLower(worldName) == "chernarus") then {
	diag_log "WARNING: Clearing annoying benches from Chernarus";
	([4654,9595,0] nearestObject 145259) setDamage 1;
	([4654,9595,0] nearestObject 145260) setDamage 1;
	diag_log "WARNING: Clearing closed churches from Chernarus";
	([6038,7768,0] nearestObject 204126) hideObject true; //Church Stary Sobor
	([6192,10406,0] nearestObject 152495) hideObject true; //Church Grishino
	([2712,10047,0] nearestObject 123798) hideObject true; //Church Lopatino
	([2733,5451,0] nearestObject 186325) hideObject true; //Church Zelenogorsk
	([1727,3828,0] nearestObject 310481) hideObject true; //Church Pavlovo
	([7415,5168,0] nearestObject 225183) hideObject true; //Church Mogilevka
	([12870,10137,0] nearestObject 257901) hideObject true; //Church Sawmill
};

Step 3: Create in the root directory where the init file is present a folder with the name "addons".

Create following subfolders in the "addons" folder  -> "dayz_code\system\mission\".

Crate a "churches.sqf" file now  in this folder which we created -> "addons\dayz_code\system\mission\

Note:  You can also create a different path. Please also consider this in the init file in Step 5!

 

Step 4: Open now the "churches.sqf" file  and paste this code.

if (isServer) then {
	_vehicle_1 = objNull;
	if (true) then
	{
	  _this = createVehicle ["Land_Church_03", [6027.6387, 7777.9604, 0.21592264], [], 0, "CAN_COLLIDE"]; //Church Stary Sobor
	  _vehicle_1 = _this;
	  _this setDir 220.29143;
	  _this setPos [6027.6387, 7777.9604, 0.21592264];
	  _this setVectorUp [0,0,1];
	};

	_vehicle_2 = objNull;
	if (true) then
	{
	  _this = createVehicle ["Land_Church_03", [6179.9837, 10411.974, 1.0130899], [], 0, "CAN_COLLIDE"]; //Church Grishino
	  _vehicle_2 = _this;
	  _this setDir 201.64735;
	  _this setPos [6179.9837, 10411.974, 1.0130899];
	  _this setVectorUp [0,0,1];
	};

	_vehicle_3 = objNull;
	if (true) then
	{
	  _this = createVehicle ["Land_Church_03", [2718.3496, 10049.25, 0.36714295], [], 0, "CAN_COLLIDE"]; //Church Lopatino
	  _vehicle_3 = _this;
	  _this setDir -22.087906;
	  _this setPos [2718.3496, 10049.25, 0.36714295];
	  _this setVectorUp [0,0,1];
	};

	_vehicle_4 = objNull;
	if (true) then
	{
	  _this = createVehicle ["Land_Church_03", [2741.4951, 5460.6431, 0.59279299], [], 0, "CAN_COLLIDE"]; //Church Zelenogorsk
	  _vehicle_4 = _this;
	  _this setDir -59.786922;
	  _this setPos [2741.4951, 5460.6431, 0.59279299];
	};

	_vehicle_5 = objNull;
	if (true) then
	{
	  _this = createVehicle ["Land_Church_03", [1731.7397, 3828.8367, 0.36492082], [], 0, "CAN_COLLIDE"]; //Church Pavlovo
	  _vehicle_5 = _this;
	  _this setDir -16.372017;
	  _this setPos [1731.7397, 3828.8367, 0.36492082];
	  _this setVectorUp [0,0,1];
	};

	_vehicle_6 = objNull;
	if (true) then
	{
	  _this = createVehicle ["WoodStairsRails_DZ", [1743.2777, 3824.4163, -1.3266945], [], 0, "CAN_COLLIDE"]; //Stairs Church Pavlovo
	  _vehicle_6 = _this;
	  _this setDir -196.41689;
	  _this setPos [1743.2777, 3824.4163, -1.3266945];
	};

	_vehicle_7 = objNull;
	if (true) then
	{
	  _this = createVehicle ["Land_Church_03", [7409.1499, 5175.6997, 0.30705196], [], 0, "CAN_COLLIDE"]; //Church Mogilevka
	  _vehicle_7 = _this;
	  _this setDir -134.79289;
	  _this setPos [7409.1499, 5175.6997, 0.30705196];
	};

	_vehicle_8 = objNull;
	if (true) then
	{
	  _this = createVehicle ["Land_Church_03", [12866.221, 10142.662, 0.093297787], [], 0, "CAN_COLLIDE"]; //Church Sawmill
	  _vehicle_8 = _this;
	  _this setDir 204.55789;
	  _this setPos [12866.221, 10142.662, 0.093297787];
	  _this setVectorUp [0,0,1];
	};
};

processInitCommands;

If done save the file and close it.

Step 5: Open again your "init.sqf" file and search now this line:

call compile preprocessFileLineNumbers "server_traders.sqf";
call compile preprocessFileLineNumbers "\z\addons\dayz_code\system\mission\chernarus11.sqf"; //Add trader city objects locally on every machine early
if (dayz_POIs && (toLower worldName == "chernarus")) then {call compile preprocessFileLineNumbers "\z\addons\dayz_code\system\mission\chernarus\poi\init.sqf";}; //Add POI objects locally on every machine early
initialized = true;

Please enter following code:

if (toLower worldName == "chernarus") then {call compile preprocessFileLineNumbers "addons\dayz_code\system\mission\churches.sqf";}; //Add open churches objects globally on every machine early

If done this should look like this:

call compile preprocessFileLineNumbers "server_traders.sqf";
call compile preprocessFileLineNumbers "\z\addons\dayz_code\system\mission\chernarus11.sqf"; //Add trader city objects locally on every machine early
if (toLower worldName == "chernarus") then {call compile preprocessFileLineNumbers "addons\dayz_code\system\mission\churches.sqf";}; //Add open churches objects globally on every machine early
if (dayz_POIs && (toLower worldName == "chernarus")) then {call compile preprocessFileLineNumbers "\z\addons\dayz_code\system\mission\chernarus\poi\init.sqf";}; //Add POI objects locally on every machine early
initialized = true;

Save the "init.sqf" file and close it.

Repack your dayz.epoch.chernarus.pbo but you do not have to.

The server can also access the folder.

Step 6: We are done :-)

Have fun and I hope I could help some people.

Sorry if my english is not correct. I speak german and use the google translator and my school english xD

I am 36 years old  and this was my first english tutorial ^^ ;-)

 

Best Reagards hellraver

Edited by hellraver
Link to comment
Share on other sites

@hellraver great! this is awesome to start to play with the code a lil if u dont mine.

nothing is tested ok? but maybe in churches.sqf you can use the epoch trader objects structure

churches.sqf

Spoiler

//churchs by hellraver
private ["_blockDamage","_fires","_object","_objects","_type"];

fn_spawnchurch {
_objects = _this select 0;
_blockDamage = _this select 1;



{
	_type = _x select 0;
	_object = _type createVehicleLocal [0,0,0];
	_object setDir (_x select 2);
	_object setPos (_x select 1);
	_object setVariable ["",true,false]; // stops global setVariable by sched_townGenerator, checked in player_spawnCheck for loot spawn
	if (_blockDamage) then {
		_object addEventHandler ["HandleDamage",{0}];
		
	};
} forEach _objects;
};

[[
	["Land_Church_03",[6027.6387, 7777.9604,0.21592264],220.29143],//Church Stary Sobor
	
	["Land_Church_03",[6179.9837, 10411.974, 1.0130899],201.64735],//Church Grishino
	
	["Land_Church_03",[2718.3496, 10049.25,0.36714295],-22.087906],//Church Lopatino
	
	["Land_Church_03",[2741.4951, 5460.6431,0.59279299],-59.786922],//Church Zelenogorsk
	
	["Land_Church_03",[1731.7397, 3828.8367,0.36492082],-16.372017],//Church Pavlovo
	
	["Land_Church_03",[1743.2777, 3824.4163,-1.3266945],-196.41689],//Stairs Church Pavlovo
	
	["Land_Church_03",[7409.1499, 5175.6997,0.30705196],-134.79289],//Church Mogilevka
	
	["Land_Church_03",[12866.221, 10142.662,0.093297787],204.55789]//Church Sawmill

],true] call fn_spawnchurch;	

call it from


call compile preprocessFileLineNumbers "\z\addons\dayz_code\system\mission\chernarus11.sqf"; 
call compile preprocessFileLineNumbers "\z\addons\dayz_server\churches.sqf";//new churches

 

 

now you can use some actions into the churches.

for example in a custom fn_selfactions.sqf

at bottom add:

Spoiler

//churches pray
private["_playerPos","_nearchurch"];

_playerPos = getPosATL player;
_nearchurch = count nearestObjects [_playerPos, ["Land_Church_03"], 3] > 0;
 
if (_nearchurch) then {
        if (s_player_pray < 0) then {
            s_player_pray = player addaction[("<t color=""#F7D708"">" + ("Pray For a Miracle") +"</t>"),"churches\pray.sqf"];
        };
    } else {
        player removeAction s_player_pray;
        s_player_pray = -1;
    };		

 

pray.sqf (mpmissions\instance_11-chernarus\churches\ )

Spoiler

private ["_LastUsedTime","_Time","_isHero","_isBandit","_miracleChanceB","_miracleChanceS","_miracleChanceH","_miraclerand"];

_LastUsedTime = 900;
_Time = time - lastuse;	
_isHero = (player getVariable["humanity",0]) >= 5000;
_isBandit = (player getVariable["humanity",0]) <= 5000;
_miraclerand	= round(random 10);
_miracleChanceH	= 5;
_miracleChanceS	= 3;
_miracleChanceB	= 2;

if(_Time < _LastUsedTime) exitWith { 
    cutText [format["wait %1 seconds",(round(_Time - _LastUsedTime))], "PLAIN DOWN"]; 
};

fn_heal {

	disableSerialization;
                                dayz_sourceBleeding = objNull;
                                r_player_blood = r_player_bloodTotal;
                                r_player_inpain = false;
                                r_player_infected = false;
                                r_player_injured = false;
                                dayz_hunger = 0;
                                dayz_thirst = 0;
                                dayz_temperatur = 37;
                                r_fracture_legs = false;
                                r_fracture_arms = false;
                                r_player_dead = false;
                                r_player_unconscious = false;
                                r_player_loaded = false;
                                r_player_cardiac = false;
                                r_player_lowblood = false;
                                r_player_timeout = 0;
                                r_handlercount = 0;
                                r_interrupt = false;
                                r_doLoop = false;
                                r_drag_sqf = false;
                                r_self = false;
                                r_action = false;
                                r_action_unload = false;
                                r_player_handler = false;
                                r_player_handler1 = false;
                                disableUserInput false;
                                'dynamicBlur' ppEffectAdjust [0];
                                'dynamicBlur' ppEffectCommit 5;
                                _selection = 'legs';
                                _damage = 0;
                                player setHit[_selection,_damage];
                                player setVariable['messing',[dayz_hunger,dayz_thirst],true];
                                player setVariable['NORRN_unconscious',false,true];
                                player setVariable['USEC_infected',false,true];
                                player setVariable['USEC_injured',false,true];
                                player setVariable['USEC_inPain',false,true];
                                player setVariable['USEC_isCardiac',false,true];
                                player setVariable['USEC_lowBlood',false,true];
                                player setVariable['USEC_BloodQty',12000,true];
                                player setVariable['unconsciousTime',0,true];
                                player setVariable['hit_legs',0,true];
                                player setVariable['hit_hands',0,true];
                                player setVariable['medForceUpdate',true,true];
                                _display = uiNameSpace getVariable 'DAYZ_GUI_display';
                                _control = _display displayCtrl 1303;
                                _control ctrlShow false;
                                _display = uiNameSpace getVariable 'DAYZ_GUI_display';
                                _control = _display displayCtrl 1203;
                                _control ctrlShow false;
                                player setdamage 0;
                                0 fadeSound 1;
                                resetCamShake;
								lastuse = time;
};




if (_isHero) then {
if (_miraclerand < _miracleChanceH)  exitWith {
systemChat("God its not here today");
};
[player,50] call player_humanityChange;
call fn_heal;
}else{
if (_isBandit) then {
if (_miraclerand < _miracleChanceB)  exitWith {
systemChat("God its not here today");
};
[player,50] call player_humanityChange;
call fn_heal;
}else{
if (!_isHero && !_isBandit) then {	
if (_miraclerand < _miracleChanceS)  exitWith {
systemChat("God its not here today");
};
[player,50] call player_humanityChange;
call fn_heal;
};
};
};

 

this is just an idea mate, nothing is tested.

Link to comment
Share on other sites

Nice idea but you may not use the epoch trader structure. Churches are lootbuildings and lootbuildings should be spawn global and not local. The epoch trader structure spawn local objects. If you use the epoch trader structure, you have building errors. I had to straighten many churches with the "setVector" command to place them clean. That's why you should not use the epoch trader structure otherwise there are ugly representation errors of churches ;-) You must use my churches.sqf file ;-P

Link to comment
Share on other sites

22 minutes ago, hellraver said:

Nice idea but you may not use the epoch trader structure. Churches are lootbuildings and lootbuildings should be spawn global and not local. The epoch trader structure spawn local objects. If you use the epoch trader structure, you have building errors. I had to straighten many churches with the "setVector" command to place them clean. That's why you should not use the epoch trader structure otherwise there are ugly representation errors of churches ;-) You must use my churches.sqf file ;-P

youre right, but maybe if u change

Land_Church_03

by

MAP_Church_03

anyway i gues is not your main idea leave the churches without loot.

Link to comment
Share on other sites

Churches work perfectly (using churches in first post), but not getting the scroll for pray and getting this error.

Error in expression <.sqf"];
};
} else {
player removeAction s_player_pray;
s_player_pray = -1;
};		
>
  Error position: <s_player_pray;
s_player_pray = -1;
};		
>
  Error Undefined variable in expression: s_player_pray
File mpmissions\__CUR_MP.Chernarus\Code\fn_selfActions.sqf, line 1190
  

 

Link to comment
Share on other sites

4 minutes ago, Jim90 said:

Churches work perfectly (using churches in first post), but not getting the scroll for pray and getting this error.


Error in expression <.sqf"];
};
} else {
player removeAction s_player_pray;
s_player_pray = -1;
};		
>
  Error position: <s_player_pray;
s_player_pray = -1;
};		
>
  Error Undefined variable in expression: s_player_pray
File mpmissions\__CUR_MP.Chernarus\Code\fn_selfActions.sqf, line 1190
  

 

try add the

s_player_pray = -1;

in the custom variables.sqf

s_player_hotwirevault = -1;
	s_player_pray = -1;

 

Link to comment
Share on other sites

8 hours ago, juandayz said:

@hellraver great! this is awesome to start to play with the code a lil if u dont mine.

nothing is tested ok? but maybe in churches.sqf you can use the epoch trader objects structure

churches.sqf

  Hide contents


//churchs by hellraver
private ["_blockDamage","_fires","_object","_objects","_type"];

fn_spawnchurch {
_objects = _this select 0;
_blockDamage = _this select 1;



{
	_type = _x select 0;
	_object = _type createVehicleLocal [0,0,0];
	_object setDir (_x select 2);
	_object setPos (_x select 1);
	_object setVariable ["",true,false]; // stops global setVariable by sched_townGenerator, checked in player_spawnCheck for loot spawn
	if (_blockDamage) then {
		_object addEventHandler ["HandleDamage",{0}];
		
	};
} forEach _objects;
};

[[
	["Land_Church_03",[6027.6387, 7777.9604,0.21592264],220.29143],//Church Stary Sobor
	
	["Land_Church_03",[6179.9837, 10411.974, 1.0130899],201.64735],//Church Grishino
	
	["Land_Church_03",[2718.3496, 10049.25,0.36714295],-22.087906],//Church Lopatino
	
	["Land_Church_03",[2741.4951, 5460.6431,0.59279299],-59.786922],//Church Zelenogorsk
	
	["Land_Church_03",[1731.7397, 3828.8367,0.36492082],-16.372017],//Church Pavlovo
	
	["Land_Church_03",[1743.2777, 3824.4163,-1.3266945],-196.41689],//Stairs Church Pavlovo
	
	["Land_Church_03",[7409.1499, 5175.6997,0.30705196],-134.79289],//Church Mogilevka
	
	["Land_Church_03",[12866.221, 10142.662,0.093297787],204.55789]//Church Sawmill

],true] call fn_spawnchurch;	

call it from



call compile preprocessFileLineNumbers "\z\addons\dayz_code\system\mission\chernarus11.sqf"; 
call compile preprocessFileLineNumbers "\z\addons\dayz_server\churches.sqf";//new churches

 

 

now you can use some actions into the churches.

for example in a custom fn_selfactions.sqf

at bottom add:

  Hide contents


//churches pray
private["_playerPos","_nearchurch"];

_playerPos = getPosATL player;
_nearchurch = count nearestObjects [_playerPos, ["Land_Church_03"], 3] > 0;
 
if (_nearchurch) then {
        if (s_player_pray < 0) then {
            s_player_pray = player addaction[("<t color=""#F7D708"">" + ("Pray For a Miracle") +"</t>"),"churches\pray.sqf"];
        };
    } else {
        player removeAction s_player_pray;
        s_player_pray = -1;
    };		

 

pray.sqf (mpmissions\instance_11-chernarus\churches\ )

  Reveal hidden contents


private ["_LastUsedTime","_Time","_isHero","_isBandit","_miracleChanceB","_miracleChanceS","_miracleChanceH","_miraclerand"];

_LastUsedTime = 900;
_Time = time - lastuse;	
_isHero = (player getVariable["humanity",0]) >= 5000;
_isBandit = (player getVariable["humanity",0]) <= 5000;
_miraclerand	= round(random 10);
_miracleChanceH	= 5;
_miracleChanceS	= 3;
_miracleChanceB	= 2;

if(_Time < _LastUsedTime) exitWith { 
    cutText [format["wait %1 seconds",(round(_Time - _LastUsedTime))], "PLAIN DOWN"]; 
};

fn_heal {

	disableSerialization;
                                dayz_sourceBleeding = objNull;
                                r_player_blood = r_player_bloodTotal;
                                r_player_inpain = false;
                                r_player_infected = false;
                                r_player_injured = false;
                                dayz_hunger = 0;
                                dayz_thirst = 0;
                                dayz_temperatur = 37;
                                r_fracture_legs = false;
                                r_fracture_arms = false;
                                r_player_dead = false;
                                r_player_unconscious = false;
                                r_player_loaded = false;
                                r_player_cardiac = false;
                                r_player_lowblood = false;
                                r_player_timeout = 0;
                                r_handlercount = 0;
                                r_interrupt = false;
                                r_doLoop = false;
                                r_drag_sqf = false;
                                r_self = false;
                                r_action = false;
                                r_action_unload = false;
                                r_player_handler = false;
                                r_player_handler1 = false;
                                disableUserInput false;
                                'dynamicBlur' ppEffectAdjust [0];
                                'dynamicBlur' ppEffectCommit 5;
                                _selection = 'legs';
                                _damage = 0;
                                player setHit[_selection,_damage];
                                player setVariable['messing',[dayz_hunger,dayz_thirst],true];
                                player setVariable['NORRN_unconscious',false,true];
                                player setVariable['USEC_infected',false,true];
                                player setVariable['USEC_injured',false,true];
                                player setVariable['USEC_inPain',false,true];
                                player setVariable['USEC_isCardiac',false,true];
                                player setVariable['USEC_lowBlood',false,true];
                                player setVariable['USEC_BloodQty',12000,true];
                                player setVariable['unconsciousTime',0,true];
                                player setVariable['hit_legs',0,true];
                                player setVariable['hit_hands',0,true];
                                player setVariable['medForceUpdate',true,true];
                                _display = uiNameSpace getVariable 'DAYZ_GUI_display';
                                _control = _display displayCtrl 1303;
                                _control ctrlShow false;
                                _display = uiNameSpace getVariable 'DAYZ_GUI_display';
                                _control = _display displayCtrl 1203;
                                _control ctrlShow false;
                                player setdamage 0;
                                0 fadeSound 1;
                                resetCamShake;
								lastuse = time;
};




if (_isHero) then {
if (_miraclerand < _miracleChanceH)  exitWith {
systemChat("God its not here today");
};
[player,50] call player_humanityChange;
call fn_heal;
}else{
if (_isBandit) then {
if (_miraclerand < _miracleChanceB)  exitWith {
systemChat("God its not here today");
};
[player,50] call player_humanityChange;
call fn_heal;
}else{
if (!_isHero && !_isBandit) then {	
if (_miraclerand < _miracleChanceS)  exitWith {
systemChat("God its not here today");
};
[player,50] call player_humanityChange;
call fn_heal;
};
};
};

 

this is just an idea mate, nothing is tested.

[[
	["Land_Church_03", [6027.6387, 7777.9604,0.21592264], 220.29143], // Church Stary Sobor
	["Land_Church_03", [6179.9837, 10411.974, 1.0130899], 201.64735], // Church Grishino
	["Land_Church_03", [2718.3496, 10049.25,0.36714295], -22.087906], // Church Lopatino
	["Land_Church_03", [2741.4951, 5460.6431,0.59279299], -59.786922], // Church Zelenogorsk
	["Land_Church_03", [1731.7397, 3828.8367,0.36492082], -16.372017], // Church Pavlovo
	["Land_Church_03", [1743.2777, 3824.4163,-1.3266945], -196.41689], // Stairs Church Pavlovo
	["Land_Church_03", [7409.1499, 5175.6997,0.30705196], -134.79289], // Church Mogilevka
	["Land_Church_03", [12866.221, 10142.662,0.093297787], 204.55789] // Church Sawmill
], true, false, false] call fnc_spawnObjects;

Would spawn the churches globally instead of locally and would make them indestructible.

Link to comment
Share on other sites

@BigEgg Correctly. Locally spawned churches would be indestructible because the churches would be reloaded after each login. And there would always be loot in the church after logging in. Loot buildings should always be spawned globally.

 

@juandayz Pay for heal at the church ist a little bit crazy ^^ Why pay if you find in hospitals enough blood? I think pay for heal is simply unrealistic.

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