Jump to content

Elevator Script for Players and Vehicles [WIP/Prototype]


Axe Cop

Recommended Posts

I've added - "MetalFloor_Preview_DZ"; to my allowedobjects list.

 

Can build the Elevator, but the Elevator Stop dissapears when I build it.

 

Any Ideas?.

if it still disappears it seems you missed something or forgot to upload or reference your modified variables.sqf? maybe check your log files (like always)

Link to comment
Share on other sites

Download elevator folder....here is a link if needed   https://db.tt/PHdIaz9X

extract elevator folder - copy folder named elevator into your mission pbo (where the init.sqf is located)

 

find this in your mission init.sqf

 

//Run the player monitor
    _id = player addEventHandler ["Respawn", {_id = [] spawn player_death;}];
    _playerMonitor =     [] execVM "\z\addons\dayz_code\system\player_monitor.sqf"; 

 

   right under it paste this code found below  -  the ELE lines allow build of elevator without parts! comment out if you want parts

ELE_StopClass = "MetalFloor_Preview_DZ"; // will use the lockbox as stop object to call the elevator and set the positions, only if you don't want to use the transparent metal floors...
ELE_RequiredBuildTools = [];
ELE_RequiredBuildItems = [];
ELE_RequiredBuildStopItems = [];
["elevator"] execVM "elevator\elevator_init.sqf";

 

now in the same pbo find the init folder - open and locate variables.sqf

there is a list "dayz_allowedObjects", just add "MetalFloor_Preview_DZ" to that list

 

mine looks like this  (shortened it for example)

 

dayz_allowedObjects = ["TentStorage","TentStorageDomed","TentStorageDomed2","MetalFloor_Preview_DZ","VaultStorageLocked","FireBarrel_DZ","WoodCrate_DZ","Scaffolding_DZ"];

 

now repack the files into pbo -upload to your server - start server ... when you lay down a metal floor...look down and elevator options will be shown - create elevator....lay another create stop

goodluck

 

 

I added the download link because there was a file in original that needed editing for some people...mine has been edited p.s. increase my elevator speed and distance as well  :P

OrrEOaU.png

Css2x1p.png

 

mwdfD79.png

Link to comment
Share on other sites

Hey dude's, just a quick suestion. how would i get the elevator to check co-ordinates of players/vehicles on it?

I find that everything will orientate its self after moving to the second par in the direction it was built in.

Any ideas ?

 

Cheers

 

George

Yeah I noticed that, but all I did was using the script function "attachTo" and nothing else to attach players and vehicles to the elevator platform.

I don't know why the position and direction changes  sometimes and if you can even influence that with script commands... not that bad I think but it may confuse some players :)

Link to comment
Share on other sites

Você poderia editar e fazer com que o elevator seja consruído sem o  ItemGenerator?
e modificar para que ele funcione apenas se um ItemGenertor estiver no máximo a 1 metro do elevator?


exemplo: Fuelpump (refuel) só funciona quando um itemGenerator esiver perto, caso contrário, ele aparece: "NeedPower"

 

é uma dica só pra ficar mais real

 

obrigado :)

Link to comment
Share on other sites

Você poderia editar e fazer com que o elevator seja consruído sem o  ItemGenerator?

e modificar para que ele funcione apenas se um ItemGenertor estiver no máximo a 1 metro do elevator?

exemplo: Fuelpump (refuel) só funciona quando um itemGenerator esiver perto, caso contrário, ele aparece: "NeedPower"

 

é uma dica só pra ficar mais real

 

obrigado :)

You are lucky I can use google translator haha, if I understand you correctely that is possible, but you change the script a little for that. :)

Link to comment
Share on other sites

 

Hey if any of you are using by Zupa and rosska85 there is now away to control who uses the elevator.  I would suggest diffing if you made changes to the elevator_init.sqf file like the folder location.  This is the best I could come up with so if you see a better way let us know.  If there name is on the plotpole they get the selection to use and build.

 

elevator_init.sqf

This is excellent man, just what I was looking for. Any chance you could make it so the call elevator option doesn't appear for non plot friends as well?

Link to comment
Share on other sites

This is excellent man, just what I was looking for. Any chance you could make it so the call elevator option doesn't appear for non plot friends as well?

This is written to only show the options if you are on the plotpole.  Poeple not on the plotpole shouldn't be getting the option if you installed it correctly.

Link to comment
Share on other sites

This is written to only show the options if you are on the plotpole.  Poeple not on the plotpole shouldn't be getting the option if you installed it correctly.

Sorry I wrote that at 6 AM, just realized the wording was terrible. Currently with that elevator_init someone not on the plot friends list can still call the elevator, they just can't activate it. I was curious if you could also make it so only plot friends can call elevators. PS great work, been looking into securing these for a while now.

