Jump to content
Axe Cop

Elevator Script for Players and Vehicles [WIP/Prototype]

Recommended Posts

I had an idea about doing an elevator script to extend the base building a little or just for some fun with ArmA/Epoch! :D

 

Here is a video of the current prototype: (and don't laugh I got stuck after I fell from the roof  :P)

Just recorded another video to show how to call an elevator, I've placed 4 stops around the house, looks kinda funny yeah :D

If anyone is wondering, I use the preview version of the metal floor to display the stop points of the elevator.. some item has to be present so you can call the elevator there and the positions get saved to the database. This item can be changed in the config but the preview items have no collisions so you can just travel through it and it's easy to see where the elevator can stop.

 

Everything is saved to the database without any need to modify the server files or database structure. It only updates the "CharacterID" field in the "object_data" table like safes or locked door also do in Epoch, I don't want to bore you with the technical details but I encoded the elevator and stop point ID's in an 8 digit long code, always starting with "6976" (that is ASCII code for "EL" :P), the next 3 digits are the elevator ID and the last the elevator stop ID. Meaning you can have up to 10 stops per elevator (0-9) for now. It looks like this (without the "-"), just in case you want to find an elevator in the database or whatever.

ID 8 digits: EL-ID-STID = 6976-###-#

e.g the ID's of an elevator with 2 additional stop points: 69760010 -> 69760011 -> 69760012

 

The elevator can be build similar to the in-place upgrade system from Epoch, so just look at a metal floor (item can also be changed in the config) and you will get an option "Upgrade to Elevator" and "Upgrade to Elevator Stop", the elevator stop can only be build if there is an elevator in range (max. range for the elevator to travel can be changed, default 25m), you have to select an elevator first (the select action will be available if you look at an elevator, also new built elevator are selected by default).

Once you have built an elevator with at least 1 stop point you can just look at it and select "Activate Elevator: Next Stop" or "Activate Elevator: Previous Stop", it will then find and move to the next/previous stop. If there is no stop in range you get a message and nothing happens, the menu could be hidden if there is no next stop for the elevator but in the first version the actions are always shown.

You can also call the elevator at any stop point, it will travel along the way, stopping at every stop point and wait there (default 5 sec. can be changed in the config).

 

Installation and configuration

Ok now to the installation and configuration of the elevator script. The script is only client side, so very easy to add to your mission file!

You can get the current scripts here: https://github.com/vos/dayz/tree/master/elevator just download the whole folder and extract it to your mission file.

To enable the script on your server add this line to your init.sqf at the end of the block "if (!isDedicated) then {" (so just above the next "};" should be fine):

["elevator"] execVM "elevator\elevator_init.sqf";

Assuming your have the elevator folder with the scripts in your mission root, the only parameter of the script "elevator" is the folder relative to your mission file, it's needed to load the other scripts from that folder. You can change it to "scripts\elevator" if your put the elevator-folder there for example.

 

That is all you have to do to install the elevator script on your server, there are some config variables you can change, take a look at the file "elevator_init.sqf" where it says "global variables", you can change the values there, but I would suggest changing it in your init.sqf like the Epoch settings, e.g.:

ELE_MaxRange = 100; // maximum range the elevator can travel / stop points can be built (in meter)
ELE_Speed = 5; // speed of the elevator (meters per second)
ELE_StopWaitTime = 0; // disable the wait time if you call the elevator
...
["elevator"] execVM "elevator\elevator_init.sqf";

Added building requirements and upgrade animation to build the elevator and elevator stops. Default requirements are:

ELE_RequiredBuildTools = ["ItemToolbox", "ItemCrowbar"]; // required tools for building an elevator and elevator stop
ELE_RequiredBuildItems = [["PartGeneric",4], "PartEngine", "ItemGenerator", "ItemJerrycan"]; // required items to build an elevator
ELE_RequiredBuildStopItems = [["PartGeneric",4]]; // required items to build an elevator stop

You will get the default messages from Epoch if you are missing the tools or items.

 

There are no access restrictions yet! Any player can built or use an elevator with this version, so keep that in mind if you want to use it on a live server. I already have some ideas to use the default car keys to use an elevator, that should work.. unless your have some better ideas for access control? :)

 

Just one more thing, as I use the "MetalFloor_Preview_DZ" for the elevator stop by default, if you want to keep it like that you have to add that class to your allowed objects in Epoch, otherwise Epoch will delete it right after you upgrade a metal floor to a stop point. To do that the class needs to be added to the file "dayz_code\init\variables.sqf", at line 466 there is a list "dayz_allowedObjects", just add "MetalFloor_Preview_DZ" to that list and copy the file to your mission folder as usual (the file is referenced in the init.sqf). if you don't want to do that just replace the stop class with this config variable:

ELE_StopClass = "MetalFloor_Preview_DZ";

Replace the classname with whatever you like, I didn't test any other but the elevator will just travel there and you can call the elevator with looking at that object.

 

Remember this is still work in progress, there might be bugs and maybe the elevator ID gets changed so already built elevators might not work after an update, but you can already play around with the script and tell me what you think, Ideas are welcome... :)

Edited by Axe Cop

Share this post


Link to post
Share on other sites

I have an idea about building a elevator model that could be used, I recommended to AxeCop that he uses  the "Notebook" (laptop) ingame as a sort of control panel within a elevator build

 

you're contribution to the community surely hasn't gone unnoticed, if anyone deserves recognition for his contributions its you, keep up the good work :)  

Share this post


Link to post
Share on other sites

Yeah the elevator itself can be build out of anything in the game, but I don't know about desync or whatever if it will be to complex, so keep it simple at first. :)

The elevator works for everything that will be near the platform, so players + vehicles at least.

It might look weird but objects can't fall through when it's moving (even with heavy desync)..

Share this post


Link to post
Share on other sites

After looking at the vid of it mate, personally I LOVE IT, and I know if you can get this either tied to UID or some object that the player/friendly that builds it works for them, then I can see a rash of different bases being made..

Umm maybe like the combo-lock or safe locking technique would work... unsure, I've never really looked into that code....

 

But yeah mate,  your putting some awesome stuff out there atm....NICE WORK.. and I can almost guarrantee that almost all of server admins will want this, or they're player base will be hounding them for it.

 

With what you've done so far, Is it possible for it to go more than 1 storey high, sorta like an express elevator, but with a limit of say 4 or 5 high... I can see some crazy bases getting planned now in my head

 

 

Bags

Share this post


Link to post
Share on other sites

Just as an example of a "large" elevator

 

Imagine a 2x2 square room, with metal floors and either windowed wooden walls or something similar and then a roof on top, I can see the "sky garage" plans in my head already xD

Share this post


Link to post
Share on other sites

Thanks Bags, one of the problems with this is to save the elevator state to the database, maybe I could (mis)use the CharacterID field for that (like safes and doors do it now lol).

My idea was to just do the elevator movement/direction based on the environment, meaning you place a special item at every stop for the elevator, and then get a menu when looking at the item for "move to next/previous stop" (and calling the elevator to that stop if it isn't there) or something like that, the script can find the next stop by itself without saving it to the database. With a solution like that you can make the elevator go where you like in a certain range of course.

For example you set a stop on the ground (where you build the elevator itself) and another 10m away, no matter where it is there should be a direct line of sight of course but other then that it does not matter if it is on top or diagonal or wherever from the first stop you know, the elevator will just travel in that direction. :)

 

Edit: I had a weird idea, maybe it is possible to use the "inventory" field of the database to save the elevator state and owner, etc.. but I have to check if that doesn't interfere with other parts from the Epoch code, but essentially the inventory is not used for building parts.. :P

Edited by Axe Cop

Share this post


Link to post
Share on other sites

