Trigger that makes vehicles invulnerable

kikyou2

Valued Member!
Hi there,

I'm currently reworking the whole safezone Script and running into one last problem that the vehicles can be destroyed from players who are firing outside from the safezone.

I talked to leolilu to get the publicvariableEH working and now the only problem is that it doesn't triggers somehow and I can't find the error.

Triggers
Code:
class Item10
{
position[]={11460.826,317.30579,11351.489};
angle=310;
rectangular=1;
activationBy="ANY";
repeating=1;
interruptable=1;
age="UNKNOWN";
text="Vehicle_East";
name="Vehicle_East";
expCond="{_x isKindOf 'AllVehicles'} count thisList > 0";
            expActiv="{triggerDamageOff = _x} foreach thisList;";
            expDesactiv="{triggerDamageOn = _x} foreach thisList;";
class Effects
{
};
};
class Item11
{
position[]={6323.6626,304.99023,7807.3276};
a=70;
b=35;
angle=35;
rectangular=1;
activationBy="ANY";
repeating=1;
interruptable=1;
age="UNKNOWN";
text="Vehicle_South";
name="Vehicle_South";
expCond="{_x isKindOf 'AllVehicles'} count thisList > 0";
            expActiv="{triggerDamageOff = _x} foreach thisList;";
            expDesactiv="{triggerDamageOn = _x} foreach thisList;";
class Effects
{
};
};

init.sqf addition for the publicvariableEH

Code:
        if (isServer) then {"triggerDamageOff" addPublicVariableEventHandler {
                    private ["_args"];
                    _args = _this select 1; //_this = the val of "triggerDamageOff"
                    diag_log format["Server: Damage Off for %1",_args];
                   _eh1 =  _args addEventHandler ["HandleDamage", {false}];
                    _args setVehicleInit "this allowDamage false";
                    processInitCommands;
                 
        };
};
        if (isServer) then {"triggerDamageOn" addPublicVariableEventHandler {
                    private ["_args"];
                    _args = _this select 1; //_this = the val of "triggerDamageOff"
                    diag_log format["Server: Damage On for %1",_args];
                   _eh1 = _args addeventhandler ["HandleDamage",{ _this call vehicle_handleDamage } ];
                    _args setVehicleInit "this allowDamage true";
                    processInitCommands;
                 
        };        
};

Anybody see what I missed?

Thanks for any help! :)
 
before
Code:
addEventHandler ["HandleDamage", {false}];

try doing
Code:
removeAllEventHandlers "handleDamage";

just before it. I had a similar issue with handleDamage for my AI shop area and kind of flushing it like that worked for me.
 
Hi there,

I'm currently reworking the whole safezone Script and running into one last problem that the vehicles can be destroyed from players who are firing outside from the safezone.

I talked to leolilu to get the publicvariableEH working and now the only problem is that it doesn't triggers somehow and I can't find the error.

Triggers
Code:
class Item10
{
position[]={11460.826,317.30579,11351.489};
angle=310;
rectangular=1;
activationBy="ANY";
repeating=1;
interruptable=1;
age="UNKNOWN";
text="Vehicle_East";
name="Vehicle_East";
expCond="{_x isKindOf 'AllVehicles'} count thisList > 0";
            expActiv="{triggerDamageOff = _x} foreach thisList;";
            expDesactiv="{triggerDamageOn = _x} foreach thisList;";
class Effects
{
};
};
class Item11
{
position[]={6323.6626,304.99023,7807.3276};
a=70;
b=35;
angle=35;
rectangular=1;
activationBy="ANY";
repeating=1;
interruptable=1;
age="UNKNOWN";
text="Vehicle_South";
name="Vehicle_South";
expCond="{_x isKindOf 'AllVehicles'} count thisList > 0";
            expActiv="{triggerDamageOff = _x} foreach thisList;";
            expDesactiv="{triggerDamageOn = _x} foreach thisList;";
class Effects
{
};
};

init.sqf addition for the publicvariableEH

Code:
        if (isServer) then {"triggerDamageOff" addPublicVariableEventHandler {
                    private ["_args"];
                    _args = _this select 1; //_this = the val of "triggerDamageOff"
                    diag_log format["Server: Damage Off for %1",_args];
                  _eh1 =  _args addEventHandler ["HandleDamage", {false}];
                    _args setVehicleInit "this allowDamage false";
                    processInitCommands;
               
        };
};
        if (isServer) then {"triggerDamageOn" addPublicVariableEventHandler {
                    private ["_args"];
                    _args = _this select 1; //_this = the val of "triggerDamageOff"
                    diag_log format["Server: Damage On for %1",_args];
                  _eh1 = _args addeventhandler ["HandleDamage",{ _this call vehicle_handleDamage } ];
                    _args setVehicleInit "this allowDamage true";
                    processInitCommands;
               
        };       
};

Anybody see what I missed?

Thanks for any help! :)



you forgot a ";"

right HERE: expCond="{_x isKindOf 'AllVehicles'} count thisList > 0;";
 
Back
Top