Here are a few more useful scripts for use with multiplayer missions.
Set custom rain with an easy script.
0 setOvercast 1; 0 setRain 1; 0 setFog 0.1; // snow affects visibility at distance setHumidity 0.9; // don't want to see dust clouds enableEnvironment [false, true]; // don't want to see snakes and butterflies either forceWeatherChange; [ "a3\data_f\rainnormal_ca.paa", // rainDropTexture 1, // texDropCount 0.01, // minRainDensity 15, // effectRadius 0.3, // windCoef 0.5, // dropSpeed 0.7, // rndSpeed 0.5, // rndDir 0.01, // dropWidth 0.01, // dropHeight [0.2, 0.1, 0.1, 1], // dropColor 0.1, // lumSunFront 0.1, // lumSunBack 5.5, // refractCoef 0.3, // refractSaturation true, // snow false // dropColorStrong ] call BIS_fnc_setRain; |
Spawn a mortar crew with sandbags to defend an area.
mortars = [ ["Box_EAF_AmmoVeh_F",[0.236328,0.152344,0.000679016],0,1,0,[0,1.67666],"","",true,false], ["UK3CB_CHD_I_2b14_82mm",[-2.05469,0.228516,-0.0754776],0,1,0,[0,1.67666],"m1","",true,false], ["UK3CB_CHD_I_2b14_82mm",[0.0288086,2.89453,-0.07547],0,1,0,[0,1.67666],"m2","",true,false], ["Land_fort_bagfence_round",[-4.54443,0.546875,0.0318146],265.827,1,0,[1.67222,-0.122057],"","",true,false], ["UK3CB_CHD_I_2b14_82mm",[0.988281,-3.40625,-0.0754547],0,1,0,[0,1.67666],"m3","",true,false], ["UK3CB_CHD_I_2b14_82mm",[3.3252,-1.91602,-0.0754547],0,1,0,[0,1.67666],"m4","",true,false], ["Land_fort_bagfence_round",[-0.477051,-5.44922,0.0158691],209.563,1,0,[0.827414,-1.45849],"","",true,false], ["Land_fort_bagfence_round",[0.0932617,5.96289,0.000167847],0,1,0,[0,1.67666],"","",true,false], ["Land_fort_bagfence_round",[5.5957,-2.41992,-0.0312424],98.9748,1,0,[-1.65615,-0.261632],"","",true,false] ]; _static99 = [Loc, 400, 200, 10, 0, 0.5, 0] call BIS_fnc_findSafePos; gunz = [_static99, 0, mortars ] call BIS_fnc_objectsMapper; sleep 1; { createVehicleCrew _x; } forEach [m1, m2, m3, m4]; |
This is an easy way to do this by spawning a composition and then putting a crew in each gun. This is the best way to do this. And you may name certain items and script them later.
{ createVehicleCrew _x; } forEach [m1, m2, m3, m4]; |
Add this to the initPlayerLocal.sqf file and this will enable a full heal when using the healing animation in Arma 3.
player addEventHandler ["HandleHeal", { _this spawn { params ["_injured","_healer"]; missionNamespace setVariable ['Health',getDammage _injured,FALSE]; _damage = Health; if (_injured == _healer) then { waitUntil { damage _injured != _damage }; if (damage _injured < _damage) then { titletext ["You used Bandages and Morphine.", "PLAIN DOWN"]; _injured setDamage 0; }; }; }; }]; |
This code will allow the spawning of AI between 1950 and 2550 meters from the centre of a circle. This is useful to spawn AI around an area that will attack it from the outside. They will move in and search the area for enemies.
#define ASSUALTERS "rhsgref_group_chdkz_infantry_aa","rhsgref_group_chdkz_infantry_at","rhsgref_group_chdkz_infantry_mg","rhsgref_group_chdkz_infantry_patrol","rhsgref_group_chdkz_insurgents_squad" private _enemiesArray = [grpNull]; for "_i" from 1 to 5 do { _patrolGroup9 = createGroup east; _randomPosInf = [Loc, 1950, 2550, 0, 0, 20, 0] call BIS_fnc_findSafePos; _patrolGroup9 = [_randomPosInf, EAST, (configfile >> "CfgGroups" >> "East" >> "rhsgref_faction_chdkz" >> "rhsgref_group_chdkz_insurgents_infantry" >> [ASSUALTERS] call BIS_fnc_selectRandom)] call BIS_fnc_spawnGroup; [_patrolGroup9, [Loc, 200, 200, 0, false]] call CBA_fnc_taskSearchArea; _enemiesArray = _enemiesArray + [_patrolGroup9]; _patrolGroup9 enableDynamicSimulation true; _patrolGroup9 setBehaviour "SAFE"; _patrolGroup9 setCombatMode "WHITE"; }; sleep 2; _randomPosNein = [Loc, 1950, 2550, 0, 0, 20, 0] call BIS_fnc_findSafePos; sleep 0.3; //[[65.882,16971.2,2800], "ammo_Missile_Cruise_01", , 180, false, [0,0,0.25]] spawn BIS_fnc_exp_camp_guidedProjectile; sleep 0.3; private _TankVic2 = createVehicle ["UK3CB_CW_SOV_O_LATE_2S6M_Tunguska", _randomPosNein, [], 5, "NONE"]; createVehicleCrew _TankVic2; _TankVic2 setFuel 0; ["NotificationCounterattack", ["Allied forces are moving into the AO, they are helping the battle."]] remoteExec ["BIS_fnc_showNotification", 0]; sleep 1; { _x addCuratorEditableObjects [allUnits,true]; } count allCurators; |
Wait until 2 triggers have been activated before ending the mission. This works just fine.
sleep 1; waitUntil { sleep 6; ((triggeractivated adt) && (triggeractivated tower2)) }; ['task3','SUCCEEDED'] call BIS_fnc_taskSetState; sleep 4; ["NotificationEndOperation", ["The battle is over, good work boys!"]] remoteExec ["BIS_fnc_showNotification", 0]; |