Maybe it's possible to "attach" the objects together to make it smoother?

In the video above I did attach everything to the plattform, but as you can see the plattform itself looks weird, but the little bird next to the player is perfectly smooth.. maybe I try something else but attaching everything with each other is no solution haha :D

Share this post


Link to post
Share on other sites

This is amazing! , I think it would be a great addon for epoch. I will say the the whole side elevator thing is odd " i dislike" but if it were to be kept at a up and down movement option. I think it would add a ton to the community. 

Share this post


Link to post
Share on other sites

Hey some updates on my elevator script.

 

I implemented most of the important stuff today, so I might release the first version soon.

The elevator is working and saving "everything" needed to the database (no need to modify the database or the server files, it just uses the CharacterID field with my special encoded stuff you will see lol).

For now you are able to create elevators and my so called stop points with the in-place upgrade option, where the elevator will stop (duh) and can be called from. There ca be up to 9 stop points for each elevator so in total 10 stories high (it just uses 1 digit so might be extened to 100 stories with 2 digits but I guess that's enough for now). You get actions to move to the next or previous stop point if you look at the platform and the elevator can be called from any stop point and travel along all points to where you called it, it can't go straight because the stop points might not be in line, so you can place them all over the place within the max. range beween every point! looks kinda funny if you do that in zig-zag :D

Most settings can be customized with global variables like Epoch itself.

 

Ok now one of the major problems is the animation of the elevator itself, it works like it should be in the direction, speed and whatever I want it to go (after I added all vector calculation in myself..), BUT it's "laggy" at most times, all I do is set the position of the elevator in a specific interval like by default 30 times per second, the script can run much faster of course but should be enough and if I log all values to the arma report file they are all there, BUT the stupid arma engine just displays only every 100th or so, which means the elevator jumps with big steps if the server is running slow or whatever the problem is. I don't know yet if I can fix that, the elevator works most times, but due to the major lag you can fall off and die possibly.. maybe some of you have an idea to do smooth animations with scripts, maybe there is no solution but we will see :)

 

I think I will release the source code tomorrow, so you can see it yourself if you have a test server, I'm going to update my video as well.

Share this post


Link to post
Share on other sites

Ok I think I found the "error" why my animation was so choppy.. NEVER try to move base building parts handled by Epoch or the server, I don't know where the problem is since the position changes are not reflected in the database or anything but when I just spawn a new metal floor it works, but using one that is already in the game it is choppy as hell! why? :D

Anyway then I just spawn a new one to be moved around, I had to spawn something there anyway since you have to call the elevator back to its origin, but when there is nothing you can't call it! lol

 

Will release it later totay or tomorrow then. :)

Share this post


Link to post
Share on other sites

Works a treat =)

You are fast :D

 

I am looking into other methods of animating the elevator platform, this works good on your local PC, but might look choppy for ther players..

it should still work if there are more players and vehicles on the platform, just looks weird :/

Share this post


Link to post
Share on other sites

Yeah as I've said the ArmA engine can't handle script animation that well, it only works smooth on the client who created the elevator (so if it is local to the client because the heavy desync ArmA has all the time).. :/

You notice it already when you a driving around with a car and you are NOT the driver (vehicles are always local to the driver as of the arma wiki, which makes sense).

 

Anyway I was playing around with the camCreate command, but I can't spawn metal floors with that, but it says you can spawn vehicles in with that command,.. that would be a solution but not easy to implement.

Problem with vehicles (or moving metal floors it is the same) is, the position gets synced to all clients, so every player on the server no matter where you are will receive it.. with the camCreate command it stays local only on your client so it could be send to only players in a specified range of the elevator and it would be a smooth animation..

 

