Jump to content
Sign in to follow this  
killshot

fnc_fixMBGKillhousesBreaching (Scripting help)

Recommended Posts

Hello everybody!

 

When playing with MBG Killhouses (by Mondkalb) and you breach/destroy a door or penetration point (white x), you are not able to walk through it.

That's because the animationPhase will stay at 0, making it an insivible wall.

 

So I use an "handleDamage"-eventHandler to call a (poor ^^) function to set animationPhase to 1 after breaching damage is given (>0.7).

But this does only work for the doors so far and not for the penetration points, because they are not animated(?)

 

This is what I got now:

fnc_fixMBGKillhousesBreaching = {

_target = _this select 0;
_damage = 0.7;

if ((_target getHitPointDamage "hit1") >= _damage) then {_target setHitPointDamage ["hit1",1]; _target animate ["door1",1];};
if ((_target getHitPointDamage "hit2") >= _damage) then {_target setHitPointDamage ["hit2",1]; _target animate ["door2",1];};
if ((_target getHitPointDamage "hit3") >= _damage) then {_target setHitPointDamage ["hit3",1]; _target animate ["door3",1];};
if ((_target getHitPointDamage "hit4") >= _damage) then {_target setHitPointDamage ["hit4",1]; _target animate ["door4",1];};
if ((_target getHitPointDamage "hit5") >= _damage) then {_target setHitPointDamage ["hit5",1]; _target animate ["door5",1];};
if ((_target getHitPointDamage "hit6") >= _damage) then {_target setHitPointDamage ["hit6",1]; _target animate ["door6",1];};
if ((_target getHitPointDamage "hit7") >= _damage) then {_target setHitPointDamage ["hit7",1]; _target animate ["door7",1];};
if ((_target getHitPointDamage "hit8") >= _damage) then {_target setHitPointDamage ["hit8",1]; _target animate ["door8",1];};
if ((_target getHitPointDamage "hit9") >= _damage) then {_target setHitPointDamage ["hit9",1]; _target animate ["hit9",1];};

};

"hit9" is "breachSegment_1" and the last line of code isn't working this way to fix the "invisible wall".

 

I tried also setHit on it.

 

This is only for object "MBG_Killhouse_2_InEditor" (Killhouse, Medium) - 8 doors and 1 penetration point.

 

