acemod / ACE3

Open-source realism mod for Arma 3
https://ace3.acemod.org
Other
1.01k stars 737 forks source link

Chemical Warfare script #6107

Closed EliasOriley closed 6 years ago

EliasOriley commented 6 years ago

Hello, I convert the "Rick_Contamination_script" into ACE. When I try it in the Editor on Multiplayer it works fine. But when I try it on a dedicated Server nothing is happening, rpt dont show any Errors.

rick_contamination.sqf `if (isserver OR isdedicated) then {

_contaminationcenter = _this select 0;
_conrad = _this select 1; 
_height = _this select 2;
_time = _this select 3;

//wait until unit inside contaminated zone

waituntil {
    (
        { 
            _contdistance = _contaminationcenter distance _x;
            _posoverunit = getposATL _x select 2;
            _contdistance < _conrad && _posoverunit < _height 
        } count switchableUnits) > 0 OR (
            {
                _contdistance = _contaminationcenter distance _x;
                _posoverunit = getposATL _x select 2;
                _contdistance < _conrad && _posoverunit < _height
            } count playableUnits) > 0
    };

_allplayers = switchableunits + playableunits;

{
    _posoverunit = getposATL _x select 2;
    _contdistance = _contaminationcenter distance _x;
    _hitzone = floor random 5;

    if (_contdistance < _conrad && goggles _x != "G_Respirator_white_F" && goggles _x != "G_Respirator_white_F" && goggles _x != "G_Respirator_white_F" && _posoverunit < 80) then {
         //hintSilent "ABC-Alarm!";
         switch (_hitzone) do {
            case 0:{
                [_x, 0.2, "leg_r", "ropeburn"] call ace_medical_fnc_addDamageToUnit;
            };
             case 1: {
                [_x, 0.2, "leg_l", "ropeburn"] call ace_medical_fnc_addDamageToUnit; 
            };
            case 2: {
                [_x, 0.2, "body", "ropeburn"] call ace_medical_fnc_addDamageToUnit; 
            };
            case 3: {
                [_x, 0.2, "head", "ropeburn"] call ace_medical_fnc_addDamageToUnit; 
            };
            case 4: {
                [_x, 0.2, "hand_r", "ropeburn"] call ace_medical_fnc_addDamageToUnit; 
            };
            case 5: {
                [_x, 0.2, "hand_l", "ropeburn"] call ace_medical_fnc_addDamageToUnit; 
            }; 
        };
    } 
} foreach _allplayers;

sleep _time;

null = [_contaminationcenter,_conrad, _height, _time] execVM "rick_survival\rick_contamination.sqf";

}; `

rick_mask_breathe.sqf

`_player = _this select 0;

if (isdedicated) exitwith {};

waituntil {goggles _player == "G_Respirator_white_F" OR goggles _player == "G_Respirator_white_F" OR goggles _player == "G_Respirator_white_F"};

while {alive _player AND (goggles _player == "G_Respirator_white_F" OR goggles _player == "G_Respirator_white_F" OR goggles _player == "G_Respirator_white_F")} do { playsound3d ["A3\sounds_f\characters\human-sfx\other\diver-breath-2.wss", _player,false,getposASL _player, 0.8,1,15]; sleep 5;

        };

null = [_player] execVM "rick_survival\rick_mask_breathe.sqf";`


Script in the trigger which fires the script.

gas.sqf

`cuttext ["0400 Uhr","BLACK OUT"]; setDate [2016, 10, 5, 4, 0]; g1 say3D "sound4"; g2 say3D "sound4"; g3 say3D "sound4"; g4 say3D "sound4"; g5 say3D "sound4"; g6 say3D "sound4"; g7 say3D "sound4"; g8 say3D "sound4"; g9 say3D "sound4"; g10 say3D "sound4"; g11 say3D "sound4"; sleep 5; cuttext ["","BLACK IN"]; cuttext ["ABC Alarm!!!","PLAIN"]; sleep 5; cuttext ["","PLAIN"]; sleep 0.5; 0 setFog [1, 1, -10]; sleep 0.5; 120 setFog [0.5, 1, 9]; sleep 0.5;
null = [g1, 10, 80, 10] execVM "rick_survival\rick_contamination.sqf"; sleep 0.5;

null = [g2, 10, 80, 10] execVM "rick_survival\rick_contamination.sqf"; sleep 0.5;

null = [g3, 10, 80, 10] execVM "rick_survival\rick_contamination.sqf"; sleep 0.5;

null = [g4, 10, 80, 10] execVM "rick_survival\rick_contamination.sqf"; sleep 0.5;

null = [g5, 10, 80, 10] execVM "rick_survival\rick_contamination.sqf"; sleep 0.5;

null = [g6, 10, 80, 10] execVM "rick_survival\rick_contamination.sqf"; sleep 0.5;

null = [g7, 10, 80, 10] execVM "rick_survival\rick_contamination.sqf"; sleep 0.5;

null = [g8, 10, 80, 10] execVM "rick_survival\rick_contamination.sqf"; sleep 0.5;

null = [g9, 10, 80, 10] execVM "rick_survival\rick_contamination.sqf"; sleep 0.5;

null = [g10, 10, 80, 10] execVM "rick_survival\rick_contamination.sqf"; sleep 0.5;

null = [g11, 10, 80, 10] execVM "rick_survival\rick_contamination.sqf";

null=[] spawn { while {true} do { player action ["lightOff",btr1]; sleep 0.01};}; null=[] spawn { while {true} do { player action ["lightOff",btr2]; sleep 0.01};}; null=[] spawn { while {true} do { player action ["lightOff",btr3]; sleep 0.01};}; null=[] spawn { while {true} do { player action ["lightOff",btr4]; sleep 0.01};};

`

Thanks a lot.

PabstMirror commented 6 years ago

ace_medical_fnc_addDamageToUnit needs to be called where the unit is local server's rpt should have errors like ERROR_1("addDamageToUnit - badUnit %1", _this);

to fix just use a simple event setup like this init.sqf (run on all machines) ["pabst_addDamPass", {_this call ace_medical_fnc_addDamageToUnit}] call CBA_fnc_addEventHandler;

and then replace [_x, 0.2, "leg_r", "ropeburn"] call ace_medical_fnc_addDamageToUnit; with ["pabst_addDamPass", [_x, 0.2, "leg_r", "ropeburn"], _x] call CBA_fnc_targetEvent;

PabstMirror commented 6 years ago

Let us know if you are still having problems