Decorating a base in Arma 3 is a lot of fun. Here is some useful code to help out with this.
Spawn an LAU-68/A 70mm Rocket pod on a camp table.
1 2 3 | _pos261 = [0,0,0]; _tree261 = createSimpleObject ["a3\weapons_f_epc\Ammo\Rocket_Pod_02_F.p3d", _pos261]; _tree261 attachTo [t3,[0,0,0.70]]; |
Run this code in initServer.sqf and this will work just fine. Name the camp table t3 and this will work.
The code below will replace all H barriers with Green H barriers in an 800m radius around a certain location. This is very nice.
1 2 3 4 5 6 7 8 | { _dir= getDir _x; _pos = getPosASL _x; _x hideObjectGlobal TRUE; _new = createVehicle ["Land_HBarrier_01_big_4_green_F", ASLToAGL _pos,[],0,"can_collide"]; _new setDir _dir; [_new,true] call BIS_fnc_replaceWithSimpleObject; } foreach (nearestTerrainObjects [[11501.3,17742.2,0],[],800] select {getModelInfo _x #0 in ["hbarrier_big_f.p3d"]}); |
Run this replacement code in a function set as PreInit and make sure it is the first code run in the mission.
This is how to do it. Set the function as PreInit = 1; in the CfgFunctions.hpp and then the code will run in PreInit which is a hundred times faster. But you CANNOT use the sleep command in there, so be careful with functions are called in PreInit.
1 2 3 | class replace{ PreInit = 1; }; |
Spawn a cruise missile and attach it to a table named t2.
1 2 | private _tree36 = createSimpleObject ["\A3\Weapons_F_Destroyer\Ammo\Missile_Cruise_01_F.p3d", [0,0,0], true]; _tree36 attachTo [t2,[0,1.1,0.60]]; |
This makes for a nice little decoration for the players to look at.
Spawn an RHS tank on a table as a little model.
1 2 3 4 | private _obj = createSimpleObject ["\rhsusf\addons\rhsusf_m1a2\m1a2v1_tuskii", [0,0,0], true]; _obj attachTo [t1,[0,0,0.54]]; _obj setDir 180; _obj setObjectScale 0.1; |
Name the camp table t1 and then this will spawn a nice little model tank.
These code samples should be very useful for anyone who wants a nicely decorated base and to make use of the new SetObjectScale command. Which does work on a dedicated server.