Jump to content
smokeycz

[Solved][local MP] Snowing script - after respawn it snows on the corpse not on the respawned player

Recommended Posts

Hey, everyone

I wanted to ask for your help guys, i found this on forum and it works great but it has one issue which is out of my reach to fix. The problem i have is that when player respawns the snowing particles remain around the corpse. Is there a way to make it switch to the respawned player after he dies?

 

Can somebody pretty please help me out?


This is the script i found on the forum.

Quote

// light modification of snow blizzard script by JW
private["_fog"];
setWind [0, -5, true];
_obj = _this select 0;
AZC_DO_SNOW = true;
AZC_MAX_DENSITY = 10000;

_pos = position (vehicle _obj);
_d  = 15;
_density = 20;
_nextChange = time + 30000000000;

AZC_FNC_INSIDE =
{
    params ["_object"];
    _inside = false;
    _worldPos = getPosWorld _object;
    _skyPos = getPosWorld _object vectorAdd [0, 0, 50];
    _line = lineIntersectsSurfaces [_worldPos,_skyPos,_object,objNull,true,1,"GEOM","NONE"];
    if (count _line > 0) then
    {
        _result = _line select 0;
        _house = _result select 3;
        if (!(isNil "_house")) then { _inside = true };
    };

    _inside
};

AZC_FNC_CREATE_FOG_EFFECT =
{
    _fog = "#particlesource" createVehicleLocal _pos; 
    _fog setParticleParams [
       ["\Ca\Data\ParticleEffects\Universal\universal.p3d" , 16, 12, 13, 0], "", "Billboard", 1, 10, 
       [0, 0, -6], [0, 0, 0], 1, 1.275, 1, 0, 
       [7,6], [[1, 1, 1, 0], [1, 1, 1, 0.04], [1, 1, 1, 0]], [1000], 1, 0, "", "", _obj
    ];
    _fog setParticleRandom [3, [55, 55, 0.2], [0, 0, -0.1], 2, 0.45, [0, 0, 0, 0.1], 0, 0];
    _fog setParticleCircle [0.001, [0, 0, -0.12]];
    _fog setDropInterval 0.001;
    _fog
};

_inside = false;
missionNameSpace setVariable ["AZC_CUSTOM_WEATHER",true];

while { AZC_DO_SNOW } do
{
    _a = 0;
    while { _a < _density } do
    {
        0 setRain 0;
        _inside = player call AZC_FNC_INSIDE;
        if (!_inside) then
        {
            _pos = getPosATL (vehicle _obj);
            if (isNil "_fog" && _density > 4000) then
            {
                _fog = call AZC_FNC_CREATE_FOG_EFFECT;
            };
            
            if (!isNil "_fog") then { _fog setpos _pos; };
            _dpos = [((_pos select 0) + (_d - (random (2*_d))) + ((velocity vehicle player select 0)*1)),((_pos select 1) + (_d - (random (2*_d))) + ((velocity vehicle player select 0)*1)),((_pos select 2) + 2)];
            drop ["\ca\data\cl_water", "", "Billboard", 1, 7, _dpos, [0,0,-1], 1, 0.0000001, 0.000, 0.7, [0.07], [[1,1,1,0], [1,1,1,1], [1,1,1,1], [1,1,1,1]], [0,0], 0.2, 1.2, "", "", ""];    _a = _a + 1;
            _dpos = [((_pos select 0) + (_d - (random (2*_d))) + ((velocity vehicle player select 0)*1)),((_pos select 1) + (_d - (random (2*_d))) + ((velocity vehicle player select 0)*1)),((_pos select 2) + 4)];
            drop ["\ca\data\cl_water", "", "Billboard", 1, 7, _dpos, [0,0,-1], 1, 0.0000001, 0.000, 0.7, [0.07], [[1,1,1,0], [1,1,1,1], [1,1,1,1], [1,1,1,1]], [0,0], 0.2, 1.2, "", "", ""];    _a = _a + 1;
            _dpos = [((_pos select 0) + (_d - (random (2*_d))) + ((velocity vehicle player select 0)*1)),((_pos select 1) + (_d - (random (2*_d))) + ((velocity vehicle player select 0)*1)),((_pos select 2) + 6)];
            drop ["\ca\data\cl_water", "", "Billboard", 1, 7, _dpos, [0,0,-1], 1, 0.0000001, 0.000, 0.7, [0.07], [[1,1,1,0], [1,1,1,1], [1,1,1,1], [1,1,1,1]], [0,0], 0.2, 1.2, "", "", ""];    _a = _a + 1;
            _dpos = [((_pos select 0) + (_d - (random (2*_d))) + ((velocity vehicle player select 0)*1)),((_pos select 1) + (_d - (random (2*_d))) + ((velocity vehicle player select 0)*1)),((_pos select 2) + 8)];
            drop ["\ca\data\cl_water", "", "Billboard", 1, 7, _dpos, [0,0,-1], 1, 0.0000001, 0.000, 0.7, [0.07], [[1,1,1,0], [1,1,1,1], [1,1,1,1], [1,1,1,1]], [0,0], 0.2, 1.2, "", "", ""];    _a = _a + 1;
            _dpos = [((_pos select 0) + (_d - (random (2*_d))) + ((velocity vehicle player select 0)*1)),((_pos select 1) + (_d - (random (2*_d))) + ((velocity vehicle player select 0)*1)),((_pos select 2) + 10)];
            drop ["\ca\data\cl_water", "", "Billboard", 1, 7, _dpos, [0,0,-1], 1, 0.0000001, 0.000, 0.7, [0.07], [[1,1,1,0], [1,1,1,1], [1,1,1,1], [1,1,1,1]], [0,0], 0.2, 1.2, "", "", ""];    _a = _a + 1;
            _dpos = [((_pos select 0) + (_d - (random (2*_d))) + ((velocity vehicle player select 0)*1)),((_pos select 1) + (_d - (random (2*_d))) + ((velocity vehicle player select 0)*1)),((_pos select 2) + 12)];
            drop ["\ca\data\cl_water", "", "Billboard", 1, 7, _dpos, [0,0,-1], 1, 0.0000001, 0.000, 0.7, [0.07], [[1,1,1,0], [1,1,1,1], [1,1,1,1], [1,1,1,1]], [0,0], 0.2, 1.2, "", "", ""];    _a = _a + 1;
        };
    };

    sleep 0.1;
    if (time > _nextChange && _density < AZC_MAX_DENSITY) then
    {
        _density = _density + 250;
        _nextChange = _nextChange + 60;
    };
};

// if snow flag is set to false code will execute here
missionNameSpace setVariable ["AZC_CUSTOM_WEATHER",false];

Share this post


Link to post
Share on other sites

Well i solved it by myself 😄 i just put the init of the script into the onPlayerRespawn.sqf and also to stop the snowing over the corpse edited this part
 

Quote

while { AZC_DO_SNOW && alive player } do

 

i put this into the onPlayerRespawn.sqf which is also in initPlayerLocal.sqf
 

Quote

[player] execVM "snow.sqf";

 

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

×