Jump to content
Bombardyn

[SOLVED] Warlords mission SAVE/LOAD

Recommended Posts

I recently made my own Warlords scenario in Eden editor and everything worked fine, until I ran on a serious problem. After playing the scenario on a server I made and making some progress on the map, I saved the game and quit. The next day I loaded the saved game, still on the server I made, and then a problem occurred. I couldn't open the Warlords buying menu and the voting system stopped working. It seems like after I load the saved game, the Warlords Init just stops working.
How to make something similair to this?


I have downloaded this scenario and the saving and loading does acually work.
When I searched through this scenarios files, I couldn't figure out how to replicate it. I don't need the air support and all the other stuff, only the save and load option.
Here is the steam page of this map and a tutorial how to put downloaded maps into the editor:
https://steamcommunity.com/sharedfiles/filedetails/?id=1853095211
https://steamcommunity.com/workshop/filedetails/?id=1921503374

Share this post


Link to post
Share on other sites
5 minutes ago, Kanas Kanas said:

I'm going to do a vanilla mission at a steam workshop. You can then copy.

Ok thanks, let me know when youre done

 

Share this post


Link to post
Share on other sites

Yes it is working properly.
I have subscribed it on steam and put it into my editor scenarios with help of this video:

Then I coppied the "Addons" folder to my scenario and "commonInitScript", "init", "initPlayerLocal" and "cfgMissionParams" files.
After that I had adjusted the Warlords init settings in "cfgMissionParams" file and had put this code from the "description file" of your scenario:

//#include "\A3\Missions_F_Warlords\defaultDescription.inc"    //Edit


#include "cfgMissionParams.hpp"    //Edit

 

on top of my "description.ext".

When it was done i tested the scenario and the saving works properly. There is only one minor isue I detected. After saving and disconnecting and later loading and joining, the speaker says her announcement multiple times, for example she is saying "voting for the next sector" three times. It is a little annoying, but not a big deal after all.

I want to thank you Kanas for your help, I appreciate it.

Share this post


Link to post
Share on other sites
26 minutes ago, Kanas Kanas said:


openMap [FALSE, FALSE];


// --- handle map icons hover actions

addMissionEventHandler ["GroupIconOverEnter", {
    _grp = _this # 1;
    _sector = _grp getVariable "BIS_WL_sector";
    if (!isNil {_sector getVariable "Name"} || isPlayer _sector) then {
        [_sector, "hover"] call BIS_fnc_WLSectorIconUpdate;
    };
}];

addMissionEventHandler ["GroupIconOverLeave", {
    BIS_WL_hoverPlayed = FALSE;
    BIS_WL_hoverAnimated = FALSE;
    _grp = _this # 1;
    _sector = _grp getVariable "BIS_WL_sector";
    if (!isNil {_sector getVariable "Name"} || isPlayer _sector) then {
        [_sector, "default"] call BIS_fnc_WLSectorIconUpdate;
    };
}];

"BIS_WL_newlySelectedSector" addPublicVariableEventHandler {
    _sector = _this # 1;
    if !(_sector getVariable "BIS_WL_handleClientRunning") then {
        _sector call BIS_fnc_WLsectorHandle;
        if (BIS_WL_scanEnabled == 1) then {[_sector, side group player] call BIS_fnc_WLsectorScanHandle};
    };
};

{
    _x addAction [localize "STR_A3_WL_action_dismiss_teammate", {_unit = (_this select 0); if (vehicle _unit == _unit) then {deleteVehicle _unit} else {(vehicle _unit) deleteVehicleCrew _unit}}, [], -20, FALSE, TRUE, "", "_this == leader _target || _this == _target", -1, FALSE];
    _x addEventHandler ["Fired", BIS_WL_mineRestrictionCode];
} forEach ((units group player) - [player]);

{
    _x addAction [localize "STR_A3_WL_menu_remove_item", {{_x setPos position _x} forEach crew (_this select 0); deleteVehicle (_this select 0)}, [], -20, FALSE, TRUE, "", "vehicle _this != _target && _target in ((group _this) getVariable ['BIS_WL_groupVehs', []])", -1, FALSE];
} forEach (((group player) getVariable ["BIS_WL_groupVehs", []]) select {alive _x && !isNull _x});


