Archive for category Script Examples

Collecting Inventory Items

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"

No Comments

HESCO Wall Classnames and Images

HESCO Classnames

(click image to zoom)

No Comments

Random Item on Random Unit AddAction

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!";
};

No Comments

Disable sidemissions with SecOps Manager (SOM)

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;

No Comments

Stop a UAV from attacking on its own

Put this in the UAV’s init field:

this disableAI "AUTOTARGET"; this disableAI "TARGET"; this setCombatMode "BLUE"; this setBehaviour "CARELESS"; this flyInHeight 500;

No Comments