Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vehicle and crate save/load system across mission restarts #154

Open
wants to merge 22 commits into
base: development
Choose a base branch
from

Conversation

Ridderrasmus
Copy link

System that saves and loads crates and vehicles across mission restarts.

Fully intended to be given over to you lot to change and mess around with however you want to make it work better for Mike Force. Added mission parameters for the autosave which probably also could be done better in your system somewhere.

Been in some contact with Alablm about how to do this and I will probably come back with one or two more things some time down the line to add.

Thanks for an awesome persistent mission.

The very early integration of my save/load script for vehicles and crates.

The area check function is non-operational which means everything will be saved and loaded which probably breaks a lot of decorations placed around the base and many functions are still filled with old comments and such but here it is in its early form.
Updates:
-Area check function should work now
-Crate save function added.
-Inventory set and get functions for dealing with difficult inventories of objects. Also inventories should now be able to hold weapons with various attachments and containers with items in them like bags or uniforms.

All of this is still untested. Might be stuff that breaks in this.
Did some bug hunting and fixed deep inventory save/load system data structure being set wrong. Silly oversight that held me up many days.
Accidentally left in debug stuff. Removed here.
Copy link
Contributor

@Alablm Alablm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code as is looks solid. We will need to check if crates are handled by the cleanup script right now, as I'm not sure that's the case. If they are not we will need to make sure they get cleaned up, as otherwise they'll exist forever.

user_paths_example.py Outdated Show resolved Hide resolved
@Alablm
Copy link
Contributor

Alablm commented Aug 14, 2022

Apologies for the delay in getting back to you on the @Ridderrasmus

_startLoad = _obj addAction ["Start load", {
if (isServer) then {
[] call vn_mf_fnc_full_load;
[player, _this select 2] remoteExec ["removeAction", 0, true];
Copy link
Member

@veteran29 veteran29 Aug 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is incorrect. You're globally removing action with _this select 2 ID, which can be different action on every client.

Also this will only work on local hosted as the action won't do anything on dedicated server.

mission/functions/systems/vehicle_saving/fn_area_check.sqf Outdated Show resolved Hide resolved
mission/functions/systems/vehicle_saving/fn_area_check.sqf Outdated Show resolved Hide resolved
mission/functions/systems/vehicle_saving/fn_crate_load.sqf Outdated Show resolved Hide resolved
mission/functions/systems/vehicle_saving/fn_full_load.sqf Outdated Show resolved Hide resolved

_savedData = [[], []];
// To be extra sure we don't load before ID's have been assigned
waitUntil { (((vehicles select {typeOf _x == "vn_b_air_oh6a_01"}) select 0) getVariable ["vehAssetId", ""]) != ""};
Copy link
Member

@veteran29 veteran29 Aug 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems pretty fragile if there's no vehicle of this type it will break. Instead, it should wait for ID system to be initialized, however it works in MF.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it was meant to be temporary but never figured out how to check for the system to finish initializing. Know where I should look to find that?

mission/functions/systems/vehicle_saving/fn_full_save.sqf Outdated Show resolved Hide resolved
mission/functions/systems/vehicle_saving/fn_full_save.sqf Outdated Show resolved Hide resolved
Comment on lines 36 to 37
_veh setPos (_loc select 0);
_veh setDir (_loc select 1);
Copy link
Member

@veteran29 veteran29 Aug 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setPos format is not compatible getPos and will cause issues if vehicle is over and object. setDir should also be avoided as it resets up vector.

Use position world and vectorDirAndUp.

Ridderrasmus and others added 16 commits August 15, 2022 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants