On Demand Artillery Strike
Posted by kylania in Demo Missions, Script Examples on August 25, 2012
This is from Riouken on the BIS forums:
The Grad is artillery you need to create a fire mission and execute it. There is also a demo mission of this available.
// There is a arty logic ingame named arty1; _myBattery = arty1; // We need to make a arty fire mission template _heTemplate = ["IMMEDIATE", "HE", 0, 15]; // We need the postion of the target Above Sea Level. _targetPos = getPosASL target_1; // Here we check and make sure it is range then we exicute the fire mission. if ([_myBattery, _targetPos, _heTemplate select 1] call BIS_ARTY_F_PosInRange) then { [_myBattery, _targetPos, _heTemplate] call BIS_ARTY_F_ExecuteTemplateMission; hint "Firing... Sit back and wait, it will take about 60-90 seconds for the rounds to impact"; } else { hint "Target out of range!"; };
Collecting Inventory Items
Posted by kylania in Script Examples on August 25, 2012
Here are the little evidence items that are available. All except PMC_documents are available in ArmA2 vanilla. PMC of course requires PMC.
Item name – class name
CDF dogtags – CDF_dogtags
Cobalt File – Cobalt_File
Evidence (Dog tags) – EvDogTags
Evidence (File2) – EvKobalt
Evidence (Map) – EvMap
Evidence (Money) – EvMoney
Evidence (File1) – EvMoscow
Evidence (Photos) – EvPhoto
Kostey’s map case – Kostey_map_case
Kostey’s notebook – Kostey_notebook
Kostey’s photos – Kostey_photos
Moscow Bombing File – Moscow_Bombing_File
Evidence (Map) – PMC_documents
To give a player an item:
player addWeapon "EvMoney";
To check if a player has an item:
player hasWeapon "EvMoney"
HESCO Wall Classnames and Images
Posted by kylania in Script Examples on August 25, 2012
Random Item on Random Unit AddAction
Posted by kylania in Script Examples on August 24, 2012
The init will randomly assign each item to a random civilian, assuming there are three of them named civ1, civ2, civ3. It will assign a variable to the player declaring which civ has each item for him.
Each civ is than given three action choices to ask about a map, watch or compass. If the civilian doesn’t have it (the variable isn’t correct) he’ll say he’s got nothing for him. If the variable is correct he’ll say he has the item and give it to the player. You’d of course replace that with whatever task you wanted them to complete.
Might not be the most elegant code, (but kinda is!) but works in single player at last and since everything is local should work as is in multiplayer I think. Â Here’s a step by step explanation of how it all works.
init.sqf + Functions module on map.
init.sqf:
waituntil {!isnil "bis_fnc_init"}; _civs = [civ1, civ2, civ3]; _watchHolder = _civs call BIS_fnc_selectRandom; _civs = _civs - [_watchHolder]; _mapHolder = _civs call BIS_fnc_selectRandom; _civs = _civs - [_mapHolder]; _compassHolder = _civs select 0; player setVariable["watchHolder", _watchHolder]; player setVariable["mapHolder", _mapHolder]; player setVariable["compassHolder", _compassHolder]; // Debug :) hint format["Watch = %1\n\nMap = %2\n\nCompass = %3", player getVariable "watchHolder",player getVariable "mapHolder", player getVariable "compassHolder"];
Init field of each civ unit:
this addAction ["Ask about a watch.","itemCheck.sqf",["watchHolder"]]; this addAction ["Ask about a map.","itemCheck.sqf",["mapHolder"]]; this addAction ["Ask about a compass.","itemCheck.sqf",["compassHolder"]];
itemCheck.sqf:
private ["_item", "_player"]; _npc = _this select 0; _player = _this select 1; _action = _this select 2; _npc removeAction _action; _itemHeld = _this select 3 select 0; _item = switch (_itemHeld) do { case "watchHolder": {"ItemWatch"}; case "mapHolder": {"ItemMap"}; case "compassHolder": {"ItemCompass"}; }; if (_player getVariable _itemHeld == _npc) then { hint "Found it!"; _player addWeapon _item; } else { hint "Sorry, I have nothing for you!"; };
Disable sidemissions with SecOps Manager (SOM)
Posted by kylania in Script Examples on August 24, 2012
Put this in the SOM Module’s init field:
this setVariable ["settings", [[], true, nil, nil, false]];
This would be how to add just the artillery features of SOM:
[["artillery_barrage"],player] call BIS_SOM_addSupportRequestFunc;