Jump to content

Mission despawn Timer, if no Player come to make it


MoDAX

Recommended Posts

hi there,

 

i am looking for an despawn timer for dzms, if no player decides to make the mission, so the mission should be despawn, with a message:

"survivors did not taken the medical supply under control in time"

 

i have seen this on other servers is it possible for dzms?

 

greetings

MoDAX

Link to comment
Share on other sites

DZMS isn't coded for mission timeouts, because my goal for DZMS is not to have the users pick and choose which missions to run. All missions instead should be unique and interesting enough to make the users want to complete them no matter what mission they are. By not having timeouts, you also don't reward players who decide to sit there and wait on a low-pop server for the best missions to pop up and only run those. Even if it takes a player an hour to snipe out a mission, then in my opinion they have earned that mission, but I don't see that happen with other players on the server. The only valid reason for I see for timeouts is if the system is flawed where the AI will run off or similar, making it impossible to complete, which is fine with DZMS as long as AI killed percent isn't set to 1.

 

So thats the reason DZMS doesn't support timeouts. :P

 

If you have any suggestions to make missions more entertaining, I would love to hear them.

Link to comment
Share on other sites

hi Vampire

 

thx for reply, i understand your thoughts behind this, my idea was the following, i want to set up 1 extreme AI Mission inside the majors for high skilled players with a warning, and if no one is online who decides to make the mission the mission should desppawn after a while.

 

so is it possible to set up a third mission setting near the majors and minors, with an extra timer

 

so it looks like this:

DZMSExtremeArray =["SM1","SM2"];
DZMSMajorArray = ["SM1","SM2","SM3","SM4","SM5","SM6"];
DZMSMinorArray = ["SM1","SM2","SM3","SM4","SM5","SM6"];

with additional timers for this new array and other setings or could this b a problem for the system?

 

 

greetings

MoDAX

Link to comment
Share on other sites

hi Vampire

 

thx for reply, i understand your thoughts behind this, my idea was the following, i want to set up 1 extreme AI Mission inside the majors for high skilled players with a warning, and if no one is online who decides to make the mission the mission should desppawn after a while.

 

so is it possible to set up a third mission setting near the majors and minors, with an extra timer

 

so it looks like this:

DZMSExtremeArray =["SM1","SM2"];
DZMSMajorArray = ["SM1","SM2","SM3","SM4","SM5","SM6"];
DZMSMinorArray = ["SM1","SM2","SM3","SM4","SM5","SM6"];

with additional timers for this new array and other setings or could this b a problem for the system?

 

 

greetings

MoDAX

Link to comment
Share on other sites

I totally respect what you are doing Vampire and I support you 100%. However you ought to consider that other admins want to play differently than you do and so you should allow them to do so without having to alter your work. I prefer DZMS over WAI performance-wise but it's not nearly as configurable and so most of my custom missions are being written for WAI. Admins want mission systems that have static gunners, timeouts, RPG's, and highly configurable options so that they can tweak and change as they wish. Your custom missions are fantastic but I also want the toolbox to do my own too. WAI gives me that and I'd love it if DZMS would too.

Link to comment
Share on other sites

Hi Vampire

 

thx for reply, yeah i see ist more than quite a bit, i think the next Problem is every time you made an update i have to rework the code... not a good idea i think^^

 

so i try to implement this Mission Settings in an other way

 

greetings

MoDAX

Link to comment
Share on other sites

I understand it's your work, TheVampire, and that we're not paying you for it, so we should be happy with whatever we get, but I think that lots of people would want mission time outs for our own reason. It might not be to pick and choose the missions (My players seem happy to attack any mission), but more likely because some players can't make the trip to a mission 12km away. It just really sucks when you see a mission just sitting there and it's too much to make it all the way out to it. Timing out would be a very popular request, I imagine.

Link to comment
Share on other sites

  • 4 weeks later...

So I kinda have managed to do this on my server. It's not elegant, but it works.

 

A little background... I have three types of missions running: Minor, Major and Static. Minor and Major, as you know, come default, I've added a new array of static missions that happen at specific static locations on the map. My solution is currently tailored only for static missions, but it should be easy to expand it to the other two as well.

 

So well, first go to your DZMSfunctions.sqf

 

Lines 230 to 245 is the default mission completion mechanic, here it is:

