Posted: . At: 12:59 PM. This was 6 years ago. Post ID: 11468
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.

More very useful Arma 3 scripting commands.

Some very cool Arma 3 SQF scripting samples

Shoot a vehicle or soldier 50,000 feet into the sky.

cursorTarget setVelocity [0,0,1000];
hint format["%1 Is flying to space!",name cursorTarget];

Spawn an AAF support crate in random houses around the HQ.

_houseList = getPos _cargo nearObjects ["House",500];
{
 _c = 0;
 while { format ["%1", _x buildingPos _c] != "[0,0,0]" } do {_c = _c + 1};
 if (_c > 0) then
    {
       _ranNum = floor(random _c);
       _crate = "CUP_RUBasicAmmunitionBox" createVehicle [0,0,0];
       _crate setPos (_x buildingPos _ranNum);
    };
 sleep 0.123;
} forEach _houseList;

Attach a smoke trail to every bullet and grenade you fire.

player addEventHandler ["Fired", {
	("CMflareAmmo" createVehicle [0,0,1e9]) attachTo [_this select 6, [0,0,0]]
}];

Attach a 155mm cluster munition to every bullet you fire. This gives you an apocalyptic level of destruction…

player addEventHandler ["Fired", {
	("Cluster_155mm_AMOS" createVehicle [0,0,1e9]) attachTo [_this select 6, [0,0,0]]
}];
Lovely sunset in Afghanistan.
Lovely sunset in Afghanistan.

