Posted: . At: 8:41 AM. This was 6 years ago. Post ID: 11746
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.


Even more very useful Arma 3 script samples.


Some very good Arma 3 scripting samples

Put this code into the init of a crate to create an Arsenal crate.

this addaction ["Open Virtual Arsenal", { ["Open",true] call BIS_fnc_arsenal; }];

This code in the initPlayerLocal.sqf and onPlayerRespawn.sqf files will remove stamina and weapon sway.

player setCustomAimCoef 0.35;
player setUnitRecoilCoefficient 0.75;
player enablestamina false;
player setUnitTrait ["camouflageCoef",0.4];
player addEventHandler ['HandleRating',{(_this select 0) addRating (0 - (rating (_this select 0)));}];

This code is used in the Orange DLC showcase and allows the player to open a Field Manual entry or read a web page. Just put this in the initPlayerLocal.sqf, then place a TV named BIS_TV1, and a laptop named BIS_laptop1.

BIS_holdActionSFX = (getArray (configFile >> "CfgSounds" >> "Orange_Action_Wheel" >> "sound")) param [0, ""];
BIS_holdActionSFX = BIS_holdActionSFX + ".wss";
BIS_holdActionProgress = 
{
	private _progressTick = _this select 4; 
	if ((_progressTick % 2) == 0) exitwith {}; 
 
	private _coef = _progressTick / 24; 
	playSound3D [BIS_holdActionSFX, player, false, getPosASL player, 1, 0.9 + 0.2 * _coef];
};
 
[BIS_laptop01, localize "STR_A3_Orange_Faction_IDAP_action_article", "\a3\Missions_F_Orange\Data\Img\Showcase_LawsOfWar\action_view_article_ca", "\a3\Missions_F_Orange\Data\Img\Showcase_LawsOfWar\action_view_article_ca", "(_this distance _target < 3) && (isNull (findDisplay 2035))", "isNull (findDisplay 2035)", {}, BIS_holdActionProgress, {BIS_laptop01 say3D "Orange_Read_Article"; [] execVM "article.sqf"}, {}, [], 0.5, nil, false] call BIS_fnc_holdActionAdd;
 
[BIS_TV1, localize "STR_A3_Orange_Faction_IDAP_action_FM", "\a3\Missions_F_Orange\Data\Img\Showcase_LawsOfWar\action_access_fm_ca", "\a3\Missions_F_Orange\Data\Img\Showcase_LawsOfWar\action_access_fm_ca", "(_this distance _target < 3) && (isNull (findDisplay 162))", "isNull (findDisplay 162)", {}, BIS_holdActionProgress, {BIS_TV1 say3D "Orange_Access_FM"; ["InternationalHumanitarianLaw", "Overview", findDisplay 46, localize "STR_A3_Orange_Faction_IDAP_FM_filter_LoW"] call BIS_fnc_openFieldManual}, {}, [], 0.5, nil, false] call BIS_fnc_holdActionAdd;
 
[BIS_laptop1, localize "STR_A3_Orange_Faction_IDAP_action_article", "\a3\Missions_F_Orange\Data\Img\Showcase_LawsOfWar\action_view_article_ca", "\a3\Missions_F_Orange\Data\Img\Showcase_LawsOfWar\action_view_article_ca", "(_this distance _target < 3) && (isNull (findDisplay 2035))", "isNull (findDisplay 2035)", {}, BIS_holdActionProgress, {BIS_laptop1 say3D "Orange_Read_Article"; [] execVM "\a3\Missions_F_Orange\Campaign\Functions\fn_showCampaignArticle.sqf"}, {}, [], 0.5, nil, false] call BIS_fnc_holdActionAdd;

Place a laptop named BIS_laptop01, then create a file named article.sqf, and put this in it.

disableSerialization;
 
[
	[
		["title","Syrian invasion"],
		["meta",["Katherine Bishop",[2035,2,24,11,38],"CET"]],
		["textbold","Insurgent crisis in Syria"],
		["image",["images\heli.jpg","Scene at US base. Photo: Reuters."]],
		["box",["images\tacops.jpg","You won't believe how playing Tac Ops can change your life!"]],
 
		["text","The CSAT invasion of Altis has left the people reeling. This is a whole new crisis that is hitting the war-torn island hard."],
 
		["text","The civilians have suffered under the CSAT invasion, destruction of infrastructure and housing has led to most civilians fleeing the warzone."],
 
		["image",["images\sni.jpg","Sniper at undisclosed location. Photo: US Army."]],
 
		["text","The main base I was stationed at while embedded with US forces was quiet, except for the occasional roar of helicopters, but this will undoubtedly change once the main attack is begun by allied forces. The men are in good spirits, according to Corporal Kelly Smith, member of Alpha Squad, 'they will not know what hit them, we will ram them like a freight train.' This is an example of US superiourity in this region, winning hearts and minds by helping locals and dealing with the many legacies of this nation that has seen far too much war."],
 
		["text","The US forces are aiming to push back against the insurgent invasion and push back the main invasion force to the main airport and destroy their infrastructure. They are also focusing on interception of enemy reinforcements and patrols on the way to the enemy headquarters."],
 
		["text","The main aim of this mission is to destroy enemy installations, whilst avoiding civilian casualties. This is very important. The civilians are on our side, but we must keep it that way. Judge what is actually required to destroy an installation, and minimize collateral damages. Once all installations near the base have been destroyed, move across country and push the enemy forces back towards their main base. If they are contained there, they will be easily overcome. Use of Raven UAV and other air assets for spotting enemy movements will be a very powerful tool for defeating the enemy forces."],
 
		["box",["images\multicam.jpg","Squad heading out to the front lines."]],
 
		["text","Once the enemy are contained, we could setup a front line and hold them there. This will be better than constantly having to find their reinforcements as they are en-route."],
 
		["author",["\a3\Missions_F_Orange\Data\Img\avatar_journalist_ca.paa","Katherine Bishop is a journalist"]]
	]
] call bis_fnc_showAANArticle;

That is the best way to have a briefing and some screenshots to illustrate what the mission is about. Just place the laptop near the Arsenal crate or whatever, so it will not be missed.

Find a random position on an Arma 3 map without any markers at all. Put this code in the initServer.sqf.

_towns = nearestLocations [[worldSize / 2, worldsize / 2, 0], ["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.3;
_m setMarkerColor "ColorOPFOR";
 
_pos = getMarkerPos _m;
 
_loc = text (nearestLocations [_pos, ["Airport", "NameLocal", "NameVillage", "NameCity"],20000] select 1);
 
_markerAO = createMarker ["Area.", position player ];
_markerAO setMarkerPos [4231.82,18056,0];
_markerAO setMarkerShape "ICON";
_markerAO setMarkerColor "colorOPFOR";
_markerAO setMarkerType "Faction_TKA_EP1";
_markerAO setMarkerText format ["Enemy forces near: %1", _loc];
 
_randPos = [_pos , 0, 600, 12, 0, 0.3, 0] call BIS_fnc_findSafePos;

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

// 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;
Lovely sunset in Afghanistan.
Lovely sunset in Afghanistan.

Leave a Comment

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