Jump to content
Mirek

[SOLVED] How to remove an default action?

Recommended Posts

I have a TIOW mission, where i am using some hangar doors "TIOW_Hangar_01_Door_closed" as decoration. Problem is they have an action to open, and i dont want the players to be able to open them. I tried  "ths removeaction 0" removeallactions this" and  i tried disabling simulation.  I found the action source:  rYG3Zh7.png but have no idea what to do with it.

 

 

Share this post


Link to post
Share on other sites

Maybe you can set the hangar as a static object or use the lock doors module to just lock the doors  :thumbsup:

  • Like 1

Share this post


Link to post
Share on other sites

Well, most probably you could get away with just replacing the statement variable with some empty string "". If I am not mistaken, this statement is what is called when one tries to execute the action. So, if you set it to an empty string nothing will happen.

 

Alternatively, you could try to delete the whole action (I believe this should be inside some scope - { ... }) which hopefully will just make it unavailable to the user(s) (plus the AI).

 

I haven't tested any of the two propositions, so please treat them with caution. Additionally, if you delete the action (or replace the statement variable) the action will be unavailable for all objects of the same type (those hangar doors of yours). If this is an issue then another solution is needed.

 

Please let us know if this helped or not, or if you have further questions.

Edited by ZaellixA
Corrected some expression
  • Like 1

Share this post


Link to post
Share on other sites
3 hours ago, ZaellixA said:

Well, most probably you could get away with just replacing the statement variable with some empty string "". If I am not mistaken, this statement is what is called when one tries to execute the action. So, if you set it to an empty string nothing will happen.

Better replace it with a hint that door is locked.

  • Like 1

Share this post


Link to post
Share on other sites

You can try something like:

inGameUISetEventHandler ["Action", "if (_this #0 isKindOf 'yourHangarTypeHere' && _this #4 == 'open door') then{ hint 'this door is locked'; true} else {false}"];

 

you need to replace yourHangarTypeHere by the type of your hangar (I don't know your mod). Something like Land_MilOffices_V1_F  .

You can find it by opening console and writing in one of the watch lines: typeOf cursorObject  after pointing the hangar in preview.

Mind for single quote (') and double quote (").

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
25 minutes ago, pierremgi said:

You can try something like:

inGameUISetEventHandler ["Action", "if (_this #0 isKindOf 'yourHangarTypeHere' && _this #4 == 'open door') then{ hint 'this door is locked'; true} else {false}"]; 

 

you need to replace yourHangarTypeHere by the type of your hangar (I don't know your mod). Something like Land_MilOffices_V1_F  .

You can find it by opening console and writing in one of the watch lines: typeOf cursorObject  after pointing the hangar in preview.

Mind for single quote (') and double quote (").

Absolutely amazing!  Thanks a million.

  • Like 1

Share this post


Link to post
Share on other sites

Sorry to bring this old post back, but I would like to know if it is possible to use what pierremgi posted above in a house with several doors, but removing the command for only one of those doors.

Thanks a lot.

Share this post


Link to post
Share on other sites
1 hour ago, Cigs4 said:

but removing the command for only one of those doors.

 

You could use the Edit Terrain Object module to lock the door. The action will still be there, but the door will just rattle a bit and not open.

 

Place the module on the building. In 3D view with the module selected, all doors will be identified with a number. Open the module settings, and change the state of the relevant doors (closed, locked, or open).

UAWCnLs.jpg

  • Like 3

Share this post


Link to post
Share on other sites

 

Thank you very much, Harzach!
But I was wondering if it's possible to use any code to remove the action, the issue is not about locking the door.
The code above does it, but remove the action from all doors in the building.
 
Thanks again! 👍

Share this post


Link to post
Share on other sites
34 minutes ago, Cigs4 said:

The code above does it

 

The code above does not remove the action, it replaces its result (the door opening) with a hint saying it is locked. Essentially the same as using the module.

  • Like 1

Share this post


Link to post
Share on other sites

What exactly are you hoping to do? There may be other avenues to pursue.

Share this post


Link to post
Share on other sites

Hi,
yes it is possible to interrupt action for specific doors. If you find the building in config viewer, you can see that in "UserAction" every door action has priority number set to 11 (not sure about moded buildings). The engine automatically decreases every action with same priority number by -0.001. That means that door can be identified by it´s priority number -> door1 open = priority 11, close = priority 10.999, door2 open = priority 10.998, close = priority 10.997 and so on...
I´ve made simple code that tells you the priority of door action you just performed so you can simply find the number you need. Sadly i can´t think about any other way to achieve what you desire. Default user actions like heal, open doors, get in vehicle and so on are not possible to remove so this is the only way how to interrupt it. 

Code for example that "locks" the main door:
change position of wantedBuilding and if you want different doors to be locked, change _priority == number according to doors you interacting with.

wantedBuilding = nearestBuilding [6005.66,10592.8,0];
inGameUISetEventHandler ["Action", "params ['_target', '', '', '', '', '_priority', '', '', '', '', ''];_forbidAction = FALSE;_condition = (_target == wantedBuilding AND {_priority == 11});hint format ['Building Locked:%1\nAction priority:%2\nAction is interrupted:%3',_target == wantedBuilding,_priority,_condition];if _condition then {_forbidAction = TRUE};_forbidAction"];
  • Thanks 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

×