Continually reset the player`s rating every so often.

player addEventHandler ['HandleRating',{
    (_this select 0) addRating (0 - (rating (_this select 0)));
}];

This code in the initPlayerLocal.sqf file will print a nice textural display of the mission name and the date. This is a very nice touch for a mission.

// --- Info text
if (time < 10) then
{
	titleCut ["", "BLACK FADED", 999];
	[] Spawn {
		waitUntil{!(isNil "BIS_fnc_init")};
 
		// Info text
		[str("Op Silent Spring") , str(date select 1) + "." + str(date select 2) + "." + str(date select 0), str("Alpha Team 1")] spawn BIS_fnc_infoText;
 
		sleep 12;
		"dynamicBlur" ppEffectEnable true;
		"dynamicBlur" ppEffectAdjust [6];
		"dynamicBlur" ppEffectCommit 0;
		"dynamicBlur" ppEffectAdjust [0.0];
		"dynamicBlur" ppEffectCommit 7;
		titleCut ["", "BLACK IN", 5]
	};
};

Spawn a Military Cargo HQ somewhere near the Gamelogic named CENTER and then spawn a patrol.

hq1 = [
	["Box_FIA_Wps_F",[0.989746,-15.1357,0],0,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[-14.7861,-4.48535,0],271.222,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[-14.8584,4.30176,0],271.222,1,0,[0,0],"","",true,false], 
	["Box_FIA_Support_F",[5.00684,-15.1763,0],0,1,0,[0,0],"","",true,false], 
	["Box_East_WpsLaunch_F",[-2.6499,-16.208,0],0,1,0,[0,0],"","",true,false], 
	["Box_FIA_Wps_F",[8.69336,-15.1758,0],0,1,0,[0,0],"","",true,false], 
	["Land_Bunker_01_small_F",[-11.0381,14.2192,0],180,1,0,[0,0],"","",true,false], 
	["Land_Cargo_Patrol_V2_F",[-10.6431,-15.1782,0],0,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[-2.9126,-18.0435,0],0,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[5.87109,-17.7837,0],0,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_5_F",[-7.73779,18.2729,0],0,1,0,[0,0],"","",true,false], 
	["Land_Bunker_01_HQ_F",[19.0215,1.18311,0],0,1,0,[0,0],"","",true,false], 
	["Land_Cargo_Patrol_V2_F",[13.8291,-14.4561,0],0,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[-14.7173,-13.0786,0],271.222,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[-14.9272,12.895,0],271.222,1,0,[0,0],"","",true,false], 
	["Land_Bunker_01_small_F",[12.8696,15.0117,0],180,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_5_F",[5.875,19.2905,0],0,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[17.6089,-12.0176,0],271.222,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_5_F",[-13.377,18.2695,0],0,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[-11.5024,-18.2954,0],0,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[17.3989,13.9561,0],271.222,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[14.4609,-17.5317,0],0,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_1_F",[-14.626,18.1982,0],0,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_5_F",[11.5532,19.1851,0],0,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[22.6782,-8.80371,0],0,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[22.3696,10.8716,0],0,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_1_F",[17.1938,19.1538,0],0,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_5_F",[26.0498,3.31738,-9.53674e-007],90,1,0,[0,-0],"","",true,false], 
	["Land_HBarrier_5_F",[26.0127,-2.29639,0],90,1,0,[0,-0],"","",true,false], 
	["Land_HBarrier_5_F",[26.0313,9.00684,-9.53674e-007],90,1,0,[0,-0],"","",true,false]
];
 
_gamelogic = CENTER;
_towns = nearestLocations [getPosATL _gamelogic, ["NameVillage","NameCity","NameCityCapital"], 25000]; 
_RandomTownPosition = position (_towns select (floor (random (count _towns))));
 
_m = createMarker [format ["mrk%1",random 100000],_RandomTownPosition];
_m setMarkerShape "ELLIPSE";
_m setMarkerSize [900,900];
_m setMarkerBrush "BDiagonal";
_m setMarkerAlpha 0.0;
_m setMarkerColor "ColorGUER";
 
_pos = getMarkerPos _m;
 
_randPos = [_pos, 25, 35, 10, 0, 0.5, 0] call BIS_fnc_findSafePos;
_cargo = "Land_Bunker_01_HQ_F" createVehicle _randPos;
 
[_randPos, random 360, hq1 ] call BIS_fnc_objectsMapper;
 
_randPos14 = _cargo getRelPos [9, 12];
 
_mg13 = createVehicle ["O_GMG_01_high_F", _randPos14, [], 0, "CAN_COLLIDE"];
 
_mgguy13 = [_randPos14, EAST, ["O_Soldier_F"],[],[],[],[],[],232] call BIS_fnc_spawnGroup;
 
((units _mgguy13) select 0) moveInGunner _mg13;
 
// Spawning a couple of infantry groups to defend the HQ.
// *********************************************************************
 
_hqdef2 = _cargo getRelPos [-96, 256];
 
_group = [_hqdef2, EAST, configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfSquad_Weapons"] call BIS_fnc_spawnGroup;
 
private _buildingPositions = _cargo buildingPos -1;
private _buildingPosition = [0,0,0];
if (!(_buildingPositions isEqualTo [])) then {
    {
        if (_buildingPositions isEqualTo []) exitWith {};
        _buildingPosition = selectRandom _buildingPositions;
        _x setPos _buildingPosition;
		_x disableAI 'PATH';
        _buildingPositions deleteAt (_buildingPositions find _buildingPosition);
    } forEach (units _group);
};
 
_hqdef3 = _cargo getRelPos [96, 23];
 
_group99 = [_hqdef3, EAST, configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Infantry" >> "OIA_InfSquad_Weapons"] call BIS_fnc_spawnGroup;
 
[_group99, getPos _cargo, 300] call bis_fnc_taskPatrol;
 
_randPos399 = [_pos , 0, 600, 12, 0, 0.3, 0] call BIS_fnc_findSafePos;
 
_officer = [_randPos399, EAST, ["O_officer_F"],[],[],[],[],[],232] call BIS_fnc_spawnGroup;
((units _officer) select 0) setVehicleVarName "man1"; man1 = ((units _officer) select 0);
((units _officer) select 0) setpos (_cargo buildingpos 2);
((units _officer) select 0) disableAI 'PATH';

This code will take an existing building that was placed on the map in the editor and then replace it with a simple object. But it will not match the rotation of the building, this needs a bit more work.

_heli = "Land_i_Shed_Ind_F" createVehicleLocal [15407.3,17302.4,-9.53674e-006];
_position = getPosWorld _heli;
_vectorDirUp = [vectorDir _heli, vectorUp _heli];
_model = getModelInfo _heli select 1;
deleteVehicle _heli;
_simpleHeli = createSimpleObject [_model, _position];
_simpleHeli setVectorDirAndUp _vectorDirUp;

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.