vehicle godmode trigger?

Discussion in 'Scripting Discussions' started by dayzwar, Sep 18, 2013.

  1. dayzwar

    dayzwar Well-Known Member

    Joined:
    Apr 21, 2013
    Messages:
    187
    Likes Received:
    10
    Since a long time I try this without sucess. Anyone knows how to add a zone where the vehicles take no damage? Just the vehicles.
     
  2. Matt L

    Matt L OpenDayZ Rockstar!

    Joined:
    May 10, 2013
    Messages:
    841
    Likes Received:
    136
    Code:
    //Mod by Zane
    Private ["_Basis","_EH_Fired","_EH_Hit","_EH_Killed"];
    _Basis = _this select 0; //Basisname
    while {true} do
      {
        waitUntil {vehicle player in list _Basis};
    titleText ["Welcome to the Trading post, God mode ON.", "PLAIN DOWN", 3];
    sleep 2;
    player setUnitRecoilCoefficient 0;
    player_zombieCheck = {};
    fnc_usec_damageHandler = {};
    fnc_usec_unconscious  = {};
    player allowDamage false;
        waitUntil {! (vehicle player in list _Basis)};
    titleText ["Leaving Trading Post, God mode OFF.", "PLAIN DOWN", 3];
    sleep 2;
    player setUnitRecoilCoefficient 1;
    player_zombieCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieCheck.sqf";
    fnc_usec_damageHandler = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandler.sqf";
    fnc_usec_unconscious = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_unconscious.sqf";
    player allowDamage true;
      } 
    then check your dayz code for something like
    Code:
        vehicle_handleDamage    = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_handleDamage.sqf";
        vehicle_handleKilled    = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_handleKilled.sqf";
    and use the above 'safezone' to add those handlers in so vehicle_handleDamage = {}; etc etc
     
  3. dayzwar

    dayzwar Well-Known Member

    Joined:
    Apr 21, 2013
    Messages:
    187
    Likes Received:
    10


    but, that made the player godmode... no?
     
  4. Matt L

    Matt L OpenDayZ Rockstar!

    Joined:
    May 10, 2013
    Messages:
    841
    Likes Received:
    136
    If you make the addition/change that I mentioned, it should also make vehicles have godmode.
     
  5. dayzwar

    dayzwar Well-Known Member

    Joined:
    Apr 21, 2013
    Messages:
    187
    Likes Received:
    10

    oh, ok, so like this:


    Code:
    //Mod by Zane
    Private ["_Basis","_EH_Fired","_EH_Hit","_EH_Killed"];
    _Basis = _this select 0; //Basisname
    while {true} do
      {
        waitUntil {vehicle player in list _Basis};
    titleText ["Welcome to the Trading post, God mode ON.", "PLAIN DOWN", 3];
    sleep 2;
    player setUnitRecoilCoefficient 0;
    player_zombieCheck = {};
    fnc_usec_damageHandler = {};
    fnc_usec_unconscious  = {};
    vehicle_handleDamage ={};
    vehicle_handleKilled ={};
    player allowDamage false;
        waitUntil {! (vehicle player in list _Basis)};
    titleText ["Leaving Trading Post, God mode OFF.", "PLAIN DOWN", 3];
    sleep 2;
    player setUnitRecoilCoefficient 1;
    player_zombieCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieCheck.sqf";
    fnc_usec_damageHandler = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandler.sqf";
    fnc_usec_unconscious = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_unconscious.sqf";
    vehicle_handleDamage    = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_handleDamage.sqf";
     vehicle_handleKilled    = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_handleKilled.sqf";
    player allowDamage true;
      } 
     
  6. Matt L

    Matt L OpenDayZ Rockstar!

    Joined:
    May 10, 2013
    Messages:
    841
    Likes Received:
    136
    Yeah, should do the trick.
     
  7. dayzwar

    dayzwar Well-Known Member

    Joined:
    Apr 21, 2013
    Messages:
    187
    Likes Received:
    10
    it works thanks, but ONLY if the player is there and enter the vehicle 1 time, if he go away, the vehicles will take damage.
    Is not there a way to make the zone a permanent vehicle godmode no metter if there a player or not?

    Code:
    //Mod by Zane
    Private ["_Basis","_EH_Fired","_EH_Hit","_EH_Killed"];
    _Basis = _this select 0; //Basisname
    while {true} do
      {
        waitUntil {vehicle player in list _Basis};
    titleText ["Welcome to the Trading post, God mode ON.", "PLAIN DOWN", 3];
    sleep 2;
    player setUnitRecoilCoefficient 0;
    player_zombieCheck = {};
    fnc_usec_damageHandler = {};
    fnc_usec_unconscious  = {};
    fnc_veh_handleDam ={};
    fnc_veh_handleKilled ={};
    player allowDamage false;
        waitUntil {! (vehicle player in list _Basis)};
    titleText ["Leaving Trading Post, God mode OFF.", "PLAIN DOWN", 3];
    sleep 2;
    player setUnitRecoilCoefficient 1;
    player_zombieCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieCheck.sqf";
    fnc_usec_damageHandler = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandler.sqf";
    fnc_usec_unconscious = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_unconscious.sqf";
    fnc_veh_handleDam = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\veh_handleDam.sqf";
    fnc_veh_handleKilled = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\veh_handleKilled.sqf";
    player allowDamage true;
      };
     
  8. Matt L

    Matt L OpenDayZ Rockstar!

    Joined:
    May 10, 2013
    Messages:
    841
    Likes Received:
    136
    Maybe if you use a vehicle activecondition in you sensor, and ten did a waitUntil {vehicletypeblah in list _Basis}
     
  9. dayzwar

    dayzwar Well-Known Member

    Joined:
    Apr 21, 2013
    Messages:
    187
    Likes Received:
    10

    can u explain a little more? u got me there.
     
  10. Matt L

    Matt L OpenDayZ Rockstar!

    Joined:
    May 10, 2013
    Messages:
    841
    Likes Received:
    136
    Code:
     expActiv="if (typeOf _x in ["Land"]) then {[Basis_West] execVM ""safezone.sqf""};"; //only modify Basis_West
    That's part of your sensor. Idk if that'll work, as i've never used anything like it before, then you would do waitUntil {(typeOf _x in ["Land"]) in list _Basis} or something like that
     
  11. ebay

    ebay OpenDayZ Guru!

    Joined:
    Jan 9, 2013
    Messages:
    828
    Likes Received:
    296
    Another solution to this might be to include the other safezone method in your script. It makes everyone fire blanks so they can't shoot out tires, etc:
    Code:
    waitUntil {vehicle player in list _Basis};
        _EH_Fired  = vehicle player addEventHandler ["Fired", { NearestObject [_this select 0,_this select 4] setPos[0,0,0]}];
        _EH_Hit    = vehicle player addEventHandler ["Hit",  {_this select 1 setdammage 0; player setDammage 0; vehicle player setDammage 0}];
        _EH_Killed = vehicle player addEventHandler ["Killed",{_this select 1 setdammage 0}];
        waitUntil {! (vehicle player in list _Basis)};
        player removeEventHandler ["Fired", _EH_Fired];
        player removeEventHandler ["Hit",  _EH_Hit];
        player removeEventHandler ["Killed",_EH_Killed];
     
  12. evgenius2012

    evgenius2012 New Member

    Joined:
    Aug 18, 2013
    Messages:
    2
    Likes Received:
    0
    is there a workable solution?
     

Share This Page