//function to wait for mission completion
DZMSWaitMissionComp = {
    private["_objective","_unitArrayName","_numSpawned","_numKillReq"];
	
    _objective = _this select 0;
    _unitArrayName = _this select 1;
	
    call compile format["_numSpawned = count %1;",_unitArrayName];
    _numKillReq = ceil(DZMSRequiredKillPercent * _numSpawned);
	
    diag_log text format["[DZMS]: (%3) Waiting for %1/%2 Units or Less to be Alive and a Player to be Near the Objective.",(_numSpawned - _numKillReq),_numSpawned,_unitArrayName];
	
    call compile format["waitUntil{sleep 1; ({isPlayer _x && _x distance _objective <= 30} count playableUnits > 0) && ({alive _x} count %1 <= (_numSpawned - _numKillReq));};",_unitArrayName];
	
    if (DZMSSceneryDespawnTimer > 0) then {_objective spawn DZMSCleanupThread;};
};

I've added a new function just below it that looks like this:

// Modified Loop to allow for mission time outs using both DZMS and WAI scripts. - Architect
//------------------------------------------------------------------------------
DZMSWaitStaticMissionComp = {
        private["_objective","_unitArrayName","_numSpawned","_numKillReq", "_timeOut", "_startTime", "_missionComplete", "_missionTimeOut", "_missionCheckLoop1", "_missionCheckLoop2", "_playerPresent"];
	
    _objective = _this select 0;                                                // _coords
    _unitArrayName = _this select 1;                                            // DZMSUnitsStatic
    _timeOut = _this select 2;                                                  // _timeOut
    _startTime = _this select 3;                                                // _startTime

    call compile format["_numSpawned = count %1;",_unitArrayName];
    _numKillReq = ceil(DZMSRequiredKillPercent * _numSpawned);

_missionComplete = false;
_missionTimeOut = false;
_missionCheckLoop1 = true;
_missionCheckLoop2 = true;

staticMissionSuccess = false;
staticMissionFailure = false;

while {_missionCheckLoop1} do {

                sleep 1;
                
                if ( 
                    call compile format["({isPlayer _x && _x distance _objective <= 100} count playableUnits > 0) && ({alive _x} count %1 <= (_numSpawned - _numKillReq));",_unitArrayName]
                    )
                then        
                {
                _missionComplete = true;
                _missionCheckLoop1 = false;
                };

                sleep 1;
                
                _currentTime = floor (time);
                
                if (
                    ({isPlayer _x && _x distance _objective <=1000} count playableUnits == 0) && (_currentTime - _startTime >= _timeOut)
                    )
                then 
                {
                _missionTimeOut = true;
                _missionCheckLoop1 = false;
                };
                
                };

while {_missionCheckLoop2} do {

                sleep 1;
                
                if (_missionComplete) then {
                    
                    _missionComplete = nil;
                    _missionTimeOut = nil;
                    _missionCheckLoop2 = false;
                    StaticMissionSuccess = true;
                    if (DZMSSceneryDespawnTimer > 0) then {_objective spawn DZMSCleanupThread;};
                    };
                
                sleep 1;
                
                if (_missionTimeOut) then {
                    
                    _missionComplete = nil;
                    _missionTimeOut = nil;
                    _missionCheckLoop2 = false;
                    StaticMissionFailure = true;
                    if (DZMSSceneryDespawnTimer > 0) then {_objective spawn DZMSCleanupThread;};
                    };
                };
            };
//------------------------------------------------------------------------------

Now, as Vampire said, you'll also need some extra code on your mission files for this mechanic to work properly. Here's how I did it, it works (well, most of the time at least).

 

First, we add the timeout values just below the _coords one:

// Time out Mechanics
_startTime = floor (time);
_timeOut = 1800;
_missionRunning = true;

Then, after the AI unit spawn lines, we replace the default completion function call with the one we made:

//Wait until the player is within 30 meters and also meets the kill req or mission times out.
[_coords,"DZMSUnitsStatic", _timeOut, _startTime] call DZMSWaitStaticMissionComp;

And immediately after this we replace the remaining code with the following:

