Jump to content
  • 0

WAI: Spawn each mission only once per restart?


Caveman

Question

I'm using all static WAI 0.173 missions. 

 

-Each one spawns in the same spot every time. Which is what i want.

-I put plotpoles down in the map editor and sunk them in the ground so people cannot build at these mission spots.

 

The only problem I'm having sometimes the missions spawn on top of each other (because they are not set to find a random spot.) I thought maybe if i made more missions and had a big ass list of them in the the missionCfg.sqf it would be less of a chance they would not spawn on top of each other...sort of works, but there's that rare time it does spawn on top.

 

Does anyone know of a way I can get each mission to only spawn in once per restart?

 

Would this work? (taken from bank robbery)

and if so, where would I put this code. (It's probably not going to work, is it?  :P )

 
// Checks if script is active, thanks Halvhjearne <3
if(isNil "script_in_progress")then{
        script_in_progress = false;
};


if(script_in_progress)exitwith{
        systemChat "This script is only useable once (untill restart)!";
};
script_in_progress = true;
// End Checks if Script is active

 

 

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

this needs to be changed in the missions.sqf:

 

while {count wai_missions > 0} do {                                                     //this line

    _cnt = {alive _x} count playableUnits;
    _currTime = floor(time);
    if((_currTime - _startTime >= wai_mission_timer) AND (!missionrunning)) then {_result = 1};
    
    if(missionrunning) then
    {
        _startTime = floor(time);
    };
    
    if((_result == 1) AND (_cnt >= 1) AND (markerready))  then
    {
        clean_running_mission = false;
        _mission = wai_missions call BIS_fnc_selectRandom;

        wai_missions = wai_missions - [_mission];                               // and this line
        execVM format ["\z\addons\dayz_server\WAI\missions\missions\%1.sqf",_mission];
        missionrunning = true;
        diag_log format["WAI: Starting Mission %1",_mission];
        _startTime = floor(time);
        _result = 0;
    } else {
        sleep 60;
    };    
};

Link to comment
Share on other sites

  • 0

I got this error spamming the RPT after adding this

 

5:24:48 File z\addons\dayz_server\WAI\missions\missions.sqf, line 5
15:24:48 Error in expression <currTime = floor(time);
if((_currTime - _startTime >= wai_mission_timer) AND (!>
15:24:48   Error position: <_startTime >= wai_mission_timer) AND (!>
15:24:48   Error Undefined variable in expression: _starttime
15:24:48 File z\addons\dayz_server\WAI\missions\missions.sqf, line 5
15:24:48 Error in expression <currTime = floor(time);
if((_currTime - _startTime >= wai_mission_timer) AND (!>
15:24:48   Error position: <_startTime >= wai_mission_timer) AND (!>
15:24:48   Error Undefined variable in expression: _starttime
15:24:48 File z\addons\dayz_server\WAI\missions\missions.sqf, line 5
15:24:48 Error in expression <currTime = floor(time);
if((_currTime - _startTime >= wai_mission_timer) AND (!>
15:24:48   Error position: <_startTime >= wai_mission_timer) AND (!>
15:24:48   Error Undefined variable in expression: _starttime
Link to comment
Share on other sites

  • 0

you not just simply copied that into the file did you?

the top of the script stays as it is.

 

if(!isServer) exitWith {};

diag_log "WAI: Starting AI Missions Moniter";

markerready = true;
missionrunning = false;
_startTime = floor(time);
_result = 0;

 

after that come the changes I made.

Link to comment
Share on other sites

  • 0

Hi Guys,

 

Any way to make this work with version 2.2.0? I am using the hero missions for secondary missions on my server and they are pretty much default, but I have built custom static spawned "extreme" missions that is using the bandit half of the mission system. Any way to make these custom missions spawn only once per reset?

Link to comment
Share on other sites

  • 0
OK this is what I have as of now. The modified bandit missions, which i am using for the custom missions,  will actually spawn only once per reset as intended but after the last one is cleared, no other missions, not even the hero mission set, will spawn afterward. 
 
 
 
if (_bresult == 1) then {
waitUntil {_currTime = floor(time);(_currTime - _delayTime > 10 && markerready)};
markerready = false;
b_missionsrunning = b_missionsrunning + 1;
_b_startTime = floor(time);
_delayTime = floor(time);
_b_missionTime = nil;
_bresult = 0;
wai_mission_markers set [(count wai_mission_markers), ("MainBandit" + str(count wai_mission_data))];
wai_mission_data = wai_mission_data + [[0,"",[],[0,0,0]]];
 
_mission = wai_bandit_mission call BIS_fnc_selectRandom;
wai_bandit_mission = wai_bandit_mission - [_mission];      //  <------ added this line
execVM format ["\z\addons\dayz_server\WAI\missions\bandit\%1.sqf",_mission];
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...