Jump to content
drahcir_dier

Activating scripts via hitpoints

Recommended Posts

Hi All,

 

I am in the process of developing my first custom building mod and would like to include the ability to breach a locked door by shooting out the latch.

 

On the surface this should be fairly straight forward; Place a hitpoint around the door handle / lock area, and when that hit point reaches >0.95, use a "this setVariable [format('BIS_Disabled_Door_%1',_door),0,true];" statement to allow the locked door to open.

 

Unfortunately, while I'm fully up to speed on linking Hitpoints to animation sources, for the breaking of windows etc, I have not been able to find how to use a hitpoint to activate a script statement.

 

Any tips?

 

Share this post


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

Hi All,

 

I am in the process of developing my first custom building mod and would like to include the ability to breach a locked door by shooting out the latch.

 

On the surface this should be fairly straight forward; Place a hitpoint around the door handle / lock area, and when that hit point reaches >0.95, use a "this setVariable [format('BIS_Disabled_Door_%1',_door),0,true];" statement to allow the locked door to open.

 

Unfortunately, while I'm fully up to speed on linking Hitpoints to animation sources, for the breaking of windows etc, I have not been able to find how to use a hitpoint to activate a script statement.

 

Any tips?

 

I seem to remember a script and/or addon being available that simulated a similar thing but on all doors that opened when shot. However, I can't for the life of me find the damn addon now. I'll edit this post if I find it...

EDIT: After a quick Google search I found this. Out of all the search results thats the closest thing to what you're describing so perhaps its code holds the key? It may function in a different way to how you plan to code your solution but its worth checking out if only for a point of reference. 

Share this post


Link to post
Share on other sites

the hitpoints required also a firegeometry lod for works corectly 😉

 

and define the script used in class useractions 😉

Share this post


Link to post
Share on other sites
On 9/17/2021 at 2:30 AM, Jackal326 said:

I seem to remember a script and/or addon being available that simulated a similar thing but on all doors that opened when shot. However, I can't for the life of me find the damn addon now. I'll edit this post if I find it...

EDIT: After a quick Google search I found this. Out of all the search results thats the closest thing to what you're describing so perhaps its code holds the key? It may function in a different way to how you plan to code your solution but its worth checking out if only for a point of reference. 

 

Thanks for that; However that mod appears to work on the nearest door, rather than the specific door a player may be looking at / attempting to breach. I'd like the locking / breaching behaviour to be intrinsic to the building itself.

 

12 hours ago, cervantes said:

the hitpoints required also a firegeometry lod for works corectly 😉

 

and define the script used in class useractions 😉

 

I'm aware of how the hitpoint /fire geometry system works; As noted in the original post, I've already implemented breakable windows in my building. However I am not sure I understand your reference to the UserAction class. I do not intend for breaching to occur via the context menu / user action system that is normally used for opening or closing the doors. Rather, I'd like to use the hitpoint to toggle the BIS_disable_door variable to allow the door to be opened once the appropriate area is shot out. 

 

 

Share this post


Link to post
Share on other sites

you can be add action in UserAction class

on the wanted memorie point.

 

  class UserActions
  {
   class Breach
   {
    onlyforplayer = 1;
    displayName = "Breach";
    position = "Breach_memorie_point";
    radius = 9;
    condition = "this animationPhase 'DoorRotation' <= 0";
    statement = "[this] exec ""\path\path\script.sqs""";
   };

Share this post


Link to post
Share on other sites

Thank you for the replies to this topic. The reason I was against the UserAction method was because I want players to have to manually shoot out the lock. Context menu actions are too easy.

 

For future generations, I managed to achieve the behaviour I was after simply by placing a hitpoint at the lock location of the door, and adding the following conditional to my door opening script:

 

    // Check if door has been breached
    if ((_structure getHitPointDamage (format ["Door_%1_handle_hitpoint", _door])) > 0.95) then
    {
        _structure setVariable [format ["bis_disabled_Door_%1", _door], 0, true];
    };

 

The realisation dawned that I did not need the "bis_disabled_Door_%1" variable toggled until a player actually TRIES to open the door. It doesn't have to trigger the moment the hitpoint takes damage. Duh .....

 

Thanks again 🙂 

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

×