Jump to content
Sign in to follow this  
Grimfist

Zone Script 'detector'

Recommended Posts

in the mp mission 'detector' (one that comes with the game)

there is a script and when you leave the area the screen goes fuzzy, and if you keep going you die.

i am trying to put it in my mission, but cannot get it working.

Here is the different files:

onLoadMission="$STR_detector_subtitle";

respawn = 3;
respawnDelay = 3;
aikills = 1;

class Header
{
gameType = DM;
minPlayers = 1;
maxPlayers = 20;
};

titleParam1 = "$STR_mp_param_duration";
valuesParam1[] = {600,1200,1800,3000,-1};
defValueParam1 = 600;
textsParam1[] = {"10","20","30","60","$STR_mp_param_infinite"};

titleParam2 = "$STR_mp_param_score";
valuesParam2[] = {10,20,50,100,100000000000000000};
defValueParam2 = 100000000000000000;
textsParam2[] = {"10","20","50","100","$STR_mp_param_infinite"};

#define IDENTITY(N,NAME)	class ap_##N \
 			{ \
			name = ##NAME##; \
			face = "Default"; \
			glasses = "none"; \
			speaker = "Male02EN"; \
			pitch = 1.0; \
 			};

class CfgIdentities
{
IDENTITY(0,"01:H7#5G6")
IDENTITY(1,"02:S63PFJ")
IDENTITY(2,"03:E183FV")
IDENTITY(3,"04:OUL4DQ")
IDENTITY(4,"05:JP61KY")
IDENTITY(5,"06:MT6H17")
IDENTITY(6,"07:DNH71O")
IDENTITY(7,"08:U-EXMX")
IDENTITY(8,"09:XZME6X")
IDENTITY(9,"10:SJQZVE")
IDENTITY(10,"11:N9CG-4")
IDENTITY(11,"12:FBTVLZ")
IDENTITY(12,"13:40UXD3")
IDENTITY(13,"14:U834RW")
IDENTITY(14,"15:QKGHTR")
IDENTITY(15,"16:4NGEBV")
IDENTITY(16,"17:7S6HJR")
IDENTITY(17,"18:90I472")
IDENTITY(18,"19:O0BDK5")
IDENTITY(19,"20:EC70ZW")
};

/*
File: init.sqf
Author: Karel Moricky
*/


_diary = player createDiaryRecord ["Diary", [localize "str_detector_briefing", localize "str_detector_briefing_text"]];
end_score = false;
if !(isserver) exitwith {};

//////////////////////////////////////////////////
startLoadingScreen [localize "str_detector_onload","RscDisplayLoadMission"];
//////////////////////////////////////////////////

//--- Cursom params
if (isnil "param1") then {param1 = -1};
if (param1 > 0) then {estimatedtimeleft param1;};

waituntil {!isnil "bis_fnc_init"};
//[nil,nil,"per",rEXECVM,"init_local.sqf"] call RE;
//player execvm "init_local.sqf";

//--- Zone trigger
_trig = zone;
_trigpos = position _trig;
_trigsize = (triggerarea _trig) select 0;
_trigsizedev = _trigsize / 10;

_carcount = _trigsize / 4;
_progresscountMax = _carcount + _trigsize + 360;
_progresscount = 0;
progressLoadingScreen _progresscount;


