MudBone

Custom snow script

2 posts in this topic

I dont really like the built in snow script on Exile Namalsk. I have a snow script (below) that I would like  use rather than the built in snow script. This worked fine on our Namalsk Wastelandserver but now I can't get to work on Exile. Any ideas? Do I need some kind of override?

/*
Name: snowFall
Author: IndeedPete
Purpose: Creates light snow fall around unit. Also checks if unit is inside a vehicle or building / under a roof.
----------
Parameters:
_unit - OBJECT (OPTIONAL): Unit to simulate snow around. - MyUnit - DEFAULT: Player
_condition - CODE (OPTIONAL): While condition that is being checked in addition to (alive _unit). - {SomeVariable > 0} - DEFAULT: {true}

Returns:
Script handle.
*/

private ["_unit", "_condition", "_handle"];
_unit = [_this, 0, player, [ObjNull]] call BIS_fnc_param;
_condition = [_this, 1, {true}, [{}]] call BIS_fnc_param;

_handle = [_unit, _condition] spawn {
    _unit = _this select 0;
    _condition = _this select 1;
    
    if (!isNull(_unit getVariable ["IP_Snow", ObjNull])) exitWith {["Already running!"] call BIS_fnc_error};
    
    while {(alive _unit) && (call _condition)} do {
        _obj = vehicle _unit;
        _pos = if (_obj == _unit) then {
            (getposASL _obj)
        } else {
            _res = getposASL _obj;
            _res set [2, ((_res select 2) + 2)];
            _res
        };

        if (count(lineIntersectsObjs [_pos, [(_pos select 0),(_pos select 1),((_pos select 2) + 20)]]) == 0) then {
            if (isNull(_unit getVariable ["IP_Snow", ObjNull])) then {
                _snow = "#particleSource" createVehicleLocal (getPos _obj);
                _snow setParticleParams [["\A3\data_f\ParticleEffects\Universal\smoke.p3d", 1,0,1,0],"","Billboard",1,10,[0,0,0],[0,0,-10],10,1,0,1,[0.12,0.12],[[1,1,1,0.5],[1,1,1,0.5]],[0,1],0.25,1,"","", _obj];
                _snow setParticleRandom [0, [25, 25, 18], [0, 0, 0], 0, 0.01, [0, 0, 0, 0.1], 0, 0];
                _snow setParticleCircle [0.0, [0, 0, 0]];
                _snow setDropInterval 0.003;
                _unit setVariable ["IP_Snow", _snow];
            };
        } else {
            if (!isNull(_unit getVariable ["IP_Snow", ObjNull])) then {
                deleteVehicle (_unit getVariable "IP_Snow");
                _unit setVariable ["IP_Snow", ObjNull];
            };
        };

        sleep 0.03;
    };
    
    if (!isNull(_unit getVariable ["IP_Snow", ObjNull])) then {
        deleteVehicle (_unit getVariable "IP_Snow");
        _unit setVariable ["IP_Snow", ObjNull];
    };
};

_handle

 

 

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.