Jump to content

stanhope

Member
  • Content Count

    1194
  • Joined

  • Last visited

  • Medals

Posts posted by stanhope


  1. you need to remote exec your script to the server and your fade effects to the client

    So in init.sqf put:

    YourPrefix_fnc_teleportFade = {
    	[0,"BLACK",0.1,3] call BIS_fnc_fadeEffect; 
     	player SetPos ((getPos t1) vectorADD ([random[0, 12.5, 25], random[-1.5, 0, 1.5], 0]));
     	[1, "BLACK",5,1] call BIS_fnc_fadeEffect;
    	0=[[["near the coast... ","align = 'center' size = '0.7' font='PuristaBold'"],["","<br/>"],["5 days later","align = 'center' size = '0.7'","#aaaaaa"]]] spawn BIS_fnc_typeText2; 
    };
    
    YourPrefix_fnc_teleportPlayersToSub = {
    	setDate [2012, 9, 1, 4, 30]; 
    	0 setFog [0.4, 0.1, 25]; 
    	[] remoteExecCall ["YourPrefix_fnc_teleportFade", 0];
    };

    And make your addaction the following:

    this addAction ["To U-Boat",{[] remoteExec ["YourPrefix_fnc_teleportPlayersToSub", 2]},[],1,false,true,"","_this distance _target < 3"];
    

    The init of a vehicle is executed every time someone joins, so you don't need to remote exec there (iirc)

     

    Untested.


  2. Either of these should do the trick as long as you're only using 2 groups per sector:

    Spoiler

     

    
    {
    	private _sector = _x;
    	private _groupName = format["grp-sctr-%1", _forEachIndex];
    
    	{
    		private _grp = [...] call BIS_fnc_spawnGroup;
          	private _pos = _x;
    		
    		if (_forEachIndex == 0) then {
    			_grp setGroupId [format ["%1-building", _groupName]];
    			//do code for building group
    		};
    		if (_forEachIndex == 1) then {
    			_grp setGroupId [format ["%1-road", _groupName]];
    			//do code for road group
    		};
    	} forEach _sector;
    } forEach _sectorArray;
    
    
    /////////// OR ////////////////////
    
    {
    	private _sector = _x;
    	private _groupName = format["grp-sctr-%1", _forEachIndex];
    
      	private _pos = _sector select 0;
      	private _bldGrp = [...] call BIS_fnc_spawnGroup;
    	_bldGrp setGroupId [format ["%1-building", _groupName]];
      	//do code for building group
      
      	private _pos = _sector select 1;
    	private _roadGrp = [...] call BIS_fnc_spawnGroup;
        _roadGrp setGroupId [format ["%1-road", _groupName]];
        //do code for road group
    		
    } forEach _sectorArray;

    Untested


  3. The code you provided has an extra "}];" in it which will throw a syntax error, here's a version without the syntax error (still untested):

    Spoiler
    
    private _EHCode = {
        params ["_unit", "_hitSelection", "_damage","_source","_projectile","_hitPartIndex", "_instigator", "_hitPoint"];
        private _damageMultiplierHead = 0.3;
        private _damageMultiplierBody = 0.25;
        private _damageMultiplierLimbs = 0.15;
        private _damageMultiplierOverall = 0.25;
    
        private _limitHead = 1.0;
        private _limitBody = 0.25;
        private _limitLimbs = 0.1;
        private _limitOverall = 0.25;
    
        private _oldDamage = 0;
        if (_hitSelection isEqualTo "") then {_oldDamage = damage _unit} else {_oldDamage = _unit getHit _hitSelection};
        private _newDamage = _damage - _oldDamage max 0;
        private _incomingDamage = _newDamage;
        private _playerHealth = damage _unit;
    
    
        if (_newDamage > 0 && !(_projectile isEqualTo "")) then {
            private _damageMultiplier = _damageMultiplierBody;
            private _upperLimit = _limitBody;
            switch (_hitSelection) do {
                case "face_hub";
                case "head": {
                    _damageMultiplier = _damageMultiplierHead;
                    _upperLimit = _limitHead;
                };
                case "arms";
                case "hands";
                case "legs": {
                    _damageMultiplier = _damageMultiplierLimbs;
                    _upperLimit = _limitLimbs;
                };
                case "": {
                    _damageMultiplier = _damageMultiplierOverall;
                    _upperLimit = _limitOverall;
                };
                default {
                    _damageMultiplier = _damageMultiplierBody;
                    _upperLimit = _limitBody;
                };
            };
            _newDamage = _newDamage * _damageMultiplier;
    
    
            if (_newDamage > _upperLimit) then {
                _newDamage = _upperLimit;
            };
    
            _damage = _oldDamage + _newDamage;
        };
    
        if ( isPlayer _unit ) then {
            if ( lifeState _unit == "INCAPACITATED" ) then {
                _damage = _oldDamage;
            } else {
                _this set[ 2, _damage ];
                _damage = _this call bis_fnc_reviveEhHandleDamage;
            };
        };
    
        _damage
    };
    
    while {true} do {
        {
            if (_x getVariable ["damage_modifier_EH_applies", false]) then {continue;};
            _x addEventHandler ["HandleDamage", _EHCode];
            _x setVariable ["damage_modifier_EH_applies", true];
            uiSleep 0.1;
        } forEach allUnits;
        uiSleep 5;
    };
    
    

     

     

    If this also throws errors, go to "%localAppData%\Arma 3" (open windows explorer and put it in the bar at the top), open the newest .rpt file you find in there and find the error message in there and share it here.  (In a spoiler like I did with the code)

    • Like 2

  4. 3 hours ago, HartofARMA said:

    to apply these modifiers globally (to all units starting or spawned in later during a mission) via singleplayer init.sqf script or other mission start script.  

     

    How are these units created?  Do you spawn them with script, via zeus, ...?

     

    The easiest way to add that EH to all units would be via a while true loop over allUnits that adds it to any unit that doesn't have it yet.  The best way to do it would be to create your own function that you call instead of createUnit when your mission wants to create a unit and apply the EH in that function. 

    • Like 2

  5. Spoiler
    
    params ["_center"];
    
    private _towns = nearestLocations [getPos _center,["nameCity","nameVillage","nameLocal"],10000];
    
    private _randomTown =
    {
    	params ["_list"];
    	
    	_idx = selectRandom _list;
    	_pos = locationPosition _idx;
    	
    	_mrk = createMarker [text _idx,_pos];
    	_mrk setMarkerShape "Ellipse";
    	_mrk setMarkerSize size _idx;
    	_mrk setMarkerColor "ColorRed";
    	
    	_mrk
    };
    
    private _randomBuilding = 
    {
    	params ["_pos"];
    	
    	_buildings = nearestObjects [_pos,["House","Building"],300];
    	_building = selectRandom _buildings;
    	_buildingPos = getPosASL _building;
    	
    	_mrk = createMarker [str(_buildingPos),_buildingPos];
    	_mrk setMarkerShape "Ellipse";
    	_mrk setMarkerSize [10,10];
    	_mrk setMarkerColor "ColorBlue";
    	
    	_buildingPos
    };
    
    for "_i" from 1 to 4 do
    {
    	private _mrk = [_towns] call _randomTown;
    	for "_j" from 1 to 5 do
    	{
    		private _buildingPos = [getMarkerPos _mrk] call _randomBuilding;
    		private _grp = [_buildingPos,east,(configfile >> "CfgGroups" >> "East" >> "CUP_O_RU" >> "Infantry_Ratnik_Winter" >> "InfSentry")] call BIS_fnc_spawnGroup;
    		[_grp,_buildingPos,300,5,[],true] call lambs_wp_fnc_taskPatrol
    	};
    };
    
    true

     

    Untested

×