//--- Create cars
_wrecks = ["HMMWVWreck","BMP2Wreck","UralWreck","datsun01Wreck","datsun02Wreck","hiluxWreck","Mi8Wreck","T72Wreck","T72WreckTurret","BRDMWreck","UAZWreck","SKODAWreck","LADAWreck"];
_cars = ["Tractor","HMMWV_M2","HMMWV_TOW","HMMWV_MK19","HMMWV","UAZ_MG_CDF","UAZ_AGS30_CDF","UAZ_CDF","Ural_CDF","UralOpen_CDF","UralRepair_CDF","UralReammo_CDF","UralRefuel_CDF","Ural_ZU23_CDF","BRDM2_CDF","BRDM2_ATGM_CDF","GRAD_CDF","UAZ_RU","UAZ_AGS30_RU","GRAD_RU","UAZ_MG_INS","UAZ_AGS30_INS","UAZ_INS","UAZ_SPG9_INS","Ural_INS","UralOpen_INS","UralRepair_INS","UralReammo_INS","UralRefuel_INS","Ural_ZU23_INS","BRDM2_INS","BRDM2_ATGM_INS","GRAD_INS","BRDM2_Gue","BRDM2_HQ_Gue","Ural_ZU23_Gue","UralCivil","UralCivil2","Skoda","SkodaBlue","SkodaRed","SkodaGreen","datsun1_civil_1_open","datsun1_civil_2_covered","datsun1_civil_3_open","car_hatchback","car_sedan","hilux1_civil_1_open","hilux1_civil_2_covered","hilux1_civil_3_open","Pickup_PK_GUE","Pickup_PK_INS","Offroad_DSHKM_Gue","Offroad_SPG9_Gue","Offroad_DSHKM_INS","BTR90","BTR90_HQ","GAZ_Vodnik_HMG","GAZ_Vodnik","GAZ_Vodnik_MedEvac","HMMWV_Armored","HMMWV_Ambulance","HMMWV_Avenger","Ikarus","Kamaz","KamazOpen","KamazRepair","KamazReammo","KamazRefuel","Lada_base","Lada1","Lada2","LadaLM","LAV25","LAV25_HQ","MTVR","MtvrReammo","MtvrRefuel","MtvrRepair","TowingTractor","V3S_Civ","V3S_Gue","VWGolf","WarfareSalvageTruck_USMC","WarfareSupplyTruck_USMC","WarfareReammoTruck_USMC","WarfareSalvageTruck_RU","WarfareSupplyTruck_RU","WarfareReammoTruck_RU","WarfareSalvageTruck_CDF","WarfareSupplyTruck_CDF","WarfareReammoTruck_CDF","WarfareSalvageTruck_INS","WarfareSupplyTruck_INS","WarfareReammoTruck_INS","WarfareSalvageTruck_Gue","WarfareSupplyTruck_Gue","WarfareReammoTruck_Gue"];
_cars = _cars + _wrecks;


for "_i" from 0 to _carcount do {
_class = _cars call bis_fnc_selectrandom;
_car = createvehicle [_class, position _trig, [], _trigsize*0.8, "none"];
_car setdir (random 360);
_car setpos [position _car select 0,position _car select 1,0];
_car setdamage (random 0.8);
_car setfuel (random 1);
_car setammocargo (random 1);

_progresscount = _progresscount + (_i / _progresscountMax);
progressLoadingScreen _progresscount;
if (cheat1) then {
	_marker = createmarker [format ["www%1",round _i],position _car];
	_marker setmarkertype "mil_triangle";
	_marker setmarkerdir direction _car;
	_marker setmarkercolor "colorblue";
};
};

