Jump to content
Leopard20

Using Hold Actions on hidden units (i.e hide unit without hideObject)

Recommended Posts

Hello everyone.

 

Does anyone know a way to add hold actions to hidden units? Unfortunately, when a unit is hidden using hideObject the action doesn't appear anymore. However, if there was a way to hide the unit without using hideObject it would work.

 

My first idea was to use setObjectTexture, but it doesn't hide the unit completely (the unit's face and arms are still visible)

Share this post


Link to post
Share on other sites

Or just add the action to yourself and supply some distance condition.

  • Like 3

Share this post


Link to post
Share on other sites
6 hours ago, HazJ said:

Or just add the action to yourself and supply some distance condition.

Not a bad idea. There's just one tiny problem. I'm creating a script that performs an action on the hidden unit and thus adding the action to the unit is more convenient (you can easily retrieve the unit, i.e. target, using the action parameters). If I add it to the player, I probably should resort to using something like this:

_units = allUnits select {_x distance player < 7 && ([visiblePosition player, getDir player, 60, visiblePosition _x] call BIS_fnc_inAngleSector)};
_units = [_units, [], {_x distance2D player}, "ASCEND"] call BIS_fnc_SortBy;
_unit = _units select 0;

just to get the unit the player is looking at! Doesn't it make the game slow?

  • Like 1

Share this post


Link to post
Share on other sites

What about this one:

//adding this to the "action appear" condition
_unit = cursorObject player;
if !(_unit in WoundedUnits && _unit distance player < 7) then 
{_unit = objNull};
player setVariable ["patient", _unit]}                   

and then using this variable in "condition progress" for further processing.

Share this post


Link to post
Share on other sites

What are you trying to do exactly? When do you want the action to appear? Specifics.

Share this post


Link to post
Share on other sites
18 minutes ago, HazJ said:

What are you trying to do exactly? When do you want the action to appear? Specifics.

Think of it as a healing script. I want to heal the unit.

https://community.bistudio.com/wiki/BIS_fnc_holdActionAdd

What I meant by my previous code is that the action appears when you look at the unit and he's close to you. I use the "patient" variable to later retrieve the unit in the conditionshow, thus eliminating the need to look at the unit all the time and also using it in code progress part.

Share this post


Link to post
Share on other sites

Yeah. That's a good idea. So you can use cursorObject at first but then move. Once stored, in the action show (when looping round) just check the distance. No need for visibility then. In this case. Are you stuck with how to do that or?

  • Thanks 1

Share this post


Link to post
Share on other sites
17 minutes ago, HazJ said:

Yeah. That's a good idea. So you can use cursorObject at first but then move. Once stored, in the action show (when looping round) just check the distance. No need for visibility then. In this case. Are you stuck with how to do that or?

Nope! At least not yet! I just typed all that on my phone. I'll have to check it later on my computer! ;)

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

×