Jump to content
Sign in to follow this  
Salutesh

[WIP] Scavenge System - Detecting of cursorObject not working like inteded for building interior objects?!

Recommended Posts

Hello Arma Community!

 

I am stuck with a problem on a system that i am building up with some mates.

The system allows the players to interact with any kind of map objects if there is a configuration entry for this model.

https://github.com/salutesh/Exile_Scavenge

 

My problem so far is that if a object is inside a building/house the action is not be displayed even if the object model is the cursorObject.

For objects outside of buildings/houses is working just fine.

The only way i can bring up the options is to remove the distance condition between object and player but in this way the player cant interact with objects from a very huge distance.

This is my code for the action itself:

private _holdActionID =  0;
private _holdActionIDs = [];

{
	private _textInfo = getText (_x >> "text");
	private _actioniconInfo = getText (_x >> "icon");
	private _idleiconInfo = getText (_x >> "icon");
	private _modelInfo = getArray (_x >> "models");
	private _itemInfo = getArray (_x >> "items");
	private _objectsList = missionNamespace getVariable ["ExileClientSavengedObjects", []];
	private _condition = format ["(((getModelInfo cursorObject) select 0) in %1 && {player distance2D cursorObject < 5} && !(cursorObject in (missionNamespace getVariable ['ExileClientSavengedObjects', []])) && (player getVariable ['CanScavenge', true]) && (vehicle player == player))", _modelInfo];
	private _configClassName = configName _x;

	_holdActionID =
	[
		player, _textInfo,	_actioniconInfo, _idleiconInfo,	_condition,	"_caller distance _target < 5",	{},
		{
			private _progressTick = _this select 4;
			if (_progressTick % 2 == 0) exitwith {};
			playsound3d [((getarray (configfile >> "CfgSounds" >> "Orange_Action_Wheel" >> "sound")) param [0,""]) + ".wss",player,false,getposasl player,1,0.9 + 0.2 * _progressTick / 24];
		},
		{
			_configClassName = (_this select 3) select 0;
			[_configClassName] call ExileExpansionClient_system_scavenge_action_conditionEvents;
		},
		{},
		[_configClassName], 0.5, 0, false
	] call ExileExpansionClient_gui_holdActionAdd;

	_holdActionIDs pushBack _holdActionID;
} forEach ("true" configClasses (missionConfigFile >> "CfgExileScavenge"));

player setVariable ["ExileScavangeActionIDs", _holdActionIDs];

So far i tested distance and distance2D for the condition but its still only working for objects outside of buildigs.

The action itself is a holdaction.

  • Like 1

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
Sign in to follow this  

×