Well the wiki for camCreate (http://community.bistudio.com/wiki/camCreate) says "type: String - either "camera", "seagull" or any other class name of OFP vehicles.", maybe it is really only for  OFP vehicles and not ArmA or DayZ vehicles but that makes no sense to me.. :D to bad there are these restriction with ArmA scriping.

Share this post


Link to post
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


  • Similar Content

    • By nova
      Hello. I was wondering if there was a way for when players take down their own wall or door for the item to go back into their inventory instead of it being deleted. 
    • By totis
      Hi
      This is a restriction to vehicle seat according to humanity.
      It may be handy to PVE servers out there.
      Special thanks to Juandayz with his fantastic skills and salival. Both sometimes working unseen for the benefit of this community.
      Step 1.
      Make a new file, Name it veh_hum.sqf with the below contents and put into dayz_epoch/addons folder. If you dont have addons just create one.
      In this example we have a hero superhero and agenthero traders with 20k/40k/60k humanity respectively. Adjust according to your needs.
       
      private ["_vehicle","_inVehicle","_driver","_humanity","_txt"]; while {true} do { _vehicle = vehicle player; _inVehicle = (_vehicle != player); if (_inVehicle) then { _driver = driver (vehicle player); if (({(isPlayer _driver) && (alive _driver)} count (crew _vehicle) > 0)) then { _humanity = _driver getVariable["humanity",0]; if (typeOf _vehicle in DZE_heroHumanity && _humanity <= 20000 || (typeOf _vehicle in DZE_superHeroHumanity && _humanity <= 40000) || (typeOf _vehicle in DZE_agentHumanity && _humanity <= 60000)) then { player action ["getOut", (vehicle player)]; titleText ["","WHITE IN"]; _txt = "<img image='addons\vehicon.paa' /><br/><t size='0.7' color='#ea2828' align='center'>prohibited vehicle</t>"; [_txt, [safezoneX, safezoneW], [0.20 * safezoneH + safezoneY, 0.3 * safezoneH], 2, 0.5] spawn BIS_fnc_dynamicText; }; }; }; sleep 3; };  Step 2: Download this file http://www.mediafire.com/file/bdpt5d96o5cttk3/vehicon.rar
      Unzip and put paa file into addons folder.
      Step 3: Edit your custom variables file    dayz_code/init/variables.sqf
      Put the vehicles you want to restrict below call dayz_resetselfactions; ike this:
      // Custom below s_givemoney_dialog = -1; s_bank_dialog = -1; s_player_checkWallet = -1; s_bank_dialog1 = -1; s_bank_dialog2 = -1; s_player_copyToKey = -1; s_player_claimVehicle = -1; s_collect_heli = -1; }; call dayz_resetSelfActions; DZE_heroHumanity = ["Mi17_rockets_RU","Mi24_D","UH1Y_DZE"]; DZE_superHeroHumanity = ["Mi24_V","Mi24_P","Ka52"]; DZE_agentHumanity = ["AV8B2","AV8B","A10","F35B"]; DZE_safeVehicle = DZE_heroHumanity + DZE_superHeroHumanity + DZE_agentHumanity +["ParachuteWest","ParachuteC"]; Step 4: Edit your init file to exec the script. Above the   (false,12)execVm.... like below
          [] execVM "addons\veh_hum.sqf";
          //[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
      Thats it. Enjoy!
        Hide contents
    • By Zoranth
      Based on Hacked Vehicles release by @Bricktop and Additional code by @Hooty from here:
      This is my first release
      This mod and code is not all my original work. 
      Credits to: 
      @Bricktop for the "Hacked Vehicles" https://epochmod.com/forum/topic/43750-hacked-vehicles-1061/
      @Hooty for his input in Bricktop's release on how to install it differently and to add support for Virtual Garage.
      What I did is took their information and made it modular and easier to install / customize. This way, you just need to #include which weapon systems you want to add into each vehicle that you want to modify.
      >> DOWNLOAD HERE <<  CURRENTLY ON HOLD DUE TO UNFORESEEN ERROR
      Install Directions:
      1.    Copy the Vehicle_Weapons directory into the root of your dayz_server directory
      2.    Next paste
      #include "\z\addons\dayz_server\Vehicle_Weapons\Add_Vehicle_Weapons.sqf";    in dayz_server\system\sever_monitor.sqf under
      3.    Then paste
      #include "\z\addons\dayz_server\Vehicle_Weapons\Add_Vehicle_Weapons.sqf";  in dayz_server\compile\server_publishVehicle2.sqf under
      4.    Then paste
      #include "\z\addons\dayz_server\Vehicle_Weapons\Add_Vehicle_Weapons.sqf";   in dayz_server\compile\spawn_vehicles.sqf under
      Installation with Virtual Garage:
      If you have @salival's Virtual Garage installed then add :
      #include "\z\addons\dayz_server\Vehicle_Weapons\Add_Vehicle_Weapons.sqf";   to dayz_server\compile\garage\server_spawnVehicles.sqf under
      How To Customize:
      If you would like to create your very own weapons pack for a vehicle, use the following instructions:
      1. Make a copy of "\z\addons\dayz_server\Vehicle_Weapons\vehicles\Generic_Add_Weapon.sqf" rename it like "<vehicle_classname>_Add_Weapons.sqf". Replace the <vehicle_classname> with the actual classname of the vehicle you want to add weapons to.
      2. Comment out or Delete the Weapon_Systems that you do not want to use on your new vehicle.
      3. Make a new #include "\z\addons\dayz_server\Vehicle_Weapons\vehicles\<Class_Name>_Add_Weapons.sqf"; line with your new vehicle file and add it to "\z\addons\dayz_server\Vehicle_Weapons\Add_Vehicle_Weapons.sqf";
      4. In the new vehicle file you just made.  Rearrange the Weapon_Systems in an order that makes sense to you. For example, list all guns, then all missiles so they are grouped together in your scroll menu for easier selection.
      Adding / Restricting an Ammo Type
      For Weapon_Systems that have multiple ammo types, You can go into that specific file and comment out an ammo type or make an extra file with just the ammo you want if you want to restrict it from your server. Example:
      In the file: "\z\addons\dayz_server\Vehicle_Weapons\Vehicles\Weapon_Systems\D81_125mm_Cannon.sqf". You could comment out an Ammo Type as shown Below.
      If you do this, you will want to save that as a new file such as : "D81_125mm_Cannon_SABOT_ONLY.sqf.
      List of Vehicle Weapons and Ammo:
      WARNING: Not all Weapon Systems work with all vehicles. For example, You obviously do not want to put a "GBU12_Bomb_Launcher" on an "ArmoredSUV_PMC", or "MLRS Rocket System" on the "ArmoredSUV_PMC".
      These weapons spawn on the vehicle when purchased and remain after restart.  This does not work with admin spawned vehicles nor does it work (for now) with the Deploy Anything Mod.  I do not have Virtual Garage installed on my test server,so I am unable to test that but it should work.
      Have Fun
    • By leegreaves
      Im putting up my script for a makeover of the NEAF. I did release this before back with 1.0.5.1. Since 1.0.6.1 has come out I decided to retest to see if it would still be fine , which it is. So im reposting it for anyone who might want to make use of it.
      Just put the following in a new file called NEAF.sqf (or whatever you want to call it and create a new folder called "buildings" (if you dont already have a folder called that) in the root directory of your server pbo.
      In your server_functions.sqf file in your init folder add the following to the bottom:
      call compile preProcessFileLineNumbers "\z\addons\dayz_server\buildings\NEAF.sqf";
      I do ask that the credits ARE left in this file and that no other person claims credit for this version of a better North East Airfield.
      NEAF.sqf:
       
      Link to original post which includes images of NEAF:
       
  • Advertisement
  • Donation Box

    Please donate to support the community.
    We appreciate all donations!
  • Advertisement
  • Supporters
  • Latest Donations

  • Advertisement
  • Discord

×