Vehicle Saving

Vehicle Saving

« posted: Aug 20, 2014, 01:38 PM »
As vehicle saving is supported in "vanilla" (1.0) no no one is recommended using this ugly hack anymore /Cael817

As there are questions regarding how to get vehicle saving going for now and this is not implemented in the "Vanilla" mission yet, as of writing this, it seems that things are not that easy to get going. And it seems that most of these discussions and questions is mostly my fault. This is probably going to be a wall of text but take your time and read it. Please don't discuss to much here and keep it to questions regarding this particular issue.

Here is a link for my latest version of my edit of the A3W mission(with vehiclesaving and locking enabled).

https://drive.google.com/file/d/0B-aKlU_hWxp2RkctdWsxbENHRk0/edit?usp=sharing

and i placed every file that concerns vehicle saving in a folder structure that you should recognize and commented out everything regarding locking (i hope).

The two files that do the saving and loading are, vSave.sqf and vLoad.sqf and i added a line in functions.sqf
You can find these files in persistence\world\

The vehicle saving saves every vehicle that got the variable "ownerUID" set to it and i set this in buyVehicles.sqf
which you can find in client\systems\vehicleStore\
I also add and extra variable "ownerN" so i easily can see in the vehicle save file who bought the vehicle as i otherwise hade to compare to the player saves which i felt was a PITA. Unfortunately, if you have
Code: [Select]
A3W_staticWeaponSaving = 0;        // Save locked static weapons and their magazines between server restarts (0 = no, 1 = yes) set to "1" static weapons will save twice as i set "ownerUID" to everything you buy in the vehicle store, so if you dont want blown up duplicates of thes i recommend you set this to "0" as per the example. You can find this in the A3Wasteland_settings\main_config.sqf. The A3Wasteland_settings folder should reside in your server root folder where you normally can find your arma3server.exe.

then in the server init.sqf i add
Code: [Select]
execVM "persistence\world\vLoad.sqf";toghteher with
Code: [Select]
// Have we got server persistence enabled?
if (_serverSavingOn) then
{
execVM "persistence\world\oLoad.sqf";
execVM "persistence\world\vLoad.sqf"; // <------------- add this for vehicle saving
};
You can find this file in server\

Keep in mind that the vSave.sqf and vLoad.sqf are to begin with a ugly hack i did on the base saving scripts oSave.sqf and oLoad.sqf so you may need to have at least base saving and probably box saving and maybe even player saving enabled for this to work. player, base and box saving on/off if found in the main_config.sqf i told about before.
Code: [Select]
A3W_playerSaving = 1;              // Save player data like position, health, inventory, etc. (0 = no, 1 = yes)
A3W_baseSaving = 1;                // Save locked base parts between server restarts (0 = no, 1 = yes)
A3W_boxSaving = 1;

Big thanks to CreamPie here on the forum for expanding on the saving to, allowing for vehicle colors and textures to be saved.

Now if everything works you should get an extra file in your DB folder toghether with you playersaves and base(objects) saves that is in may case "A3W_Vehicles.ini" the A3W prefix is form the settings in the main_config.sqf yet again. Vehicle deletes after reaches age set in the main_config.sqf at the upcoming restart.

Also after a restart the vehicles load in at full health, fuel and ammo. Not that i want it that way, i just mucked with other things while i wait for the masters to release the good stuff =).

From here there is only extra information and good to know. So you can stop reading =).

A vehicle save should look something like this
Code: [Select]
[Info]
ObjCount="30"
[Veh1]
Class="O_Heli_Light_02_unarmed_F"
Position="[29039.2,655.941,189.686]"
Direction="[[0.995681,0.0762592,0.0529576],[-0.0528045,-0.00402407,0.998597]]"
HoursAlive="13.233"
Damage="0.00402807"
AllowDamage="1"
Variables="[["ownerUID","76561198039532076"],["ownerN","Cael817"]]"
Texture=""
Weapons="[]"
Magazines="[]"
Items="[]"
Backpacks="[]"

