Jump to content
BadHabitz

BIS_fnc_initInspectable to run a script/command

Recommended Posts

I really like what BIS_fnc_initInspectable can be used to for when I'm making the missions for my unit. I like to add objects that they actually need to interact with as objectives. But what I'd really like to figure out is how to be able to use that function, so that when it's used it will be able to run a script or run a command such as deleteVehicle. That way I can use it with a trigger, or other things.

The problem on my end is my scripting skills rank somewhere beneath complete novice. So I'm here begging the genius scripters of the community to give me a hand. Thanks.

 

 

Share this post


Link to post
Share on other sites

BIS_fnc_initInspectable is nothing more than a holdAction that when used displays a ui picture and text. If you do not need the ui part then use BIS_fnc_holdActionAdd instead, which will make it possible to supply your own code for the different parts of the action ( start, progress, completed, interrupted ) as well as the the looks of the on screen icon.

private _actionID = [
	//--- 0: Target
	player,

	//--- 1: Title
	"Some action text",

	//--- 2: Idle Icon
	"\a3\Ui_f\data\IGUI\Cfg\HoldActions\holdAction_search_ca.paa",

	//--- 3: Progress Icon
	"\a3\Ui_f\data\IGUI\Cfg\HoldActions\holdAction_search_ca.paa",

	//--- 4: Condition Show
	"_this distance _target < 3",

	//--- 5: Condition Progress
	nil,

	//--- 6: Code Start
	{
		hint "Action started";
	},

	//--- 7: Code Progress
	{
		_progressTick = _this select 4;
		hint format[ "action progress = %1", _progressTick ];
	},

	//--- 8: Code Completed
	{
		hint "Action completed"
	},

	//--- 9: Code Interrupted
	{
		hint "Action Interrupted"
	},

	//--- 10: Arguments
	[],

	//--- 11: Duration
	0.5,

	//--- 12: Priority
	nil,

	//--- 13: Remove When Completed
	false
] call bis_fnc_holdActionAdd;

 

  • Like 1

Share this post


Link to post
Share on other sites
15 hours ago, Larrow said:

BIS_fnc_initInspectable is nothing more than a holdAction that when used displays a ui picture and text. If you do not need the ui part then use BIS_fnc_holdActionAdd instead, which will make it possible to supply your own code for the different parts of the action ( start, progress, completed, interrupted ) as well as the the looks of the on screen icon.



private _actionID = [ //--- 0: Target player, //--- 1: Title "Some action text", //--- 2: Idle Icon "\a3\Ui_f\data\IGUI\Cfg\HoldActions\holdAction_search_ca.paa", //--- 3: Progress Icon "\a3\Ui_f\data\IGUI\Cfg\HoldActions\holdAction_search_ca.paa", //--- 4: Condition Show "_this distance _target < 3", //--- 5: Condition Progress nil, //--- 6: Code Start { hint "Action started"; }, //--- 7: Code Progress { _progressTick = _this select 4; hint format[ "action progress = %1", _progressTick ]; }, //--- 8: Code Completed { hint "Action completed" }, //--- 9: Code Interrupted { hint "Action Interrupted" }, //--- 10: Arguments [], //--- 11: Duration 0.5, //--- 12: Priority nil, //--- 13: Remove When Completed false ] call bis_fnc_holdActionAdd;

 

Thanks Larrow. holdActionAdd is something I do a fair amount of already, so what I'm looking for is the UI effect of the initInspectable that can also run a command once inspected. If I could get the UI element of initInspectable to popup as part of a holdActionAdd I think that'd be about perfect. 

Share this post


Link to post
Share on other sites
23 hours ago, BadHabitz said:

so what I'm looking for is the UI effect of the initInspectable that can also run a command once inspected

Then that is no different to the thread you replied to the other day about leaflets. Instead of creating a leaflet that itself calls BIS_fnc_initInspectable you call it yourself providing correct parameters...

[
	_objectToInspect, //object holdAction is placed on
	[
		_texture,	//texture for ui and possible object texture see _textureIndex
		_textureIndex,	//( optional ) if >= 0 then texture is also placed on object via _object setObjectTexture[ 0, _texture ]
		_textureRatio	//( optional ) ratio of display picture width ( width = picHeight * 3/4 * _textureRatio )
	],
	_text,	//Text shown when ui read button is used
	_sound	//Sound played when inspected ( display shown )
] call BIS_fnc_initInspectable;

//Possibly store your own data for use when inspected
_objectToInspect setVariable[ "myData", { hint "Object inspected" }, true ];

//Add event for when object is inspected ( client )
[ missionNamespace, "objectInspected", {
	params[ "_object", "_texture", "_text", "_sound", "_textureRatio" ];

	//If _object is ( a reference to some object )
	if ( _object == myObjectReference ) then {
		//Do what ever
		
		//Example of custom data
		_data = _object getVariable[ "myData", {} ];
		call _data;
	};
}] call BIS_fnc_addScriptedEventHandler;

EXAMPLE MISSION MP JIP compatible

  • Thanks 3

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×