//--- Create ammo boxes
_allammolist = ["USMC_Soldier","USMC_Soldier_Light","USMC_Soldier2","USMC_Soldier_GL","USMC_Soldier_Officer","USMC_Soldier_SL","USMC_Soldier_TL","USMC_Soldier_LAT","USMC_Soldier_AT","USMC_Soldier_HAT","USMC_Soldier_AA","USMC_Soldier_Medic","USMC_Soldier_AR","USMC_Soldier_MG","USMC_SoldierS_Spotter","USMC_SoldierS_Sniper","USMC_SoldierS_SniperH","USMC_SoldierM_Marksman","USMC_SoldierS","USMC_SoldierS_Engineer","USMC_Soldier_Pilot","USMC_Soldier_Crew","USMC_LHD_Crew_Base","USMC_LHD_Crew_White","USMC_LHD_Crew_Blue","USMC_LHD_Crew_Brown","USMC_LHD_Crew_Green","USMC_LHD_Crew_Red","USMC_LHD_Crew_Purple","USMC_LHD_Crew_Yellow","FR_TL","FR_Commander","FR_R","FR_Marksman","FR_Light","FR_Corpsman","FR_AR","FR_GL","FR_Sapper","FR_AC","FR_Miles","FR_Cooper","FR_Sykes","FR_OHara","FR_Rodriguez","FR_Assault_R","FR_Assault_GL","RU_Soldier","RU_Soldier2","RU_Soldier_Officer","RU_Soldier_Light","RU_Soldier_MG","RU_Soldier_AR","RU_Soldier_GL","RU_Soldier_Marksman","RU_Soldier_LAT","RU_Soldier_AT","RU_Soldier_HAT","RU_Soldier_AA","RU_Soldier_Sniper","RU_Soldier_SniperH","RU_Soldier_Spotter","RU_Soldier_Medic","RU_Soldier_Pilot","RU_Soldier_Crew","RU_Soldier_SL","RU_Soldier_TL","RU_Commander","RUS_Soldier1","RUS_Soldier2","RUS_Soldier3","RUS_Soldier_GL","RUS_Soldier_TL","RUS_Commander","RUS_Soldier_Marksman","RUS_Soldier_Sab","MVD_Soldier","MVD_Soldier_GL","MVD_Soldier_TL","MVD_Soldier_AT","MVD_Soldier_MG","MVD_Soldier_Marksman","MVD_Soldier_Sniper","GUE_Soldier_1","GUE_Soldier_2","GUE_Soldier_3","GUE_Soldier_GL","GUE_Worker2","GUE_Woodlander1","GUE_Woodlander2","GUE_Woodlander3","GUE_Villager3","GUE_Villager4","GUE_Soldier_CO","GUE_Commander","GUE_Soldier_AT","GUE_Soldier_AA","GUE_Soldier_AR","GUE_Soldier_MG","GUE_Soldier_Sniper","GUE_Soldier_Sab","GUE_Soldier_Scout","GUE_Soldier_Medic","GUE_Soldier_Pilot","GUE_Soldier_Crew","Ins_Soldier_1","Ins_Soldier_2","Ins_Soldier_CO","Ins_Soldier_GL","Ins_Soldier_Medic","Ins_Soldier_AR","Ins_Soldier_MG","Ins_Soldier_AT","Ins_Soldier_AA","Ins_Soldier_Sniper","Ins_Soldier_Sapper","Ins_Soldier_Sab","Ins_Worker2","Ins_Woodlander1","Ins_Woodlander2","Ins_Woodlander3","Ins_Villager3","Ins_Villager4","Ins_Commander","Ins_Lopotev","Ins_Bardak","Ins_Soldier_Pilot","Ins_Soldier_Crew","CDF_Soldier","CDF_Soldier_Light","CDF_Soldier_GL","CDF_Soldier_Medic","CDF_Soldier_Sniper","CDF_Soldier_RPG","CDF_Soldier_Strela","CDF_Soldier_AR","CDF_Soldier_MG","CDF_Soldier_TL","CDF_Soldier_Officer","CDF_Soldier_Militia","CDF_Soldier_Pilot","CDF_Soldier_Crew","CDF_Soldier_Spotter","CDF_Soldier_Marksman","CDF_Soldier_Engineer","CDF_Commander"];
_ammolist = [];

// Select random 20 of them (to prevent loading many different models)
for "_i" from 1 to 20 do {
_class = _allammolist call bis_fnc_selectrandom;
_ammolist = _ammolist + [_class]
};


for "_i" from 0 to _trigsize do {
_class = _ammolist call bis_fnc_selectrandom;
_ammo = createvehicle [_class, position _trig, [], _trigsize*0.8, "none"];
_ammo setdamage 1;
_ammo setdir (random 360);

_progresscount = _progresscount + (_i / _progresscountMax);
progressLoadingScreen _progresscount;
if (cheat1) then {
	_marker = createmarker [format ["aaa%1",round _i],position _ammo];
	_marker setmarkertype "mil_triangle";
	_marker setmarkerdir direction _ammo;
	_marker setmarkercolor "colorred";
};
};

