Arma 3のスクリプトとかミッション作成とか

Arma3のミッション作成とスクリプティング

intel回収スクリプト

intel回収を演出するスクリプト

intelにしたいオブジェクトのinit欄に呼び出しコマンドをコピペして使用してください。
intel回収時にキャラクターがintelを拾うアニメーションを実行します。

コードをダブルクリックすると全選択できます。

通常版

/* ------------------------------------------------------------------------------------------------
Script File: collectIntel.sqf

Description:
- Intelにしたいオブジェクトを回収可能にするスクリプト
- 回収時にアニメーションが実行されます

Parameter(s):
- _intel	: <OBJECT> アクションをアタッチするオブジェクト

Example:
- [this] call compile preprocessFileLineNumbers "collectIntel.sqf"

Returns:
- Nothing

Author: 
- Kirimochi.S
------------------------------------------------------------------------------------------------ */
params ["_intel"];

private _actionTitle = "<t <t size='1.5' color='#ffe100'><img image='\a3\ui_f\data\IGUI\Cfg\Actions\take_ca.paa'/> Collect Intel</t>";
private _actionCond = "true"; // 回収アクションを表示するための条件

KS_fnc_GotIntel = {
	params ["_caller"];
	/* Intal回収時に実行したいコードがあれば以下に記述する */
	[format ["%1がIntelを回収した",name _caller]] remoteExec ["hint",[0,-2] select isDedicated,true];
};

KS_fnc_takeIntel = {
	params ["_intel", "_unit"];

	private _posture = stance _unit;
	private _anim = "";

	switch (_posture) do {
		case "STAND":
		{
			private _wpn = ["non", "rfl", "lnr", "pst", "bnc"] param [["", primaryWeapon _unit, secondaryWeapon _unit, handgunWeapon _unit, binocular _unit] find currentWeapon _unit,"non"];
			switch (_wpn) do {
				case "non": { _anim = "AinvPercMstpSnonWnonDnon_Putdown_AmovPercMstpSnonWnonDnon"; };
				case "rfl": { _anim = "AinvPercMstpSrasWrflDnon_Putdown_AmovPercMstpSrasWrflDnon"; };
				case "lnr": { _anim = "AinvPercMstpSrasWlnrDnon_Putdown_AmovPercMstpSrasWlnrDnon"; };
				case "pst": { _anim = "AinvPercMstpSrasWpstDnon_Putdown_AmovPercMstpSrasWpstDnon"; };
				case "bnc": { _anim = "AinvPercMstpSoptWbinDnon_Putdown_AmovPercMstpSoptWbinDnon"; };
			};
		};
		case "CROUCH":
		{
			private _wpn = ["non", "rfl", "lnr", "pst", "bnc"] param [["", primaryWeapon _unit, secondaryWeapon _unit, handgunWeapon _unit, binocular _unit] find currentWeapon _unit,"non"];
			switch (_wpn) do {
				case "non": { _anim = "AinvPknlMstpSnonWnonDnon_Putdown_AmovPknlMstpSnonWnonDnon"; };
				case "rfl": { _anim = "AinvPknlMstpSrasWrflDnon_Putdown_AmovPknlMstpSrasWrflDnon"; };
				case "lnr": { _anim = "AinvPknlMstpSrasWlnrDnon_Putdown_AmovPknlMstpSrasWlnrDnon"; };
				case "pst": { _anim = "AinvPknlMstpSrasWpstDnon_Putdown_AmovPknlMstpSrasWpstDnon"; };
				case "bnc": { _anim = "AinvPknlMstpSoptWbinDnon_Putdown_AmovPknlMstpSoptWbinDnon"; };
			};
		};
		case "PRONE":
		{
			private _wpn = ["non", "rfl", "lnr", "pst", "bnc"] param [["", primaryWeapon _unit, secondaryWeapon _unit, handgunWeapon _unit, binocular _unit] find currentWeapon _unit,"non"];
			switch (_wpn) do {
				case "non": { _anim = "AinvPpneMstpSnonWnonDnon_Putdown_AmovPpneMstpSnonWnonDnon"; };
				case "rfl": { _anim = "AinvPpneMstpSrasWrflDnon_Putdown_AmovPpneMstpSrasWrflDnon"; };
				case "lnc": { _anim = "AinvPpneMstpSnonWnonDnon_Putdown_AmovPpneMstpSnonWnonDnon"; };
				case "pst": { _anim = "AinvPpneMstpSrasWpstDnon_Putdown_AmovPpneMstpSrasWpstDnon"; };
				case "bnc": { _anim = "AinvPpneMstpSoptWbinDnon_Putdown_AmovPpneMstpSoptWbinDnon"; };
			};
		};
		default {};
	};

	if !(_anim isEqualTo "") then {
		_unit playMove _anim;
		waitUntil {animationState _unit == _anim || !alive _unit};
		waitUntil {animationState _unit != _anim || !alive _unit};
		if (alive _unit) then {
			[_intel] remoteExec ["DeleteVehicle",2];
		};
	} else {
		[_intel] remoteExec ["DeleteVehicle",2];
	};
};

_intel addaction [
	_actionTitle,
	{
		params ["_target", "_caller", "_actionId", "_arguments"];
		[_target, _caller] call KS_fnc_takeIntel;
		[_caller] call KS_fnc_GotIntel;
	},
	nil,8,true,true,"",_actionCond,3
];

