Posted: . At: 10:39 AM. This was 6 years ago. Post ID: 12171
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.


Very interesting and useful Arma 3 scripting commands for multiplayer missions.


Arma 3 scripting samples for creating MP missions

This code sample inserted into the initServer.sqf will protect buildings 900m around your base from destruction by retards with a grudge against your server.

{ _x allowdamage false; } foreach (nearestTerrainObjects [crat99,["house"],900]);

Name an object crat99 and then place this code as explained above. This will stop morons blowing up buildings around your base.

Spawn a few trees to decorate your base with this code. This uses the createSimpleObject function.

_pos = getPos tyre1; 	//define a position, close to player
_tree = createSimpleObject ["a3\vegetation_f_exp\Tree\t_Cocos_tall_F.p3d", _pos]; 
_tree setPos [_pos select 0, _pos select 1,18];	//trees spawn below ground, so we move it up by 8 m
 
_pos2 = getPos tyre2; 	//define a position, close to player
_tree2 = createSimpleObject ["a3\vegetation_f_exp\Tree\t_Cocos_tall_F.p3d", _pos2]; 
_tree2 setPos [_pos2 select 0, _pos2 select 1,18];	//trees spawn below ground, so we move it up by 8 m
 
_pos3 = getPos tyre3; 	//define a position, close to player
_tree3 = createSimpleObject ["a3\vegetation_f_exp\Tree\t_Cocos_tall_F.p3d", _pos2];
_tree3 setPos [_pos3 select 0, _pos3 select 1,18];	//trees spawn below ground, so we move it up by 8 m

This is a great way to find a random town to spawn enemies. This is fast and reliable. A very good way to create a random mission.

_gamelogic = CENTER;
Towns = nearestLocations [getPosATL _gamelogic, ["NameVillage","NameCity","NameCityCapital"], 17000];
 
currentAO = Towns call BIS_fnc_selectRandom;
 
Loc = getPos currentAO;

Use this code to hide all map objects in a 900m radius of the object “crat99”.

{ _x HideObjectGlobal true } foreach (nearestTerrainObjects [crat99,[],900]);

Set a BLUFOR skin on the AMV Marshall.

_this setObjectTextureGlobal [0, "A3\Armor_F_Gamma\APC_Wheeled_03\Data\apc_wheeled_03_ext_co.paa"]; 
_this setObjectTextureGlobal [1, "A3\Armor_F_Gamma\APC_Wheeled_03\Data\apc_wheeled_03_ext2_co.paa"]; 
_this setObjectTextureGlobal [2, "A3\Armor_F_Gamma\APC_Wheeled_03\Data\rcws30_co.paa"]; 
_this setObjectTextureGlobal [3, "A3\Armor_F_Gamma\APC_Wheeled_03\Data\apc_wheeled_03_ext_alpha_co.paa"];

Put this code in the initPlayerLocal.sqf and the onPlayerRespawn.sqf files, this will remove stamina and make it more fun for players.

player setCustomAimCoef 0.24; 
player setUnitRecoilCoefficient 0.30;
player enablestamina false;
player setUnitTrait ["camouflageCoef",0.4];
player setUnitTrait ['loadCoef',0.1];

This code will spawn a CAS jet that will patrol around a marker in a 1900m radius.

// Spawn a CAS jet to patrol the AO.
 
_plane = createVehicle ["CUP_O_Su25_RU_3", getMarkerPos("plane"), [], 0, "FLY"];
_pilotguy = [[8748.01,6189.06,-3.05176e-005], EAST, ["O_Pilot_F"],[],[],[],[],[],232] call BIS_fnc_spawnGroup;
 
((units _pilotguy) select 0) moveInDriver _plane;
_wpcas = _pilotguy addWaypoint [getMarkerPos("mkr1"), 0];
_wpcas setWaypointBehaviour "SAFE";
_wpcas setWaypointCombatMode "RED";
_wpcas setWaypointCompletionRadius 1900;

Wait until 3 triggers are activated in a script before proceeding further, this is good to wait until mission requirements are fulfilled before ending the mission.

waitUntil {
	sleep 1;
	((triggeractivated adt) && (triggeractivated tower2) && (triggeractivated man2))
};

This would be a good way to end a SP mission.


Leave a Comment

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