This is the config part of (only) this building:

 

    class Land_MBG_Killhouse_2: Land_MBG_Killhouse_1
    {
        model = "\mbg\mbg_killhouses_a3\m\MBG_Killhouse_2.p3d";
        icon = "\mbg\mbg_killhouses_a3\ico\MBG_Killhouse_2_ico_CA.paa";
        mapSize = 16.1;
        ladders[] = {{ "start1","end1" }};
        class AnimationSources
        {
            class Door1
            {
                animPeriod = 1.5;
                source = "user";
            };
            class Door2
            {
                animPeriod = 1.5;
                source = "user";
            };
            class Door3
            {
                animPeriod = 1.5;
                source = "user";
            };
            class Door4
            {
                animPeriod = 1.5;
                source = "user";
            };
            class Door5
            {
                animPeriod = 1.5;
                source = "user";
            };
            class Door6
            {
                animPeriod = 1.5;
                source = "user";
            };
            class Door7
            {
                animPeriod = 1.5;
                source = "user";
            };
            class Door8
            {
                animPeriod = 1.5;
                source = "user";
            };
            class Hit1
            {
                source = "Hit";
                hitpoint = "Hit1";
                raw = 1;
            };
            class Hit2
            {
                source = "Hit";
                hitpoint = "Hit2";
                raw = 1;
            };
            class Hit3
            {
                source = "Hit";
                hitpoint = "Hit3";
                raw = 1;
            };
            class Hit4
            {
                source = "Hit";
                hitpoint = "Hit4";
                raw = 1;
            };
            class Hit5
            {
                source = "Hit";
                hitpoint = "Hit5";
                raw = 1;
            };
            class Hit6
            {
                source = "Hit";
                hitpoint = "Hit6";
                raw = 1;
            };
            class Hit7
            {
                source = "Hit";
                hitpoint = "Hit7";
                raw = 1;
            };
            class Hit8
            {
                source = "Hit";
                hitpoint = "Hit8";
                raw = 1;
            };
            class Hit9
            {
                source = "Hit";
                hitpoint = "Hit9";
                raw = 1;
            };
        };
        class HitPoints
        {
            class Hit1
            {
                armor = 0.02;
                material = 20;
                name = "Hit1";
                visual = "Door1";
                passThrough = 1;
                convexComponent = "Hit1";
                class DestructionEffects{};
            };
            class Hit2: Hit1
            {
                name = "Hit2";
                visual = "Door2";
                convexComponent = "Hit2";
            };
            class Hit3: Hit1
            {
                name = "Hit3";
                visual = "Door3";
                convexComponent = "Hit3";
            };
            class Hit4: Hit1
            {
                name = "Hit4";
                visual = "Door4";
                convexComponent = "Hit4";
            };
            class Hit5: Hit1
            {
                name = "Hit5";
                visual = "Door5";
                convexComponent = "Hit5";
            };
            class Hit6: Hit1
            {
                name = "Hit6";
                visual = "Door6";
                convexComponent = "Hit6";
            };
            class Hit7: Hit1
            {
                name = "Hit7";
                visual = "Door7";
                convexComponent = "Hit7";
            };
            class Hit8: Hit1
            {
                name = "Hit8";
                visual = "Door8";
                convexComponent = "Hit8";
            };
            class Hit9: Hit1
            {
                name = "Hit9";
                visual = "BreachSegment_1";
                convexComponent = "Hit9";
                armor = 0.15;
                material = 20;
                class DestructionEffects
                {
                    class Walls
                    {
                        simulation = "particles";
                        type = "HousePartWall";
                        lifeTime = 0.02;
                        position = "";
                        intensity = 1;
                        interval = 1;
                    };
                };
            };
        };
        class UserActions
        {
            class OpenDoor1
            {
                displayName = "Open Door";
                position = "Door1_AP";
                radius = 2;
                condition = "(this animationPhase ""Door1"" < 0.5) and (this animationPhase ""Door1_BreachAnim"" < 0.7)";
                statement = "this animate [""Door1"",1]; [this, 'Door1_AP', 'MBG_SndSrc_DoorOpen',1.1] execvm 'mbg\mbg_killhouses_a3\s\MPSoundV2.sqf';";
                onlyforplayer = 0;
            };
            class OpenDoor2: OpenDoor1
            {
                position = "Door2_AP";
                condition = "(this animationPhase ""Door2"" < 0.5) and (this animationPhase ""Door2_BreachAnim"" < 0.7)";
                statement = "this animate [""Door2"",1]; [this, 'Door2_AP', 'MBG_SndSrc_DoorOpen',1.1] execvm 'mbg\mbg_killhouses_a3\s\MPSoundV2.sqf';";
            };
            class OpenDoor3: OpenDoor1
            {
                position = "Door3_AP";
                condition = "(this animationPhase ""Door3"" < 0.5) and (this animationPhase ""Door3_BreachAnim"" < 0.7)";
                statement = "this animate [""Door3"",1]; [this, 'Door3_AP', 'MBG_SndSrc_DoorOpen',1.1] execvm 'mbg\mbg_killhouses_a3\s\MPSoundV2.sqf';";
            };
            class OpenDoor4: OpenDoor1
            {
                position = "Door4_AP";
                condition = "(this animationPhase ""Door4"" < 0.5) and (this animationPhase ""Door4_BreachAnim"" < 0.7)";
                statement = "this animate [""Door4"",1]; [this, 'Door4_AP', 'MBG_SndSrc_DoorOpen',1.1] execvm 'mbg\mbg_killhouses_a3\s\MPSoundV2.sqf';";
            };
            class OpenDoor5: OpenDoor1
            {
                position = "Door5_AP";
                condition = "(this animationPhase ""Door5"" < 0.5) and (this animationPhase ""Door5_BreachAnim"" < 0.7)";
                statement = "this animate [""Door5"",1]; [this, 'Door5_AP', 'MBG_SndSrc_DoorOpen',1.1] execvm 'mbg\mbg_killhouses_a3\s\MPSoundV2.sqf';";
            };
            class OpenDoor6: OpenDoor1
            {
                position = "Door6_AP";
                condition = "(this animationPhase ""Door6"" < 0.5) and (this animationPhase ""Door6_BreachAnim"" < 0.7)";
                statement = "this animate [""Door6"",1]; [this, 'Door6_AP', 'MBG_SndSrc_DoorOpen',1.1] execvm 'mbg\mbg_killhouses_a3\s\MPSoundV2.sqf';";
            };
            class OpenDoor7: OpenDoor1
            {
                position = "Door7_AP";
                condition = "(this animationPhase ""Door7"" < 0.5) and (this animationPhase ""Door7_BreachAnim"" < 0.7)";
                statement = "this animate [""Door7"",1]; [this, 'Door7_AP', 'MBG_SndSrc_DoorOpen',1.1] execvm 'mbg\mbg_killhouses_a3\s\MPSoundV2.sqf';";
            };
            class OpenDoor8: OpenDoor1
            {
                position = "Door8_AP";
                condition = "(this animationPhase ""Door8"" < 0.5) and (this animationPhase ""Door8_BreachAnim"" < 0.7)";
                statement = "this animate [""Door8"",1]; [this, 'Door8_AP', 'MBG_SndSrc_DoorOpen',1.1] execvm 'mbg\mbg_killhouses_a3\s\MPSoundV2.sqf';";
            };
            class CloseDoor1
            {
                displayName = "Close Door";
                position = "Door1_AP";
                radius = 2;
                condition = "(this animationPhase ""Door1"" > 0.5) and (this animationPhase ""Door1_BreachAnim"" < 0.7)";
                statement = "this animate[""Door1"",0];[this, 'Door1_AP', 'MBG_SndSrc_DoorClose',2] execvm 'mbg\mbg_killhouses_a3\s\MPSoundV2.sqf';";
                onlyforplayer = 0;
            };
            class CloseDoor2: CloseDoor1
            {
                position = "Door2_AP";
                condition = "(this animationPhase ""Door2"" > 0.5) and (this animationPhase ""Door2_BreachAnim"" < 0.7)";
                statement = "this animate [""Door2"",0];[this, 'Door2_AP', 'MBG_SndSrc_DoorClose',2] execvm 'mbg\mbg_killhouses_a3\s\MPSoundV2.sqf';";
            };
            class CloseDoor3: CloseDoor1
            {
                position = "Door3_AP";
                condition = "(this animationPhase ""Door3"" > 0.5) and (this animationPhase ""Door3_BreachAnim"" < 0.7)";
                statement = "this animate [""Door3"",0];[this, 'Door3_AP', 'MBG_SndSrc_DoorClose',2] execvm 'mbg\mbg_killhouses_a3\s\MPSoundV2.sqf';";
            };
            class CloseDoor4: CloseDoor1
            {
                position = "Door4_AP";
                condition = "(this animationPhase ""Door4"" > 0.5) and (this animationPhase ""Door4_BreachAnim"" < 0.7)";
                statement = "this animate [""Door4"",0];[this, 'Door4_AP', 'MBG_SndSrc_DoorClose',2] execvm 'mbg\mbg_killhouses_a3\s\MPSoundV2.sqf';";
            };
            class CloseDoor5: CloseDoor1
            {
                position = "Door5_AP";
                condition = "(this animationPhase ""Door5"" > 0.5) and (this animationPhase ""Door5_BreachAnim"" < 0.7)";
                statement = "this animate [""Door5"",0];[this, 'Door5_AP', 'MBG_SndSrc_DoorClose',2] execvm 'mbg\mbg_killhouses_a3\s\MPSoundV2.sqf';";
            };
            class CloseDoor6: CloseDoor1
            {
                position = "Door6_AP";
                condition = "(this animationPhase ""Door6"" > 0.5) and (this animationPhase ""Door6_BreachAnim"" < 0.7)";
                statement = "this animate [""Door6"",0];[this, 'Door6_AP', 'MBG_SndSrc_DoorClose',2] execvm 'mbg\mbg_killhouses_a3\s\MPSoundV2.sqf';";
            };
            class CloseDoor7: CloseDoor1
            {
                position = "Door7_AP";
                condition = "(this animationPhase ""Door7"" > 0.5) and (this animationPhase ""Door7_BreachAnim"" < 0.7)";
                statement = "this animate [""Door7"",0];[this, 'Door7_AP', 'MBG_SndSrc_DoorClose',2] execvm 'mbg\mbg_killhouses_a3\s\MPSoundV2.sqf';";
            };
            class CloseDoor8: CloseDoor1
            {
                position = "Door8_AP";
                condition = "(this animationPhase ""Door8"" > 0.5) and (this animationPhase ""Door8_BreachAnim"" < 0.7)";
                statement = "this animate [""Door8"",0];[this, 'Door8_AP', 'MBG_SndSrc_DoorClose',2] execvm 'mbg\mbg_killhouses_a3\s\MPSoundV2.sqf';";
            };
        };
        class DestructionEffects: DestructionEffects
        {
            class Ruin1
            {
                simulation = "ruin";
                type = "a3\structures_f\households\House_Small03\House_Small_03_V1_ruins_F.p3d";
                position = "";
                intensity = 1;
                interval = 1;
                lifeTime = 1;
            };
        };
    };
    class MBG_Killhouse_2_InEditor: Land_MBG_Killhouse_2
    {
        scope = 2;
        displayName = "Killhouse, Medium";
    };

 

 

 

Maybe someone can give the solution for the penetration point problem?

 

 

 

Also I guess it would be better to have a function, that is more complex, counts by itself and so includes all killhouses at once?

I saw this post by Heeeere's johnny! and I think it's quite close to a solution for this problem, too?

 

So I tried to use it and of course due to my lack of skill failed to succeed:

_fnc_fixMBGKillhousesBreaching = {

_target = _this select 0;
_damage = 0.7;
_houseType = typeOf _target;
_animationSources = configFile >> "CfgVehicles" >> _houseType >> "AnimationSources";
_sourceCount = count _animationSources;

for "_i" from 0 to _sourceCount - 1 do
    {
        if ((_target getHitPointDamage (_sourceName = configName (_animationSources select _i))) >= _damage) then {_target animate [_sourceName, 1];};
};
};

Would be cool if you could help to make the code work! And maybe it's even possible to filter the AnimationSources to doors and breachsegments only? Because for example _sourceCount for this building results in 17, but only 8+1 (doors+breachsegment) are needed? But I don't know if that's even relevant ^^

 

 

Thank you for reading and sorry for the long post.

 

 

Kind regards.

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  

×