Jump to content

Adding a deadline


Recommended Posts

I was modding our side mission script to the Epoch Events system and I kinda got stuck on the deadline / removal of the crate. Currently we have this line for it:

waitUntil{{isPlayer _x && _x distance _loot_box < 10} count playableunits > 0}; 
    [nil,nil,rTitleText,"The building supplies have been found!", "PLAIN",6] call RE;

which waits until a player comes near, so if noone goes loot the box, it will never disappear and new boxes will not spawn because the event will be active untill restart. I have been trying with the sleep and wait command, but it completely bugs if i try adding a timer to that statement.

 

Kind regards,

Arphji

Link to comment
Share on other sites

im doing it like this:

[nil,nil,rTitleText,"An Supply Transport stopped at the marked Area on your map! Watch out for Bandits protecting it!", "PLAIN",10] call RE;
diag_log("EVENT: Supply Transport ready!");

waitUntil{ 
sleep 1;
_unitsAlive = ({alive _x} count units _aiGroup);
(_unitsAlive < 1)
};
 
[nil,nil,rTitleText,"All Bandits are dead now, go get the loot!", "PLAIN",5] call RE; 
diag_log("EVENT: Bandits are dead!");

waitUntil 
{
    sleep 1;
    _playerPresent = false;
    {if((isPlayer _x) AND (_x distance _loot_box <= 10)) then {_playerPresent = true};}forEach playableUnits;
    (_playerPresent)
};
[nil,nil,rTitleText,"The Supply Transport is under survivor control and will despawn in 10 minutes!", "PLAIN",5] call RE; 
diag_log("EVENT: Supply Transport under control!");

replace the _aiGroup with the name of your create group command and you are good to go

Link to comment
Share on other sites

Minty: I think that basically checks to make sure that more than nil playable units are on the map. It wouldn't make sense to set it below 0 playable units. Not in my understanding anyway. I could be wrong.

WaTTe: Does that work? The way I read it, is that i think that the first waituntil statement must be satisfied before the second waituntil , right? Also, I don't think it needs the sleep command. I've tried it without and it works fine, doesn't seem to cause any lag.

Link to comment
Share on other sites

Have you tried putting your timer like this:

 

waitUntil{{isPlayer _x && _x distance _loot_box < 10 || timer condition here } count playableunits > 0};

 

I vaguely remember seeing that as an example of a THIS or THIS condition. Sorry, still half asleep... 

 

Sorry i totally forgot to respond in this topic, I just use a timer now and removed the waituntill part for now. I tried using pipes but it doesnt work.

Link to comment
Share on other sites

I have been trying to do something similar with the timer but have messed it up. Now the notification blinks nonstop on the screen and spams the server log brining the server frames to 0. I am being sued for causing a seizure with someone on the server. What's a simple example of the timer code you are using? I am trying to work a cleanup code for old missions as well. I have a lot of Bohemia forums to catch up on.

Link to comment
Share on other sites

hayward: it doesnt actualle need the sleep command but you should set it to sleep 15; or sleep 20;

Without sleep the server executes the loop every frame, with sleep 1; every second. its enough if he checks every 10-20 seconds and safes server performance.

Link to comment
Share on other sites

  • 4 weeks later...

I'm using a EMS Mission System, but some of the missions isn't able to be completed so i was looking for a way to put on a 30 min deadline on the missions but i'm not sure on how i should do it, is there anyone that can help with that? 

 

 

//Helicopter Mission Created by TheSzerdi Edited by Falcyn [QF]

//Edited for EMS by Fuchs
 
private ["_coords","_dummymarker","_chopper","_wait","_coord1","_coord2","_coord3","_coord4","_coord5","_coord6","_coord7","_coord8","_coord9","_coord10","_coord11","_coord12"];
[] execVM "\z\addons\dayz_server\Missions\SMGoMajor.sqf";
WaitUntil {MissionGo == 1};
 
_coord1 = [4908.355,11216.505,0];
_coord2 = [6162.9888,11324.005,0];
_coord3 = [7761.3657,11569.265,0];
_coord4 = [8336.6055,10441.17,0];
_coord5 = [7201.0664,10400.667,0];
_coord6 = [6249.1104,9579.043,0];
_coord7 = [4763.3818,9802.2734,0];
_coord8 = [3675.6865,7353.2798,0];
_coord9 = [6815.6362,5599.0854,0];
_coord10 = [7532.0742,8164.3203,0];
_coord11 = [6046.6455,8771.2178,0];
_coord12 = [5266.6836,7273.8135,0];
 
_coords = [_coord1, _coord2, _coord3, _coord4, _coord5, _coord6, _coord7, _coord8, _coord9, _coord10, _coord11, _coord12] call BIS_fnc_selectRandom;
 
//Mission accomplished
[nil,nil,rTitleText,"A helicopter has crash landed! Secure it's firepower for yourself!", "PLAIN",6] call RE;
[nil,nil,rGlobalRadio,"A helicopter has crash landed! Secure it's firepower for yourself!"] call RE;
[nil,nil,rHINT,"A helicopter has crash landed! Secure it's firepower for yourself!"] call RE;
 
Ccoords = _coords;
publicVariable "Ccoords";
[] execVM "debug\addmarkers.sqf";
 
_chopper = ["AH64D_EP1","CH_47F_EP1_DZE","AH1Z"] call BIS_fnc_selectRandom;
 
hueychop = createVehicle [_chopper,_coords,[], 0, "NONE"];
hueychop setVariable ["DZAI",1,true];
hueychop setFuel 0.25;
hueychop setVehicleAmmo 0.25;
 
_aispawn = [_coords,80,6,6,1] execVM "\z\addons\dayz_server\missions\add_unit_server4.sqf";//AI Guards
sleep 5;
_aispawn = [_coords,80,6,4,1] execVM "\z\addons\dayz_server\missions\add_unit_server4.sqf";//AI Guards
sleep 5;
_aispawn = [_coords,40,4,4,1] execVM "\z\addons\dayz_server\missions\add_unit_server4.sqf";//AI Guards
 
 
waitUntil{{isPlayer _x && _x distance hueychop < 60  } count playableunits > 0}; 
 
//Mission completed
[nil,nil,rTitleText,"The Helicopters were under survivor control!", "PLAIN",6] call RE;
[nil,nil,rGlobalRadio,"The Helicopters were under survivor control!"] call RE;
[nil,nil,rHINT,"The Helicopters were under survivor control!"] call RE;
 
 
[] execVM "debug\remmarkers.sqf";
MissionGo = 0;
Ccoords = 0;
publicVariable "Ccoords";
 
SM1 = 5;
[0] execVM "\z\addons\dayz_server\missions\major\SMfinder.sqf";
 
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...