//--- Create border (only for circle)
_classlist = ["Citizen1","Citizen2","Citizen3","Citizen4","Worker1","Worker2","Worker3","Worker4","Profiteer1","Profiteer2","Profiteer3","Profiteer4","Rocker1","Rocker2","Rocker3","Rocker4","Woodlander1","Woodlander2","Woodlander3","Woodlander4","Functionary1","Functionary2","Villager1","Villager2","Villager3","Villager4","Priest","Doctor","SchoolTeacher","Assistant","Pilot","Policeman"/*,"Secretary1","Secretary2","Secretary3","Secretary4","Secretary5","Sportswoman1","Sportswoman2","Sportswoman3","Sportswoman4","Sportswoman5","ValentinaFit","ValentinaVictim","Madam1","Madam2","Madam3","Madam4","Madam5","Farmwife1","Farmwife2","Farmwife3","Farmwife4","Farmwife5","Damsel1","Damsel2","Damsel3","Damsel4","Damsel5","HouseWife1","HouseWife2","HouseWife3","HouseWife4","HouseWife5","Hooker1","Hooker2","Hooker3","Hooker4","Hooker5","WorkWoman1","WorkWoman2","WorkWoman3","WorkWoman4","WorkWoman5"*/];
_bodydis = (360 / (_trigsize * pi)) * 3;
_bodycount = ((_trigsize) * pi) / _bodydis;
for "_dir" from 0 to 360 step _bodydis do {
_class = _classlist call bis_fnc_selectrandom;
_dis = _trigsize + (-_trigsizedev/2 + random _trigsizedev);
_pos = [(_trigpos select 0) + (sin _dir * _dis),(_trigpos select 1) + (cos _dir * _dis),0];
_body = _class createvehicle _pos;
_body setpos _pos;
_body setdir (random 360);
_body switchmove "";
_body setdamage 1;

_progresscount = _progresscount + (_dir / _progresscountMax);
progressLoadingScreen _progresscount;
if (cheat1) then {
	_marker = createmarker [format ["xxx%1",round _dir],_pos];
	_marker setmarkertype "mil_dot";
	_marker setmarkercolor "colororange";
};
};

//--- Move NPCs
{
//if (!isplayer _x) then {_x setpos [100,100,100]};
_x setpos [(_trigpos select 0) + (cos (random 360) * random (_trigsize)),(_trigpos select 1) + (sin (random 360) * random (_trigsize)),0];
if !(isplayer _x) then {
	_x execvm "init_respawn.sqf";
	_x addeventhandler ["killed",{(_this select 0) execvm "init_respawn.sqf"}];
	_x setidentity (vehiclevarname _x);
	_x setskill random 0.5;
};
} foreach allunits;
//[ap_0,ap_1,ap_2,ap_3,ap_4,ap_5,ap_6,ap_7,ap_8,ap_9,ap_10,ap_11,ap_12,ap_13,ap_14,ap_15,ap_16,ap_17,ap_18,ap_19];

//////////////////////////////////////////////////
endLoadingScreen;
//////////////////////////////////////////////////

//sleep 0.01;



waituntil {
_players = [] call bis_fnc_listplayers;
_score = 0;
{_score = _score max (score _x)} foreach _players;
_score >= param2
};
end_score = true;

/*
File: init_respawn.sqf
Author: Karel Moricky
*/

sleep 0.01;

_var = vehiclevarname _this;
_newunit = objnull;
waituntil {
call compile format ["_newunit = %1",_var];
alive _newunit;
};
_newunit addrating -10e10;
_newunit switchmove "";

if (_newunit == player && _newunit == _this) then {cuttext ["","black in",10000]};
waituntil {!isnil "bis_fnc_init"};
if (_newunit == player) then {cuttext ["","white in",1]};

_newunit addrating -10e10;
removeallweapons _newunit;
for "_i" from 1 to 12 do {_newunit addmagazine "30Rnd_556x45_StanagSD"};
_newunit addweapon "G36_C_SD_eotech";
_newunit addweapon "nvgoggles";
_newunit selectweapon "G36_C_SD_eotech";
_newunit switchmove "";

if (count waypoints _newunit == 1) then {
_wp = group _newunit addwaypoint [position _newunit,0];
_wp setwaypointtype "sad";
_wp setwaypointbehaviour "combat";
};

//onmapsingleclick "player setpos _pos";
//setTerrainGrid 1000;
//---

_trig = zone;
_trigsize = ((triggerarea _trig) select 0);
_trigzonesize = 20;
if (isnil "truetime") then {truetime = time;};

//--- Respawn codes
player setpos [(position _trig select 0) + (sin (random 360) * (random (_trigsize * 0.8))),(position _trig select 1) + (sin (random 360) * (random (_trigsize * 0.8))),0];
player execvm "init_respawn.sqf";
player addeventhandler ["killed",{(_this select 0) execvm "init_respawn.sqf"}];

mapanimadd [0,0.1,position player];
mapAnimCommit;

//enable GPS in mission
showGPS true;

//--- Ambient Light
_lightColor = [1,1,1];
_light = "#lightpoint" createVehicleLocal position player;
_light setLightBrightness 0.1;
_light setLightAmbient _lightColor;
_light setLightColor _lightColor;
_light lightAttachObject [vehicle player, [0,0,-20]];
xlight = _light;

