Jump to content
Sign in to follow this  
OMAC

hideOnUse for addAction broken?

Recommended Posts

For the life of me, I cannot get the hideOnUse option for addAction to work.  I have been resorting to scripting my own removeAction to solve the problem. 

 

HideOnUse will not work with this code:

 

player addAction ["Retake control", "retain.sqf", nil, 0, false, true, "", "getDammage tank < 0.4"];

 

Can anyone get the hideOnUse to work as expected without resorting to scripting?  Is this a bug or am I doing something wrong?

 

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

Share this post


Link to post
Share on other sites

Ok, thanks.  I must be doing something wrong, but I have no idea what.  Do you see anything obviously wrong with the addAction code I have above?

Share this post


Link to post
Share on other sites

I used your code replaced condition and script obviously. Are you saying that the action menu stays open after you activated the item? If this is the case then I would look elsewhere like controls preset or key bindings or maybe even mods

Share this post


Link to post
Share on other sites

The added action stays in Action menu after the action is used.  I want that action to be removed from Action menu after it is used.

Share this post


Link to post
Share on other sites
1 minute ago, OMAC said:

The added action stays in Action menu even after the action is used.  I want that action to be removed from Action menu after it is used.

 

Does the scroll down action menu close or stay open?

Share this post


Link to post
Share on other sites

It closes after action use, but the darn action is still there when I use action menu (scroll down) again.

Share this post


Link to post
Share on other sites

So to actually remove the added action from the action menu, removeAction must be used?  Looks that way.

Share this post


Link to post
Share on other sites

Yes, hideOnUse means hide menu after click not item. If you change it to true you can see what is the opposite.

Share this post


Link to post
Share on other sites

Ok, thanks.  BI should consider adding an option to addAction that removes the added action automatically upon use.....

 

player addAction ["Retake control", "{[_x] joinSilent group player;} foreach units tgrp; _this select 0 removeAction (_this select 2);", nil, 0, false, true, "", "getDammage tank < 0.4"];

 

^^ An example of code that will remove the action upon use.  Could be a nice addition to Biki page....

Share this post


Link to post
Share on other sites
6 minutes ago, OMAC said:

Ok, thanks.  BI should consider adding an option to addAction that removes the added action automatically upon use.....

 

player addAction ["Retake control", "{[_x] joinSilent group player;} foreach units tgrp; _this select 0 removeAction 0;", nil, 0, false, true, "", "getDammage tank < 0.4"];

 

^^ An example of code that will remove the action upon use.  Could be a nice addition to Biki page....


you can do this yoursef. Put this line 1st line in script activated from action

_this select 0 removeAction (_this select 2);

Done. Cannot be more easier if one tries :)

Share this post


Link to post
Share on other sites

note that the actual id of the action is passed into the code that is executed by the action. although using _unit removeAction 0 might get you the right one if there aren't many around, it's better to use the provided id to be safe.

 

EDIT: damn, too slow for KK ninja moves

Share this post


Link to post
Share on other sites

^^ Yep.  :thumbsup:

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  

×