_intel allowDamage false;

nil

ACE3対応版

/* ------------------------------------------------------------------------------------------------
Script File: collectIntel.sqf

Description:
- Intelにしたいオブジェクトを回収可能にするスクリプト
- 回収時にアニメーションが実行されます

Parameter(s):
- _intel	: <OBJECT> アクションをアタッチするオブジェクト

Example:
- [this] call compile preprocessFileLineNumbers "collectIntel.sqf"

Returns:
- Nothing

Author: 
- Kirimochi.S

Required Addon
- ACE3
------------------------------------------------------------------------------------------------ */
params ["_intel"];

private _actionTitle = "<t <t size='1.5' color='#ffe100'><img image='\a3\ui_f\data\IGUI\Cfg\Actions\take_ca.paa'/> Collect Intel</t>";
private _actionCond = "true"; // 回収アクションを表示するための条件

KS_fnc_GotIntel = {
	params ["_caller"];
	/* Intal回収時に実行したいコードがあれば以下に記述する */
	[format ["%1がIntelを回収した",name _caller]] remoteExec ["hint",[0,-2] select isDedicated,true];
};

KS_fnc_takeIntel = {
	params ["_intel", "_unit"];

	private _posture = stance _unit;
	private _anim = "";

	switch (_posture) do {
		case "STAND":
		{
			private _wpn = ["non", "rfl", "lnr", "pst", "bnc"] param [["", primaryWeapon _unit, secondaryWeapon _unit, handgunWeapon _unit, binocular _unit] find currentWeapon _unit,"non"];
			switch (_wpn) do {
				case "non": { _anim = "AinvPercMstpSnonWnonDnon_Putdown_AmovPercMstpSnonWnonDnon"; };
				case "rfl": { _anim = "AinvPercMstpSrasWrflDnon_Putdown_AmovPercMstpSrasWrflDnon"; };
				case "lnr": { _anim = "AinvPercMstpSrasWlnrDnon_Putdown_AmovPercMstpSrasWlnrDnon"; };
				case "pst": { _anim = "AinvPercMstpSrasWpstDnon_Putdown_AmovPercMstpSrasWpstDnon"; };
				case "bnc": { _anim = "AinvPercMstpSoptWbinDnon_Putdown_AmovPercMstpSoptWbinDnon"; };
			};
		};
		case "CROUCH":
		{
			private _wpn = ["non", "rfl", "lnr", "pst", "bnc"] param [["", primaryWeapon _unit, secondaryWeapon _unit, handgunWeapon _unit, binocular _unit] find currentWeapon _unit,"non"];
			switch (_wpn) do {
				case "non": { _anim = "AinvPknlMstpSnonWnonDnon_Putdown_AmovPknlMstpSnonWnonDnon"; };
				case "rfl": { _anim = "AinvPknlMstpSrasWrflDnon_Putdown_AmovPknlMstpSrasWrflDnon"; };
				case "lnr": { _anim = "AinvPknlMstpSrasWlnrDnon_Putdown_AmovPknlMstpSrasWlnrDnon"; };
				case "pst": { _anim = "AinvPknlMstpSrasWpstDnon_Putdown_AmovPknlMstpSrasWpstDnon"; };
				case "bnc": { _anim = "AinvPknlMstpSoptWbinDnon_Putdown_AmovPknlMstpSoptWbinDnon"; };
			};
		};
		case "PRONE":
		{
			private _wpn = ["non", "rfl", "lnr", "pst", "bnc"] param [["", primaryWeapon _unit, secondaryWeapon _unit, handgunWeapon _unit, binocular _unit] find currentWeapon _unit,"non"];
			switch (_wpn) do {
				case "non": { _anim = "AinvPpneMstpSnonWnonDnon_Putdown_AmovPpneMstpSnonWnonDnon"; };
				case "rfl": { _anim = "AinvPpneMstpSrasWrflDnon_Putdown_AmovPpneMstpSrasWrflDnon"; };
				case "lnc": { _anim = "AinvPpneMstpSnonWnonDnon_Putdown_AmovPpneMstpSnonWnonDnon"; };
				case "pst": { _anim = "AinvPpneMstpSrasWpstDnon_Putdown_AmovPpneMstpSrasWpstDnon"; };
				case "bnc": { _anim = "AinvPpneMstpSoptWbinDnon_Putdown_AmovPpneMstpSoptWbinDnon"; };
			};
		};
		default {};
	};

	if !(_anim isEqualTo "") then {
		_unit playMove _anim;
		waitUntil {animationState _unit == _anim || !([_unit] call ace_common_fnc_isAwake)};
		waitUntil {animationState _unit != _anim || !([_unit] call ace_common_fnc_isAwake)};
		if ([_unit] call ace_common_fnc_isAwake) then {
			[_intel] remoteExec ["DeleteVehicle",2];
		};
	} else {
		[_intel] remoteExec ["DeleteVehicle",2];
	};
};

_intel addaction [
	_actionTitle,
	{
		params ["_target", "_caller", "_actionId", "_arguments"];
		[_target, _caller] call KS_fnc_takeIntel;
		[_caller] call KS_fnc_GotIntel;
	},
	nil,8,true,true,"",_actionCond,3
];

_intel allowDamage false;

nil