sleep 0.01;


while {count waypoints group player > 1} do {deleteWaypoint (waypoints group player # 1);};

if (isNil {player getVariable "BIS_WL_selectedSector"}) then {
    player setVariable ["BIS_WL_selectedSector", objNull, TRUE];
};

player setVariable ["BIS_WL_sectorSide", side group player];

player enableSimulationGlobal FALSE;
player hideObjectGlobal TRUE;
startLoadingScreen [""];

_null = [] spawn {
    scriptName "WLClientInit (loading)";
    if (isMultiplayer) then {
        _i = 0;
        while {_i < 1} do {
            if (_i < 0.5) then {
                startLoadingScreen [""];
            };
            progressLoadingScreen _i;
            _i = _i + 0.075;
            sleep 0.1;
        };
    };
    player enableSimulationGlobal TRUE;
    player hideObjectGlobal FALSE;
    endLoadingScreen;
    titleCut ["", "BLACK IN", 1];
    1 fadeSound 1; 1 fadeRadio 1; 1 fadeSpeech 1;
    sleep 1;
    "Initialized" call BIS_fnc_WLSoundMsg;
    [toUpper localize "STR_A3_WL_popup_init"] spawn BIS_fnc_WLSmoothText;
    //BIS_WL_selectionFSM = player call BIS_fnc_WLsectorSelectionHandle;
    sleep 3;
};


_null = [] spawn {
    scriptName "WLClientInit (group icons)";
    while {TRUE} do {
        setGroupIconsVisible [TRUE,FALSE];
        setGroupIconsSelectable TRUE;
        sleep 5;
    };
};

openMap [true, true];

Player addEventHandler ["Fired", BIS_WL_mineRestrictionCode];

_null = [] spawn BIS_fnc_WLReputation;
_null = [] spawn BIS_fnc_WLOSD;
_null = [] spawn BIS_fnc_WLFundsInfo;
_null = "init" spawn BIS_fnc_WLPurchaseMenu;
_null = [] spawn BIS_fnc_WLPlayersTracking;
_null = [] spawn {
    scriptName "WLClientInit (cursor swap)";
    disableSerialization;
    while {TRUE} do {
        waitUntil {BIS_WL_currentSelection != ""};
        _ctrl = (findDisplay 12) displayCtrl 51;
        _ctrl ctrlMapCursor ["Track", "HC_move"];
        waitUntil {BIS_WL_currentSelection == "" && visibleMap};
        _ctrl ctrlMapCursor ["Track", "Track"];
    };
};

if (BIS_WL_playersAlpha > 0) then {
    _null = [] spawn {
        scriptName "WLClientInit (iconDrawArray update)";
        while {TRUE} do {
            _tempArray = +BIS_WL_allWarlords select {side group _x == side group player};
            BIS_WL_iconDrawArrayMap = _tempArray;
            BIS_WL_iconDrawArray = _tempArray select {_x != player && isPlayer _x && _x distance2D player < 75};
            sleep 2;
        };
    };
};

[] spawn {
    while {TRUE} do {
        _autonomous = player getVariable ["BIS_WL_autonomousPool", []];
        _autonomousAlive = _autonomous select {alive _x};
        player setVariable ["BIS_WL_autonomousPool", _autonomousAlive];
        sleep 1;
    };
};

[] spawn {
    waitUntil {!isNull findDisplay 46};
    sleep 2;
    (findDisplay 46) displayAddEventHandler ["KeyDown", {
        _key = _this # 1;
        if (_key in actionKeys "Gear" && !(missionNamespace getVariable ["BIS_gearKeyPressed", FALSE]) && !(player getVariable ["BIS_WL_toSwitchSides", FALSE]) && (player getVariable ["BIS_WL_friendlyFirePunishmentEnd", 0]) == 0) then {
            if !(isNull (uiNamespace getVariable ["BIS_WL_purchaseMenuDisplay", displayNull])) then {
                "close" call BIS_fnc_WLPurchaseMenu;
            } else {
                BIS_gearKeyPressed = TRUE;
                [] spawn {
                    _t = time + 0.5;
                    waitUntil {!BIS_gearKeyPressed || time >= _t};
                    if (time < _t) then {
                        if (isNull findDisplay 602) then {
                            if (vehicle player == player) then {
                                if (cursorTarget distance player <= 5 && !(cursorTarget isKindOf "House") && (!alive cursorTarget || !(cursorTarget isKindOf "Man"))) then {
                                    player action ["Gear", cursorTarget];
                                } else {
                                    player action ["Gear", objNull];
                                };
                            } else {
                                vehicle player action ["Gear", vehicle player];
                            };
                        } else {
                            closeDialog 602;
                        };
                    } else {
                        if (BIS_gearKeyPressed) then {
                            if (BIS_WL_currentSelection in ["", "voted"]) then {
                                "open" spawn BIS_fnc_WLPurchaseMenu;
                            } else {
                                playSound "AddItemFailed";
                                _action = switch (BIS_WL_currentSelection) do {
                                    case "voting": {localize "STR_A3_WL_popup_voting"};
                                    case "fastTravel": {localize "STR_A3_WL_action_destination_select"};
                                    case "drop": {localize "STR_A3_WL_action_dropzone"};
                                    case "scan": {localize "STR_A3_WL_action_scan_select"};
                                };
                                [toUpper format [(localize "STR_A3_WL_another_action") + " (%1).", _action]] spawn BIS_fnc_WLSmoothText;
                            };
                        };
                    };
                };
            };
            TRUE
        };
    }];
    (findDisplay 46) displayAddEventHandler ["KeyUp", {
        _key = _this # 1;
        if (_key in actionKeys "Gear") then {
            BIS_gearKeyPressed = FALSE;
        };
    }];
};

[] spawn {
    _enemySide = if (side group player == WEST) then {EAST} else {WEST};
    _enemyTargetOld = objNull;
    _enemyVotingResetVarID = format ["BIS_WL_sectorVotingReset_%1", _enemySide];
    while {TRUE} do {
        _enemyTarget = missionNamespace getVariable [format ["BIS_WL_currentSector_%1", _enemySide], objNull];
        if (_enemyTarget != _enemyTargetOld && !isNull _enemyTarget) then {_enemyTargetOld = _enemyTarget};
        if (missionNamespace getVariable [_enemyVotingResetVarID, FALSE]) then {
            if !(isServer) then {
                missionNamespace setVariable [_enemyVotingResetVarID, FALSE];
            };
            if (!isNull _enemyTargetOld && (_enemyTargetOld == (missionNamespace getVariable [format ["BIS_WL_currentSector_%1", side group player], objNull]) || (_enemyTargetOld getVariable "BIS_WL_sectorSide") == side group player)) then {
                [toUpper format [localize "STR_A3_WL_popup_voting_reset_user", _enemySide call BIS_fnc_WLSideToFaction]] spawn BIS_fnc_WLSmoothText;
            };
        };
        sleep 1;
    };
};

addMissionEventHandler ["Draw3D", {
    if (BIS_WL_markersAlpha > 0) then {
        _curSector = if (side group player == WEST) then {BIS_WL_currentSector_WEST} else {BIS_WL_currentSector_EAST};
        if !(isNull _curSector) then {
            _color = BIS_WL_sectorColors # (BIS_WL_sidesPool find (_curSector getVariable "BIS_WL_sectorSide"));
            _dist = player distance _curSector;
            _units = "m";
            _dist = round _dist;
            if (_dist > 1000) then {_dist = _dist / 100; _dist = round _dist; _dist = _dist / 10; _units = "km"};
            drawIcon3D [
                if !(_curSector in [BIS_WL_base_WEST, BIS_WL_base_EAST]) then {BIS_WL_sectorIcon} else {BIS_WL_baseIcon},
                [_color # 0, _color # 1, _color # 2, BIS_WL_markersAlpha],
                [(position _curSector) # 0, (position _curSector) # 1, 3],
                1,
                1,
                0,
                "",
                0,
                0,
                "PuristaSemibold",
                "center",
                TRUE
            ];
            drawIcon3D [
                "",
                [1, 1, 1, BIS_WL_markersAlpha],
                [(position _curSector) # 0, (position _curSector) # 1, 3],
                0,
                0.5,
                0,
                format ["%1%2 %3", _dist, if (_dist % 1 == 0 && _units == "km") then {".0"} else {""}, if (_units == "m") then {BIS_WL_localized_m} else {BIS_WL_localized_km}],
                2,
                0.0325,
                "PuristaSemibold"
            ];
        };
    };
    if (BIS_WL_playersAlpha > 0) then {
        {
            drawIcon3D [
                "A3\ui_f\data\igui\cfg\islandmap\iconplayer_ca.paa",
                [1, 1, 1, BIS_WL_playersAlpha],
                if (vehicle _x == _x) then {
                    (_x modelToWorldVisual (_x selectionPosition "head")) vectorAdd [0,0,0.75];
                } else {
                    getPosATLVisual _x
                },
                0,
                0,
                0,
                name _x,
                2,
                0.0325,
                "PuristaSemibold",
                "center",
                FALSE
            ];
        } forEach (BIS_WL_iconDrawArray);
    };
    {
        drawIcon3D [
            "\A3\ui_f\data\map\groupicons\selector_selectable_ca.paa",
            [1, 1, 1, 0.5],
            (getPosATLVisual _x) vectorAdd [0,0,1],
            1,
            1,
            0,
            _x getVariable ["BIS_WL_iconText", ""],
            2,
            0.0325,
            "PuristaSemibold",
            "center",
            FALSE
        ];
    } forEach BIS_WL_recentlyPurchasedAssets;
}];


waitUntil {visibleMap};

BIS_colorDrawE = BIS_WL_sectorColors # 0; BIS_colorDrawE set [3, 0.5];
BIS_colorDrawW = BIS_WL_sectorColors # 1; BIS_colorDrawW set [3, 0.5];
BIS_colorDrawESel = [0.75, 0.75, 0.75, 1];
BIS_colorDrawWSel = [0.75, 0.75, 0.75, 1];

(findDisplay 12 displayCtrl 51) ctrlAddEventHandler ["Draw", {
    if !(isNull BIS_WL_currentSector_EAST) then {
        (_this # 0) drawIcon [
            "A3\ui_f\data\map\groupicons\selector_selectedMission_ca.paa",
            BIS_colorDrawE,
            BIS_WL_currentSector_EAST,
            60,
            60,
            if (side group player == EAST || BIS_WL_currentSector_EAST != BIS_WL_currentSector_WEST) then {0} else {45},
            "",
            if (side group player == EAST || BIS_WL_currentSector_EAST != BIS_WL_currentSector_WEST) then {2} else {1}
        ];
    };
    if !(isNull BIS_WL_currentSector_WEST) then {
        (_this # 0) drawIcon [
            "A3\ui_f\data\map\groupicons\selector_selectedMission_ca.paa",
            BIS_colorDrawW,
            BIS_WL_currentSector_WEST,
            60,
            60,
            if (side group player == WEST || BIS_WL_currentSector_EAST != BIS_WL_currentSector_WEST) then {0} else {45},
            "",
            if (side group player == WEST || BIS_WL_currentSector_EAST != BIS_WL_currentSector_WEST) then {2} else {1}
        ];
    };
    if (BIS_WL_playersAlpha > 0) then {
        {
            (_this # 0) drawIcon [
                "A3\ui_f\data\igui\cfg\islandmap\iconplayer_ca.paa",
                if (_x == player) then {[1, 0, 0, BIS_WL_playersAlpha]} else {[1, 1, 1, BIS_WL_playersAlpha]},
                getPosVisual _x,
                20,
                20,
                0,
                if (_x == player) then {""} else {format [" %1", name _x]},
                2,
                0.05,
                "EtelkaNarrowMediumPro",
                "right"
            ];
        } forEach (BIS_WL_iconDrawArrayMap);
    };
    if (cheatsEnabled) then {
        if (cheat5) then {
            {
                _leader = _x;
                {
                    (_this # 0) drawLine [
                        position _x,
                        position _leader,
                        [0,1,0,1]
                    ];
                    if !(isNull assignedVehicle _x) then {
                        (_this # 0) drawLine [
                            position _x,
                            position assignedVehicle _x,
                            [0,0,1,1]
                        ];
                    };
                    (_this # 0) drawLine [
                        position _x,
                        (expectedDestination _x) # 0,
                        [1,0,0,1]
                    ];
                } forEach units group _leader;
            } forEach (BIS_WL_allWarlords select {!isPlayer _x});
                
            {
                (_this # 0) drawIcon [
                    "A3\ui_f\data\map\markers\military\dot_CA.paa",
                    [1, 1, 0, 0.5],
                    getPosVisual _x,
                    20,
                    20,
                    0,
                    typeOf _x,
                    2,
                    0.05,
                    "RobotoCondensed",
                    "right"
                ];
            } forEach allDeadMen;
        };
    };
}];


_sector = (entities "ModuleWLSector_F") # 0;
_side = _Sector getVariable "BIS_WL_sectorSide";

[_sector, _side] call BIS_fnc_WLsectorUpdate;

0 setFog 0;

openMap [FALSE, FALSE];

 

Share this post


Link to post
Share on other sites
17 hours ago, Kanas Kanas said:

  

Ok thanks

 

Share this post


Link to post
Share on other sites
On 7/26/2021 at 11:42 PM, Kanas Kanas said:

 

Am i supposed to replace the old script from LoadGame.sqf with the new one?

Because when i did the script stopped working.

Share this post


Link to post
Share on other sites

Nevermind,  i coppied the new LoadGame.sqf and it works again.

I detectend another problem but i'm not sure if it's an error in youre saving script or in arma 3  itself.

When you play for example opfor, than save and quit, and after loading and reconnecting you choose to play Blufor, a problem occurs.

If you enter any zone while playing the blufor unit in these circumstances, the game tell you to leave the zone and if you don't, you die.

Is it possible to fix that?


 

Share this post


Link to post
Share on other sites

I'm sorry, this can't be fixed. You must play the same unit as before saving. Function is enabled in description.EXT (joinUnassigned = 0); , so that when entering the hall, the last unit is automatically selected. 

Share this post


Link to post
Share on other sites
On 7/29/2021 at 10:52 PM, Kanas Kanas said:

I'm sorry, this can't be fixed. You must play the same unit as before saving. Function is enabled in description.EXT (joinUnassigned = 0); , so that when entering the hall, the last unit is automatically selected. 

Ok i understand

 

Share this post


Link to post
Share on other sites

So was this ever solved without having to copy that code into where ever and getting PBO extraction programs to use on that no longer functioning Workshop mission link?
After making a simple Warlords module single player mission in the Editor, whenever I load a saved game, the Warlords module game mode no longer works (Warlords menu doesn't open, CP count no longer displayed...). However, this only happens in save games loaded AFTER Save&Exit. Otherwise, loading works fine, you can play the session with loading as long as you never quit. Is there a fix for this or mod module to add to the mission in the editor to make it work?

Share this post


Link to post
Share on other sites

So is the code that kanas posted the "loadgame.sqf" ? 
all the links are dead so i cant get to anything, 
I would just be curious if it was solved with a script that ran when a player joins or something. I would be more than comfortable, not switching sides as well as playing as the same entity. 
If it is that easy I can unpack my pbo throw an sqf in and add an execution script.
If anyone is out there that has these files to use or knows where they now reside I would appreciate it. 

 

Share this post


Link to post
Share on other sites

https://steamcommunity.com/sharedfiles/filedetails/?id=2899185153&searchtext=Warlords+Save+%26+Load

  • Thanks 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×