Now you cannot easily delete one vehicle out of this file as there is a total count
Code: [Select]
ObjCount="30"and a number set to every saved vehicle
Code: [Select]
[Veh1].
so if you have to delete one vehicle from here you have to go thru all the vehicle number and set the to order, bad explanation but i think you get it.

Also something to now is that i try to add 3 decimeters to the save height of the vehicle so when it loads it loads a bit up from the ground, that is done in the vSave.sqf with this bit.
Code: [Select]
_pos = getPosATL _obj;
_value = (_pos select 2) + 0.3;
_pos set [2, _value];
_dir = [vectorDir _obj, vectorUp _obj];

You may have to tweak this but i don't think its necessary for now.

Another thing to keep in mind is that the vehicles load in at the saved terrain level and i think they point at 0 degrees
then they turn around to their saved direction so if you park the close to anything else they will probably turn in to the other object and explode. cliffs and rocks can also be a problem as there is some issues with PosATL and PosASL so i dont recommend parking on or around those either. maybe if they are very flat as its seems that its the angle that are the problem.

You can park inside larger buildings but stay clear from the walls, think as if you should be able to turn the vehicle around its own center and it you add a lot of height in the previously mentioned part you could have problems with the roof. Im thinking that you may be able to set the vehicle to non colliding, turn it, make it collidable and then drop it to ground might work but i haven't had time to look at something like that.

Re: Vehicle Saving

« Reply #1 posted: Aug 20, 2014, 03:13 PM »
good job there mate.

but I am stupid as a lightpole....

- the folder Vehicle_Saving belongs into the mission.pbo?

- the file server\ I cant find anywhere .... or is this the init.sqf within the folder "A3Wasteland_settings"? or the init.sqf within my mission.pbo?

sorry about that

Re: Vehicle Saving

« Reply #2 posted: Aug 20, 2014, 07:03 PM »
Np, =) sorry for the confusion here, vehicle saving is just my name for the folder that i put the necessary files in.

If you unpack the .pbo or download the mission from github and open it you will find the following folders in it.


*addons\
*client\
*persistence\
*server\
*territory\

and a bunch of files
and if you open the vehicles_saving folder from my zip

you will find the following folders containing files and folders

*client\
*persistence\
*server\

hopefully i made it so you just copy paste those into your mission and overwriting and adding the necessary files, look int them and compare with the mission filestructure and you will see what files are added and what files will get overwritten, so if you made your own changes to any of

server\init.sqf
persistence\world\functions.sqf
client\systems\vehicleStore\buyVehicles.sqf

you should look into my files and just copy my changes into you files, its only one or two lines per file that you really need and i commented them also.

So just grab the contents of the vehicle_saving folder i just used it for zipping the files together.

An unpacked mission.pbo of A3W looks something like this if you didnt get it unpacked

https://drive.google.com/file/d/0B-aKlU_hWxp2Y3Z5TkNXMGt2b3c/edit?usp=sharing

i use PBO Manager for packing and unpacking the .pbo files, just right click the pbo and extract to.... something
  • Offline DRACO
  • Fresh Spawn
  • *
  • Posts: 19

Re: Vehicle Saving

« Reply #3 posted: Aug 21, 2014, 01:54 PM »
I'll definitely look at using this on my server. One question; is this using the Revive version or standard of Wasteland?

Re: Vehicle Saving

« Reply #4 posted: Aug 21, 2014, 08:11 PM »
in "my" edit i use revive, its missing a few of the latest changes thou, but you should be able to rip out the vehicle saving pretty easy =)

Re: Vehicle Saving

« Reply #5 posted: Aug 21, 2014, 10:00 PM »
Do you think it's possible to allow only 1 vehicle saving per player?

Re: Vehicle Saving

« Reply #6 posted: Aug 22, 2014, 02:13 PM »
I'm interested in a vehicle save limit as well. I know the second I implement this, some asshole troll is going to buy 20 go-karts and quads then leave the server. Something that will delete your oldest vehicle in A3W_Vehicles.ini once you go over your limit. Also a shorter save time limit would be cool. Something like 24 or 48 hours.

