So the first thing I really wanted to get working on DayZ was the ability to tow and lift various vehicles. The starting point I used was a forum post on Open DayZ.
http://opendayz.net/threads/heli-lift-script-dayz-st.7968/
It's a great site and has been a huge help so far.
So, I went up there, grabbed the R3F Lift and Logistics script.
That would be this one.
http://www.armaholic.com/page.php?id=9285
From there I opened it up, inspected the contents and got to work. This was my first script addition, so some things here might seem to be obvious for an old hand at ARMA modding, but for me it was my first time out. Fortunately, this particular script was amazingly well documented, both in external PDFs and in the code itself. The installation guide got me 90% of the way there, but it was the last 10% that was the trick.
So, first off, to get things working to a good first degree, just follow the instructions. You need to remember to edit both the "description.ext" AND the "int.sqf". If you don't, the mod appears to half work, but the menus don't show up for unloading stuff out of the vehicles, effectively making them black holes for smaller stuff.
Slurp Slurp
Once all the files are in place and the two existing files are edited (description and int), you could go ahead and upload and the whole thing would work pretty well. I would go into the "A3F_ARTY_AND_LOG" folder and remove the "Rf3_ARTY" folder as well as disabling the entire artillery script as found in the "R3F_ARTY_disable_enable.sqf" file. This makes the act of connecting to your server faster as there is less to download as well as streamlining future packing of the Mission.pbo.
Cool, now your helis can lift stuff and cars can load stuff. Fun eh?
All that, for me, wasn't difficult enough, so I went poking through the script and found the section that deals with towing. Sounds cool to me. First step on the road to towing was to look through the "config.sqf" file. (Location is in "*YourPBO\R3F_ARTY_AND_LOG\R3F_LOG")This file is kind of a catch all in terms of the script. It is constantly looked at by other functions to determine what can and cant be interacted with. It also supplies all the values for various items when loading. In short, this controls the mods interactions. Fortunately, it is commented in both English and French, making working with it pretty easy.
So, first thing when I opened this was that all the lists were empty. That is because they reference three other lists, one for the various base Arma vehicles, one for the expansion items (the BAF one) and one for the ACE mod. All three of these files are found in the "addons_config" folder which is in the same directory as the "config.sqf" file.
So, out of those three files, we can disregard the ACE mod one ("ACE_OA_objects.sqf") because I don't use anything from ACE. That being said, if you do for some reason, the same principles used here should apply to that file. That then leaves us with the other two, the "arma2_CO_objects.sqf" file which governs the base game assets and the "BAF_objects.sqf", which governs the other objects. Now, I know that the game uses some BAF assets, but there are no BAF objects used in terms of vehicles or the like, so that also can be ignored, simplifying our task and leaving us with only the Arma CO file to edit. Hurray for simplification!
So, I opened up "arma2_CO_objects.sqf" to take a look and again, low and behold, it was commented in both French and English. Many MANY thanks again to the R3F guys. Your code rocks. So, looking through this you can see all the lists for all the different actions of vehicles, including stuff like what can lift, what can be lifted, the size values for loading, ect. ect. Well laid out and pretty readable. The fields that interested me were the first two lists, "List of class names of vehicles which can tow towable objects" and "List of class names of vehicles which can tow towable objects". By default they are pretty damn short, the towing list holding a pretty good list of all the heavy vehicles in the game and the can be towed list holding only the artillery.
Now, some notes about how this is laid out. First off, there are way WAY more vehicles than that in the game. The script only references the highest level class name of each vehicle, for example, "Kamaz_Base". Now there are tons of different types of Kamazes in the game, ranging from transport to fueling to other stuff. By including "Kamaz_Base", you cover all the types of Kamazes, all the children if you will. The second thing I noticed was the suffix "_EP1" that was found on some of the class names. More on that later, but needless to say that gave me trouble.
So I started experimenting using only one change which was adding the "UAZ_Base" to the towable class list and spawing in both a Tractor and an UAZ into a field and hopping into the game. I then walked up to them, used the scroll wheel and tried to hitch them together. It bloody well worked! The animation started, I bent down and bam, towing commenced. All seemed great till I stepped back.
Shit
The rear axle of the tractor and the front axle of the UAZ have decided to become friends. Really good friends. Such good friends that the bodies of the two vehicles have meshed. That being said, I could get in the tractor, drive both cars around and everything from a gameplay point of veiw worked great. Well, all worked great till I tried to unhitch the two. Because of the intermeshing, often upon unhitching the two vehicles would fly apart, damaging one or both. This would not stand, not one bit.
I guessed (correctly) that the script had to define the interaction and spacing between the vehicles, so my first task was to figure out where this took place. The biggest issue first was where to start. While the configuration files and installation guide were in both English and French, the actual script was not. The comments, while being prevalent, were all in French and only French.
My first task was one of translation. The mystery folders were labled "heliporteur", "objet_deplacable", "remorqueur", and "transporteur". Heliporteur was easy, that was Helicopter. Objet Deplacable was a little more tricky, but a quick google translate give the answer of movable object. The last two, remorqueur and transporteur, came out to be tug or trailer and transporter respectively. In short, sounds like remorqueur is the one.
Once inside you can find a bunch of .sqf files. Each deals with a section of the towing code, but unfortuatly they are all, again, in french. The variable names are french, the comments are french, both being the important bits to use to figure out how to get things to work. Needless to say, after a bunch more Google Translate and some experimentation, I found the right number section.
Under "remorquer_selection.sqf" you can find a section that looks like this.
------------------------------------------------------------------------------------------------------------
_objet attachTo [_remorqueur, [
0,
(boundingBox _remorqueur select 0 select 1) + (boundingBox _objet select 0 select 1) + 3,
(boundingBox _remorqueur select 0 select 2) - (boundingBox _objet select 0 select 2)
]
------------------------------------------------------------------------------------------------------------
Now, to me that looks like a 3 point coordinate system with some equations for the various variables. The first number is set to zero, the second is two values added plus an extra 3 and the last number is just two variables subtracted from each other. That being said, which number equates to the X, Y and Z I have no idea. Time to test!
My first guess was that, because the first and second numbers were either a constant or offset by an amount, that they governed the side to side and forward back positions (X and Y). The Z coordinate, being equal between each vehicle, would need no offset. So, to test, I changed the "0" to 15 and the "+3" to 15 as well, both now being extreme variables which would lead to noticeable change.
Sure enough, after uploading and testing, I had a car flying not shortly behind but in front and far to the right of my tractor. This told me several things. First off, the numbers I changed did indeed deal with the X and Y values. Second of all, it told me that 0 was a centerpoint, leading to both negative and positive numbers being allowed variables. Third off, with the centerpoint being 0, that means that the variable that is arbitrarily adjusted must be the one off centerpoint. Sounds like the +3 one to me!
So, to wrap up a long story, I eventually ended up with the value of "- 0.25" for what was "+ 3". I have a feeling that that value only takes integers but the -.25 was close enough I didn't want to muck around with it any more. Don't fix what isn't broke and the like.
To finish everything off, I just populated the vehicle lists I talked about previously with all the other vehicles I planned on using into their respective lists. I will post the full list I use at the bottom. Again, just use the "_Base" tag for most vehicles in normal Arma and "_Base_EP1" for expansion stuff. If people have questions on that I can post some resources later.
Well, that concludes this long winded explanation into how I got helicopters to lift, cars to tow and load and how I learned a bit of French in the process. Hope it was interesting and entertaining.
Also, for those who just want the steps-
TL;DR
1) Download this-
http://www.armaholic.com/page.php?id=9285
2) Install it according to the directions in the .zip.
3) Edit the "R3F_ARTY_disable_enable.sqf" file and delete the "R3F_ARTY" folder.
4) Edit the offset of the towing vehicles by going to "*YourPBO\R3F_ARTY_AND_LOG\R3F_LOG\remorqueur"
There you will edit "remorquer_selection.sqf" file and change the
------------------------------------------------------------------------------------------------------------
// Attacher à l'arrière du véhicule au ras du sol
_objet attachTo [_remorqueur, [
0,
(boundingBox _remorqueur select 0 select 1) + (boundingBox _objet select 0 select 1) + 3,
(boundingBox _remorqueur select 0 select 2) - (boundingBox _objet select 0 select 2)
]];
------------------------------------------------------------------------------------------------------------
to
------------------------------------------------------------------------------------------------------------
// Attacher à l'arrière du véhicule au ras du sol
_objet attachTo [_remorqueur, [
0,
(boundingBox _remorqueur select 0 select 1) + (boundingBox _objet select 0 select 1) - 0.25,
(boundingBox _remorqueur select 0 select 2) - (boundingBox _objet select 0 select 2)
]];
------------------------------------------------------------------------------------------------------------
Again, I think the change deals with only integers but the 0.25 value works and I don't fix what already works. Usually. Most of the time. Somewhat.
There, that should do it. If you have issues with this, read the body of the post. If you have issues with that, post in the comments and I will try to get back to you.
Have fun towing poor schmucks vehicles!
-DeNarran
DeNarran's DayZ Server
Tuesday, April 9, 2013
The Basic Idea
Ok, so welcome to the blog regarding the Grassroots Gaming DayZ Server. The hope is for me to document in one place all of the various changes, methodologies and ideas I have put into creating and modifying my DayZ Server.
The overarching ideology I have in place for this server is to make it as much like the vanilla DayZ as I can in spirit. I want to keep the tension avoid AI use and create a difficult experience. All the changes are made personally and are mostly pulled from research I have done online. I grab many different addons from other websites, which I will endeavor to document whenever talking about a specific change, credit being due where credit is due and all that.
In the end, I want this blog to document the design ideas behind the changes I have made to DayZ, document the specific changes in a way that others could follow if need be, give credit to those whose work I am using, and act as a location to gain feedback regarding both how the changes I have made effect their play and any future changes they might want.
Sound good? Cool, lets go.
DeNarran
Subscribe to:
Comments (Atom)