while {_missionRunning} do {
    
                            sleep 1;
                            
                            if (staticMissionSuccess) then {
                                
                                    //Let everyone know that someone cleared the mission.
                                    [nil,nil,rTitleText,"The Military have been taken out! Enjoy the spoils of war!", "PLAIN",6] call RE;
                                    diag_log text format["[DZMS]: Static Mission 1 has ended succesfully."];
                                    deleteMarker "DZMSStaticMarker";
                                    deleteMarker "DZMSStaticDot";
                                    
                                    _missionRunning = false;
                                    staticMissionSuccess = nil;
                                    DZMSStaticDone = true;
                                    };
                                    
                            if (staticMissionFailure) then {
                                
                                    //Let everyone know that the mission has timed out.
                                    [nil,nil,rTitleText,"The Military have moved out! Nothing but empty tin cans and zombies there now!", "PLAIN",6] call RE;
                                    diag_log text format["[DZMS]: Static Mission 1 has timed out."];
                                    deleteMarker "DZMSStaticMarker";
                                    deleteMarker "DZMSStaticDot";
                                    
                                    {if (alive _x) then {_x call DZMSPurgeObject;};} forEach DZMSUnitsStatic;
                                    
                                    deleteVehicle _crate;
                                    deleteVehicle _crate1;
                                    
                                    _missionRunning = false;    
                                    staticMissionFailure = nil;
                                    DZMSStaticDone = true;    
                                    };                                                           
                            };

So yeah... I think everything is pretty straight forward if you read through it. I don't know much about scripting so I'm sure there's much better ways to reach the same result, but for now this seems to work.

 

I'll try to answer any questions you have, just remember I did this through trial and error and a lot of guesswork so don't get too technical with me!

Link to comment
Share on other sites

  • 3 months later...

First, we add the timeout values just below the _coords one:

// Time out Mechanics
_startTime = floor (time);
_timeOut = 1800;
_missionRunning = true;

Hi, I am trying out your timeout system but I do not know where to add this piece of coding at. Could you please explain where to add it out. Thank you.

Link to comment
Share on other sites

  • 2 weeks later...
while {_missionRunning} do {
    
                            sleep 1;
                            
                            if (staticMissionSuccess) then {
                                
                                    //Let everyone know that someone cleared the mission.
                                    [nil,nil,rTitleText,"The Military have been taken out! Enjoy the spoils of war!", "PLAIN",6] call RE;
                                    diag_log text format["[DZMS]: Static Mission 1 has ended succesfully."];
                                    deleteMarker "DZMSStaticMarker";
                                    deleteMarker "DZMSStaticDot";
                                    
                                    _missionRunning = false;
                                    staticMissionSuccess = nil;
                                    DZMSStaticDone = true;
                                    };
                                    
                            if (staticMissionFailure) then {
                                
                                    //Let everyone know that the mission has timed out.
                                    [nil,nil,rTitleText,"The Military have moved out! Nothing but empty tin cans and zombies there now!", "PLAIN",6] call RE;
                                    diag_log text format["[DZMS]: Static Mission 1 has timed out."];
                                    deleteMarker "DZMSStaticMarker";
                                    deleteMarker "DZMSStaticDot";
                                    
                                    {if (alive _x) then {_x call DZMSPurgeObject;};} forEach DZMSUnitsStatic;
                                    
                                    deleteVehicle _crate;
                                    deleteVehicle _crate1;
                                    
                                    _missionRunning = false;    
                                    staticMissionFailure = nil;
                                    DZMSStaticDone = true;    
                                    };                                                           
                            };

So yeah... I think everything is pretty straight forward if you read through it. I don't know much about scripting so I'm sure there's much better ways to reach the same result, but for now this seems to work.

 

I'll try to answer any questions you have, just remember I did this through trial and error and a lot of guesswork so don't get too technical with me!

 

I'm a little confused about this last part. This code gets added to every mission? Below the "Wait until the player..." section?

Link to comment
Share on other sites

I'm getting an error with this installed:

 

18:44:06   Error position: <DZMSUnitsStatic;>
18:44:06   Error Undefined variable in expression: dzmsunitsstatic
18:44:06 Error in expression <illReq = ceil(DZMSRequiredKillPercent * _numSpawned);


_missionComplete = false;>
18:44:06   Error position: <_numSpawned);


_missionComplete = false;>
18:44:06   Error Undefined variable in expression: _numspawned
18:44:06 File z\addons\dayz_server\DZMS\DZMSFunctions.sqf, line 256
18:44:07 Error in expression <playableUnits > 0) && ({alive _x} count DZMSUnitsStatic <= (_numSpawned - _numKi>
18:44:07   Error position: <DZMSUnitsStatic <= (_numSpawned - _numKi>
18:44:07   Error Undefined variable in expression: dzmsunitsstatic

The mission won't clear out.

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
  • Advertisement
  • Discord

×
×
  • Create New...