Link to comment
Share on other sites

Sorry I wrote that at 6 AM, just realized the wording was terrible. Currently with that elevator_init someone not on the plot friends list can still call the elevator, they just can't activate it. I was curious if you could also make it so only plot friends can call elevators. PS great work, been looking into securing these for a while now.

Changed the code try it and let me know.  I edit the orginal post with new code.

Link to comment
Share on other sites

Anyone else having server performance issues when using this mod? We were doing some testing before going live with our new server and the biggest place we noticed server lag is with opening your parachute with HALO spawning. It would take 4 to 5 seconds to deploy your parachute. So I disabled all the mods and enabled them one at a time until the issue reappeared. It was this mod. I was able to enable all other mods without the general lag and parachutes opened in under a second.

Link to comment
Share on other sites

You are lucky I can use google translator haha, if I understand you correctely that is possible, but you change the script a little for that. :)

ok, sou programador, mas comecei a utilizar o Dayz a pouco tempo, por isso, tenho dificuldades em fazer estas pequenas alterações.

Vou tentar identificar o arquivo que tem a função do "FuelPump" e tentar adaptá-lo para o seu, pois meu conhecimento com ".sqf" ainda é muito pequeno :(

obrigado por responder

 

____________________________________________________________________________________________________________________

 

 

ok , I'm a programmer, but I started using the Dayz little time , so I have trouble making these small changes .
I will try to identify the file that has the function of " FuelPump " and try to adapt it to yours, because my knowledge with " .sqf " is still very small
 
thanks for Reply
Link to comment
Share on other sites

 

Hey if any of you are using by Zupa and rosska85 there is now away to control who uses the elevator.  I would suggest diffing if you made changes to the elevator_init.sqf file like the folder location.  This is the best I could come up with so if you see a better way let us know.  If there name is on the plotpole they get the selection to use and build.

 

Edit:  TheHound found that the selection for calling the elevator is still avalible if your not on the plot pole.  Changed code to block all selections if not on plot pole.

 

elevator_init.sqf

private ["_folder","_ct","_findNearestPoles","_findNearestPole","_IsNearPlot"];

if (isServer || isDedicated) exitWith {
	diag_log "Error: Elevator script should NOT be started on the server";
};
if (count _this != 1) exitWith {
	diag_log "Error: elevator_init.sqf called with wrong parameter count (the only parameter should be the folder of the script relative to the mission folder)";
};

_folder = (_this select 0) + "\";

// global variables
if (isNil "ELE_PlatformClass") then { ELE_PlatformClass = "MetalFloor_DZ" };
if (isNil "ELE_StopClass") then { ELE_StopClass = "MetalFloor_Preview_DZ" };
if (isNil "ELE_MaxRange") then { ELE_MaxRange = 25 }; // m
if (isNil "ELE_Size") then { ELE_Size = 4 }; // m
if (isNil "ELE_Speed") then { ELE_Speed = 2 }; // m/s
if (isNil "ELE_StopWaitTime") then { ELE_StopWaitTime = 5 }; // s
if (isNil "ELE_UpdatesPerSecond") then { ELE_UpdatesPerSecond = 60 }; // animation updates per second
if (isNil "ELE_RequiredBuildTools") then { ELE_RequiredBuildTools = ["ItemToolbox", "ItemCrowbar"] }; // required tools for building an elevator and elevator stop
if (isNil "ELE_RequiredBuildItems") then { ELE_RequiredBuildItems = [["PartGeneric",4], "PartEngine", "ItemGenerator", "ItemJerrycan"] }; // required items to build an elevator
if (isNil "ELE_RequiredBuildStopItems") then { ELE_RequiredBuildStopItems = [["PartGeneric",4]] }; // required items to build an elevator stop
if (isNil "ELE_Debug") then { ELE_Debug = false }; // debug flag

ELE_elevator = nil;

// global functions
call compile preprocessFileLineNumbers (_folder + "vector.sqf");
call compile preprocessFileLineNumbers (_folder + "ac_functions.sqf");
call compile preprocessFileLineNumbers (_folder + "elevator_functions.sqf");

diag_log "Elevator script initialized";

// elevator actions
while {true} do {
	_ct = cursorTarget;
            _findNearestPoles = nearestObjects[player, ["Plastic_Pole_EP1_DZ"], DZE_PlotPole select 0];
            _IsNearPlot = count (_findNearestPoles);
            _fuid  = [];
            _allowed = [];
        if(_IsNearPlot > 0)then{
            _thePlot = _findNearestPoles select 0;
            _owner =  _thePlot getVariable ["ownerPUID","010"];
            _friends = _thePlot getVariable ["plotfriends", []];

        {
            _friendUID = _x select 0;
            _fuid  =  _fuid  + [_friendUID];
        } forEach _friends;

         _allowed = [_owner];    
         _allowed = [_owner] +  _fuid;

        };
	if ((!isNull _ct) && ((getPlayerUID player) in _allowed) && {(player distance _ct) < ELE_Size}) then {
		// has target
		if (typeOf _ct == ELE_PlatformClass) then {
			// elevator actions
			if ([_ct] call ELE_fnc_isElevator) then {
				if (s_player_elevator_next < 0 && {[_ct] call ELE_fnc_hasNextStop}) then {
					s_player_elevator_next = player addAction ["<t color=""#ffffff"">Activate Elevator: Next Stop</t>", _folder+"elevator_actions.sqf", ["next",_ct], 5, false];
				};
				if (s_player_elevator_previous < 0 && {[_ct] call ELE_fnc_hasPreviousStop}) then {
					s_player_elevator_previous = player addAction ["<t color=""#ffffff"">Activate Elevator: Previous Stop</t>", _folder+"elevator_actions.sqf", ["previous",_ct], 5, false];
				};
				if (s_player_elevator_select < 0) then {
					s_player_elevator_select = player addAction ["<t color=""#ffffff"">Select Elevator</t>", _folder+"elevator_actions.sqf", ["select",_ct], 1, false];
				};
			} else {
				if (s_player_elevator_upgrade < 0) then {
					s_player_elevator_upgrade = player addAction ["<t color=""#ffffff"">Upgrade to Elevator</t>", _folder+"elevator_build.sqf", ["build",_ct], 0, false];
				};
				if (s_player_elevator_upgrade_stop < 0) then {
					s_player_elevator_upgrade_stop = player addAction ["<t color=""#ffffff"">Upgrade to Elevator Stop</t>", _folder+"elevator_build.sqf", ["build_stop",_ct], 0, false];
				};
			};
		};
		// elevator stop actions
		if ([_ct] call ELE_fnc_isElevatorStop) then {
			if (s_player_elevator_call < 0) then {
				s_player_elevator_call = player addAction ["<t color=""#ffffff"">Call Elevator</t>", _folder+"elevator_actions.sqf", ["call",_ct], 5, false];
			};
		};
		// debug actions
		if (s_player_elevator_id < 0 && ELE_Debug) then {
			s_player_elevator_id = player addAction ["<t color=""#ddffffff"">Show Elevator ID</t>", _folder+"elevator_actions.sqf", ["id",_ct], 0, false];
		};
	} else {
		player removeAction s_player_elevator_next;
		s_player_elevator_next = -1;
		player removeAction s_player_elevator_previous;
		s_player_elevator_previous = -1;
		player removeAction s_player_elevator_select;
		s_player_elevator_select = -1;
		player removeAction s_player_elevator_upgrade;
		s_player_elevator_upgrade = -1;
		player removeAction s_player_elevator_upgrade_stop;
		s_player_elevator_upgrade_stop = -1;
		player removeAction s_player_elevator_call;
		s_player_elevator_call = -1;
		player removeAction s_player_elevator_id;
		s_player_elevator_id = -1;
	};
	sleep 1;
};


I don't use Plot Management but thought I'd see if this would work anyway, I am using RimBlocks P4L, so it does block people from accessing the elevator controls if it's not their plot pole but the friends doesn't work, any idea how to adjust this so it works?

Link to comment
Share on other sites

I don't use Plot Management but thought I'd see if this would work anyway, I am using RimBlocks P4L, so it does block people from accessing the elevator controls if it's not their plot pole but the friends doesn't work, any idea how to adjust this so it works?

All I can say is install Plot Management and you will be good.  There is no other way to save freinds to the plotpole that I've seen.

Link to comment
Share on other sites

All I can say is install Plot Management and you will be good.  There is no other way to save freinds to the plotpole that I've seen.

Ok I'll just put that in, I was planning on using it anyway just hadn't got to putting it in.

 

Also does anyone know how to make it snap helicopters to the panel the same as vehicles? I've added "air" to the objects that get attached to it but it's not doing it.

Link to comment
Share on other sites

@Axe Cop and @Users.

 

If you want i can make an elevator manaager?. 

 

Cyberwarden did a good job showing you how to bind it to plotmangement.

 

But if you guys want to add poeple to particular elevators, i can make something easy (simular to )

That'd be awesome, is it possible to give it an array in the init with the kinds of vehicles you want it to attachto as well? Because atm it's not grabbing heli's.

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