Edit:
I think if you change line 23 in vLoad.sqf to
Code: [Select]
_maxLifetime = 24; it will only save vehicles and static weapons for 1 day. I guess I'll find out after some testing. Still would be nice to have vehicle save limits for players though.

Re: Vehicle Saving

« Reply #7 posted: Aug 23, 2014, 10:41 PM »
I added and removed some stuff to suit my servers needs. If anyone wants it, here's the link and a description of what I did.

https://drive.google.com/file/d/0B7aHLzJyhpf0OFZNV1M1bFdNeU0/edit?usp=sharing

I added a edited vehicle repair script for vehicle saving.  Any vehicle (that's in the script) that you approach will have the "Save vehicle" option. I works just like when you save static weapons but takes 45 seconds.

I removed the auto save for when you buy vehicles. I made sure you can't save uav's or ugv's because vLoad.sqf doesn't load the ai after a restart.

Like Cael817 said, make sure you set "A3W_staticWeaponSaving = 0;" in the main_config.sqf.

BTW, thank you Cael817 for your work debugging and editing those scripts!

Re: Vehicle Saving

« Reply #8 posted: Aug 23, 2014, 11:08 PM »
Do you think it's possible to allow only 1 vehicle saving per player?

Blackcircle, i haven't looked into that as i believe the "Vanilla" vehicle saving will be much better that this temporary thing, sorry.

Re: Vehicle Saving

« Reply #9 posted: Aug 23, 2014, 11:09 PM »
I'm interested in a vehicle save limit as well. I know the second I implement this, some asshole troll is going to buy 20 go-karts and quads then leave the server. Something that will delete your oldest vehicle in A3W_Vehicles.ini once you go over your limit. Also a shorter save time limit would be cool. Something like 24 or 48 hours.

Edit:
I think if you change line 23 in vLoad.sqf to
Code: [Select]
_maxLifetime = 24; it will only save vehicles and static weapons for 1 day. I guess I'll find out after some testing. Still would be nice to have vehicle save limits for players though.

Did you have time to test this?

Re: Vehicle Saving

« Reply #10 posted: Aug 23, 2014, 11:18 PM »
No. I'm putting the new mission file in at 4pm cst. So I won't know for for 30 hours.
  • Offline DRACO
  • Fresh Spawn
  • *
  • Posts: 19

Re: Vehicle Saving

« Reply #11 posted: Aug 25, 2014, 03:17 AM »
Do you use iniDB or iniDBI?

Re: Vehicle Saving

« Reply #12 posted: Aug 25, 2014, 08:41 AM »
Do you use iniDB or iniDBI?

Use the iniDB.dll in the A3W_Saving_Pack.zip that's in the A3Wasteland/Release_Files
https://github.com/A3Wasteland/Release_Files

I think they are using @inidbi_v14 in that pack.

Re: Vehicle Saving

« Reply #13 posted: Aug 25, 2014, 08:43 AM »
I'm interested in a vehicle save limit as well. I know the second I implement this, some asshole troll is going to buy 20 go-karts and quads then leave the server. Something that will delete your oldest vehicle in A3W_Vehicles.ini once you go over your limit. Also a shorter save time limit would be cool. Something like 24 or 48 hours.

Edit:
I think if you change line 23 in vLoad.sqf to
Code: [Select]
_maxLifetime = 24; it will only save vehicles and static weapons for 1 day. I guess I'll find out after some testing. Still would be nice to have vehicle save limits for players though.

Did you have time to test this?

_maxLifetime = 24; is working. Yay!

Re: Vehicle Saving

« Reply #14 posted: Aug 26, 2014, 12:20 AM »
Where do I find the file that loads at first spawn that has admins, teamspeak, bug reporting, and all that so I can change it? Right now it has another servers info and I need to change that. Thanks