Jump to content

Multiple Events


Recommended Posts

It's just a minor modification to the examples of maca but I changed my event checks like this:

//Checks before starting an event

if (isNil "EPOCH_EVENT_RUNNING") then {
        EPOCH_EVENT_RUNNING = 0;
};
if (isNil "MAX_EPOCH_EVENTS") then {
        MAX_EPOCH_RUNNING = 5;
};

 
// Check if there are too many events running
if ((!_debug) and {EPOCH_EVENT_RUNNING > MAX_EPOCH_EVENTS}) exitWith {
    diag_log format ["Already %1 active events",MAX_EPOCH_EVENTS];
};
EPOCH_EVENT_RUNNING = EPOCH_EVENT_RUNNING + 1;

//EventHappening here


//AT bottom:
EPOCH_EVENT_RUNNING = EPOCH_EVENT_RUNNING - 1;

It's not much, but if you want to have several custom events running at the same time, but never more than a set ammount, this might be a good help for you :)

Link to comment
Share on other sites

Please I want to know if I'm doing well, thanks

Look for:

if (isNil "EPOCH_EVENT_RUNNING") then {
EPOCH_EVENT_RUNNING = false;
};


Remplace to:

if (isNil "EPOCH_EVENT_RUNNING") then {
        EPOCH_EVENT_RUNNING = 0;
};
if (isNil "MAX_EPOCH_EVENTS") then {
        EPOCH_EVENT_RUNNING = 5;
};



Look for:

// Check for another event running
if (EPOCH_EVENT_RUNNING) exitWith {
diag_log("Event already running");
};


Remplace to:


// Check if there are too many events running
if (EPOCH_EVENT_RUNNING > MAX_EPOCH_EVENTS and !_debug) exitWith {
    diag_log format ["Already %1 active events",MAX_EPOCH_EVENTS];
};
EPOCH_EVENT_RUNNING = EPOCH_EVENT_RUNNING + 1;



if (isNil "MAX_EPOCH_EVENTS") then {
        EPOCH_EVENT_RUNNING = 5;
};



And finally add in the end this:


//AT bottom:
EPOCH_EVENT_RUNNING = EPOCH_EVENT_RUNNING - 1;



Link to comment
Share on other sites

  • 1 year later...

Hello I seem to be getitng some errors.

 

But I am getting multiple events at once so not sure what these errors mean

 

23:28:07 "RUNNING EVENT: Treasure on [2015,8,10,13,28]"
23:28:07 Error in expression <
if ((!_debug) and {EPOCH_EVENT_RUNNING > MAX_EPOCH_EVENTS}) exitWith {
diag_log>
23:28:07   Error position: <> MAX_EPOCH_EVENTS}) exitWith {
diag_log>
23:28:07   Error >: Type Bool, expected Number
23:28:07 File z\addons\dayz_server\modules\Treasure.sqf, line 79
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...