Jump to content
  • 0

WAI One mission at a time ?


Adamzon

Question

11 answers to this question

Recommended Posts

  • 0

Create a folder "all" under the WAI/missions directory. Copy all of the bandit, hero and special missions in the "all" directory. Edit WAI\config.sqf and add this block of code above the wai_hero_missions = {


        wai_all_missions            = [                                 // ["mission filename",% chance of picking this mission],Make sure the chances add up to 100,or it will not be accurate percentages
                                        ["hero_black_hawk_crash",5],
                                        ["hero_armed_vehicle",5],
                                        ["hero_bandit_base",5],
                                        ["hero_captured_mv22",5],
                                        ["hero_ikea_convoy",5],
                                        ["hero_destroyed_ural",5],
                                        ["hero_disabled_milchopper",5],
                                        ["hero_mayors_mansion",5],
                                        ["hero_weapon_cache",5],
                                        ["bandit_armed_vehicle",5],
                                        ["bandit_black_hawk_crash",5],
                                        ["bandit_captured_mv22",5],
                                        ["bandit_broken_down_ural",5],
                                        ["bandit_hero_base",5],
                                        ["bandit_ikea_convoy",5],
                                        ["bandit_medi_camp",5],
                                        ["bandit_presidents_mansion",5],
                                        ["bandit_sniper_extraction",5],
                                        ["bandit_weapon_cache",5],
                                        ["bunny_ranch",5]
                                    ];


 

Then replace the contents of the WAI\missions\init.sqf with this:

 

if(isServer) then {

    private["_b_missionTime","_h_missionTime","_h_startTime","_b_startTime","_a_missionTime","_a_startTime","_result","_cnt","_currTime","_mission"];

    diag_log "WAI: Initialising missions";

    dynamic_crate                     = compile preprocessFileLineNumbers "\z\addons\dayz_server\WAI\compile\dynamic_crate.sqf";
    custom_publish                  = compile preprocessFileLineNumbers "\z\addons\dayz_server\WAI\compile\custom_publish_vehicle.sqf";


    // Mission functions
    call                             compile preprocessFileLineNumbers "\z\addons\dayz_server\WAI\compile\mission_functions.sqf";
    mission_init                    = compile preprocessFileLineNumbers "\z\addons\dayz_server\WAI\compile\mission_init.sqf";
    mission_winorfail                = compile preprocessFileLineNumbers "\z\addons\dayz_server\WAI\compile\mission_winorfail.sqf";
    minefield                        = compile preprocessFileLineNumbers "\z\addons\dayz_server\WAI\compile\minefield.sqf";

    {
        wai_mission_markers set [count wai_mission_markers, _x];
    } count ["MainHero","MainBandit","Side1Hero","Side1Bandit","Side2Hero","Side2Bandit","Special"];
    trader_markers                     = [];
    trader_markers                     = call get_trader_markers;
    markerready                     = true;
    wai_mission_data                = [];
    wai_all_mission                    = [];
    wai_hero_mission                = [];
    wai_bandit_mission                = [];
    wai_special_mission                = [];
    h_missionrunning                = false;
    b_missionrunning                = false;
    s_missionrunning                = false;
    a_missionrunning                = false;
    _h_startTime                     = floor(time);
    _b_startTime                     = floor(time);
    _s_startTime                    = floor(time);
    _a_startTime                    = floor(time);
    _h_missionTime                    = nil;
    _b_missionTime                    = nil;
    _s_missionTime                    = nil;
    _a_missionTime                    = nil;
    _mission                        = "";
    _result                         = 0;

    // Set mission frequencies from config
    {
        for "_i" from 1 to (_x select 1) do {
            wai_hero_mission set [count wai_hero_mission, _x select 0];
        };
    } count wai_hero_missions;

    {
        for "_i" from 1 to (_x select 1) do {
            wai_bandit_mission set [count wai_bandit_mission, _x select 0];
        };
    } count wai_bandit_missions;



    {
        for "_i" from 1 to (_x select 1) do {
            wai_special_mission set [count wai_special_mission, _x select 0];
        };
    } count wai_special_missions;

    {
        for "_i" from 1 to (_x select 1) do {
            wai_all_mission set [count wai_all_mission, _x select 0];
        };
    } count wai_all_missions;

    // Start mission monitor
    while {true} do
    {
        _cnt         = {alive _x} count playableUnits;
        _currTime     = floor(time);

//        if (isNil "_h_missionTime") then { _h_missionTime = ((wai_mission_timer select 0) + random((wai_mission_timer select 1) - (wai_mission_timer select 0))); };
//        if (isNil "_b_missionTime") then { _b_missionTime = ((wai_mission_timer select 0) + random((wai_mission_timer select 1) - (wai_mission_timer select 0))); };
//        if (isNil "_s_missionTime") then { _s_missionTime = ((wai_mission_timer select 0) + random((wai_mission_timer select 1) - (wai_mission_timer select 0))); };
        if (isNil "_a_missionTime") then { _a_missionTime = ((wai_mission_timer select 0) + random((wai_mission_timer select 1) - (wai_mission_timer select 0))); };

//        if((_currTime - _h_startTime >= _h_missionTime) && (!h_missionrunning)) then { _result = 1; };
//        if((_currTime - _b_startTime >= _b_missionTime) && (!b_missionrunning)) then { _result = 2; };
//        if((_currTime - _s_startTime >= _s_missionTime) && (!s_missionrunning)) then { _result = 3; };
        if((_currTime - _a_startTime >= _a_missionTime) && (!s_missionrunning)) then { _result = 4; };

//        if(h_missionrunning) then { _h_startTime = floor(time); };
//        if(b_missionrunning) then { _b_startTime = floor(time); };
//        if(s_missionrunning) then { _s_startTime = floor(time); };
        if(a_missionrunning) then { _a_startTime = floor(time); };

        if((_cnt >= wai_players_online) && (markerready) && ((diag_fps) >= wai_server_fps)) then {

            if (_result == 1) then {
                h_missionrunning     = true;
                _h_startTime         = floor(time);
                _h_missionTime        = nil;
                _result             = 0;

                _mission             = wai_hero_mission call BIS_fnc_selectRandom;
                execVM format ["\z\addons\dayz_server\WAI\missions\hero\%1.sqf",_mission];
            };

            if (_result == 2) then {
                b_missionrunning     = true;
                _b_startTime         = floor(time);
                _b_missionTime        = nil;
                _result             = 0;

                _mission             = wai_bandit_mission call BIS_fnc_selectRandom;
                execVM format ["\z\addons\dayz_server\WAI\missions\bandit\%1.sqf",_mission];
            };



            if (_result == 3) then {
                s_missionrunning     = true;
                _s_startTime         = floor(time);
                _s_missionTime        = nil;
                _result             = 0;

                _mission             = wai_special_mission call BIS_fnc_selectRandom;
                execVM format ["\z\addons\dayz_server\WAI\missions\special\%1.sqf",_mission];
            };


            if (_result == 4) then {
                a_missionrunning     = true;
                _a_startTime         = floor(time);
                _a_missionTime        = nil;
                _result             = 0;

                _mission             = wai_all_mission call BIS_fnc_selectRandom;
                execVM format ["\z\addons\dayz_server\WAI\missions\all\%1.sqf",_mission];
            };

        };
        sleep 1;
    };
};

 

 

Replace the mission end statement in each of the missions you copied to the "all" directory.

 

a_missionrunning = false;

 

I believe that's all the steps I had to take to enable one mission at a time.

Link to comment
Share on other sites

  • 0

Im getting this RPT error : 

 

if((_currTime - _a_startTime >= _a_missionTime) && (!s_missionrunning)) >
 2:13:32   Error position: <_a_missionTime) && (!s_missionrunning)) >
 2:13:32   Error Undefined variable in expression: _a_missiontime
 2:13:32 File z\addons\dayz_server\WAI\init.sqf, line 96
 2:13:33 Error in expression <missionTime") then { _a_missionTime = ((wai_mission_timer select 0) + random((wa>
 2:13:33   Error position: <wai_mission_timer select 0) + random((wa>
 2:13:33   Error Undefined variable in expression: wai_mission_timer
 2:13:33 File z\addons\dayz_server\WAI\init.sqf, line 91
 2:13:33 Error in expression < };
Link to comment
Share on other sites

  • 0

in the config file are these options to tell how many missions at a time

wai_hero_limit				= 2;
wai_bandit_limit			= 2;
wai_special_limit			= 1;

in the above at one time you would have 2 hero  2 bandit and 1 special mission running possibly at a time

 

Where do I find this? In my config file dayz_server\WAI\config.sqf theres no such lines

Link to comment
Share on other sites

  • 0

Where do I find this? In my config file dayz_server\WAI\config.sqf theres no such lines

you probably have the orginal WAI, try 2.1.4 or 2.2.0 from

 

2.2.0 is in beta but i use it with no problems. Its in the last few pages in the topic. However, 2.1.4 is on main page.

 

 

Edit: This is only available in 2.2.0

Link to comment
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
  • Discord

×
×
  • Create New...