//--- Post process effects
sleep 0.01;
"colorCorrections" ppEffectAdjust [1, 1, -0.005, [0.0, 0.0, 0.0, 0.0], [0.0, 1.0, 1.0, 0.4], [0.3, 0.3, 0.3, 0.0]];
"colorCorrections" ppEffectCommit 0;
"colorCorrections" ppEffectEnable true;

//player setvehicleposition [position _trig,[],_trigsize];
//player setpos [(position _trig select 0) + (sin 360 * _trigsize),(position _trig select 1) + (sin 360 * _trigsize),0];

while {true} do {
waituntil {alive player};
if (isserver) then {
	truetime = time;
	publicvariable "truetime";
};

//--- Environment
//skiptime (-daytime + (-0.001 + random 0.002));
0 setovercast 0.7;
0 setfog 1;
0 setrain 0;
//if (random 1 > 0.5) then {_light setLightBrightness (0.28 + random 0.04)};
_light lightAttachObject [vehicle player, [0,0,-20]];

//--- Detectorâ„¢
_unitlist = [];
//_possibleUnits = position player nearentities ["man",500];
_possibleUnits = allunits;// [] call bis_fnc_listplayers;
_timeleft = if (param1 > 0) then {parsetext format ["<t align='center'>%1</t>",[(param1 - truetime)/60,"HH:MM"] call bis_fnc_timetostring]} else {""};
if ({alive _x} count _possibleUnits > 1) then {

	//--- Show name and distance
	for "_n" from 0 to (count _possibleUnits)-1 do {
		_actual = _possibleUnits select _n;
		if (alive _actual && _actual != player) then {
			_unitlist = _unitlist + [_actual];
		};
	};
	_nearestunit = objnull;
	_dist = 1000000;
	{
		if (_x distance player < _dist) then {_nearestunit = _x; _dist = _x distance player};
	} foreach _unitlist;
	_name = parsetext format ["<t size='1.1' align='center'>%1</t>",name _nearestunit];

	//--- Sort by danger
	_dist1 = round (((player distance _nearestunit)/10))*10;
	_color = if (_dist1 > 50) then {"#d6ff8c"} else {if (_dist1 > 20) then {"#ff9900"} else {"#ff0000"}};

	_enemy1 = parsetext format ["<t size='2.0' align='center' color='%2'>%1 m</t>",_dist1,_color];
	_text = if (param1 > 0) then {[_enemy1,linebreak,_name,linebreak,_timeleft]} else {[_enemy1,linebreak,_name]};
	hintsilent composeText _text;
} else {

	//--- Null
	_name = parsetext "<t size='1.1' align='center'>???</t>";
	_enemy1 = parsetext "<t size='2.0' align='center' color='#d6ff8c'>??? m</t>";
	_text = if (param1 > 0) then {[_enemy1,linebreak,_name,linebreak,_timeleft]} else {[_enemy1,linebreak,_name]};
	hintsilent composeText _text;
};

//--- Zone
_zonedis = player distance _trig;
if (_zonedis > _trigsize) then {
	_alpha = ((_zonedis - _trigsize) / _trigzonesize);
	"filmGrain" ppEffectEnable true;
	"filmGrain" ppEffectAdjust [_alpha, 0, 1, _alpha/100, 1];
	"filmGrain" ppEffectCommit 0;
	if (_zonedis > (_trigsize + _trigzonesize)) then {
		player setdamage 1;
		player addscore -1;
	};
} else {
	"filmGrain" ppEffectEnable false;
};

sleep 0.1;
};

i have a trigger called zone that is 1500 x 450.

and the functions module is there also. (im not sure if i need it)

What do i need to take out and change?

i know this is a pretty big question but i have tried and cant do it.

TIA, grim.

Edited by Grimfist

Share this post


Link to post
Share on other sites

The effect is in the last block from the last script.

I think you can do it by placing a Blufor/not present trigger with condition: this && local player, call the trigger playground and execVM something like this:

_p = (vehicle player);
    while {true} do {
    _out = (if !(_p in list playground) then {true} else {false});
            if (_out) then {             
               "filmGrain" ppEffectEnable true;
               "filmGrain" ppEffectAdjust [_alpha, 0, 1, _alpha/100, 1];
               "filmGrain" ppEffectCommit 0;
            }
            else 
            {
        "filmGrain" ppEffectEnable false;
            };
sleep 0.1;
}; 

For the setdamage part you can do it how they did or you can check how long the player has been out of the trigger..

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×