Jump to content

Recommended Posts

 

 

Just a little effect I was working on for a mission. I learned sqf back in Arma 2 days so if its ugly code, my bad lol You may need to view it in fullscreen to see the "glass hitting the ground" part of it.

 

HUGE, HUGE shoutout to @aliascartoons for all of his work on particles and such. Without his work, I wouldn't have understood how to do any of this. 

 

Spoiler

Lightlist = ["Lamps_base_F","Land_LampStreet_small_F","Land_LampStreet_F","Land_LampDecor_F","Land_LampHalogen_F","Land_LampHarbour_F","Land_LampShabby_F","Land_fs_roof_F"];


 

xian_GroundSparks_fnc = {

    private _sparkSource = _this select 0;

    private _sparkPos = position _sparkSource;

    private _xvalue = ((random 2)+0.6);

    private _yvalue = ((random 2)+0.6);

    private _zvalue = 0;

    private _spark = "#particlesource" createVehicleLocal [0,0,0];

    _spark setParticleCircle [0, [0, 0, 0]];

    _spark setParticleRandom        /*LifeTime*/        [6,

                                    /*Position*/        [0,0,0],

                                    /*MoveVelocity*/    [_xvalue,_yvalue,_zvalue],

                                    /*rotationVel*/     30,

                                    /*Scale*/       0.25,

                                    /*Color*/       [0,0,0,1],

                                    /*randDirPeriod*/   0.50,

                                    /*randDirIntesity*/ 0.50,

                                    /*Angle*/       30];

    _spark setParticleParams [["\A3\data_f\cl_water", 1, 0, 1], "", "Billboard", 1, 3, [0.10, 0, 3.25],[(random 0.50),(random 0.50),-2], 500, 1050, 7.9, 0.1, [0.10,0.10], [[0.75,0.75,1, 1], [0.75,0.75,1,1]], [0.16], 0, 0, "", "", _sparkSource,0,false,0.20,[[0,0,0,1]]];

    _spark attachTo [_sparkSource,[0,0,0]];

    _spark setDropInterval 0.005;

    uiSleep 0.15;

    deleteVehicle _spark;

};

 

_lamps = nearestObjects [player,Lightlist,100];

{

    [_x,["bulb_burst",200,1]] remoteExec ["say3D",0];

    {_x setHit ["light_1_hitpoint",0.99]} forEach _lamps;

    {_x setHit ["light_2_hitpoint",0.99]} forEach _lamps;

    {_x setHit ["light_3_hitpoint",0.99]} forEach _lamps;

    {_x setHit ["light_4_hitpoint",0.99]} forEach _lamps;

    [_x] spawn xian_GroundSparks_fnc;

} forEach _lamps;

 

Important note, I haven't worked out the placement of the "ground sparks" for every lamp, only the Shabby Lamp at the moment. I'll try and find time to do the others

Edited by XianGrim
adding another video
  • Like 7
  • Thanks 1

Share this post


Link to post
Share on other sites

Added another video to see the effect better. Ignore the fact the its on the power lines and not the light fixture XD

  • Like 2

Share this post


Link to post
Share on other sites

Very cool man.  I especially liked the power poles shorting out.  This has great immersion potential for missions.   Was the poles shorting out with electrical effect part of the script you posted above?

Share this post


Link to post
Share on other sites

No, the power lines were just part of the mission I made. I had positioned hidden spheres at the top of each pole and added them to an array. Then just called it spawned the function:

 

Spoiler

xian_Sparks_fnc = {

    _box = _this select 0;

    _boxPos = position _box;

    //Lightning Variables

    _animationName = "";

    _particleType = "SpaceObject";

    _timerPeriod = 0.25;

    _lifeTime = 0.12;

    _position = [0,0,0];

    _moveVelocity = [0,0,0];

    _rotationVelocity = 0;

    _weight = 25;

    _volume = 10;

    _rubbing = 7.9;

    _scale = [0.01,0.01,0.01,0];

    _color = [[0.4, 0.1, 0.1, 1], [0.4, 0.25, 0.25, 0.5], [0.7, 0.5, 0.5, 0]];

    _animationSpeed = [0.1];

    _randomDirectionPeriod = 0;

    _randomDirectionIntensity = 0;

    _onTimerScript = "";

    _beforeDestroyScript = "";

    _follow = _this;

    _angle = 0;

    _onSurface = false;

    _bounceOnSurface = 0;

    _emissiveColor = [[0,0,0,1]];

    //Lightning Code

    _s_1_elec = "#particlesource" createVehicleLocal _boxPos;

    _s_1_elec setParticleCircle [0, [5, 0, -2]];

    _s_1_elec setParticleRandom [0, [0.25, 0.25,0], [0.175, 0.175, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];

    _s_1_elec setParticleParams [["\A3\data_f\blesk1",1, 0,1],

    _animationName,_particleType,_timerPeriod,_lifeTime,_position,_moveVelocity,_rotationVelocity,_weight,_volume,_rubbing,_scale,_color,_animationSpeed,_randomDirectionPeriod,

    _randomDirectionIntensity,_onTimerScript,_beforeDestroyScript,_follow,_angle,_onSurface,_bounceOnSurface,_emissiveColor];

    _s_1_elec setDropInterval 0.05;

    _s_1_light = "#lightpoint" createVehicleLocal _boxPos;

    _s_1_light setLightBrightness 1;

    _s_1_light setLightColor [0.8,0.8,1];

    _s_1_light lightAttachObject [_box, [0,0,0]];

    sleep 1.8;

    deleteVehicle _s_1_elec;

    deleteVehicle _s_1_light;

};

 

 

Here's the entire "lightsout.sqf" I used for the mission. Again, probably not the best or up to date. But it worked lol
 

Spoiler

 

_lampArray = [lights,lights_1,lights_2,lights_3,lights_4,lights_5,lights_6,lights_7,lights_8,lights_9,lights_10,lights_11,lights_12,lights_13,lights_14,lights_15,lights_16,lights_17];

//Lamp array can be edited to add more Light logics

sleep 0.80;

_pos = position lights;

_bomb = "HelicopterExploSmall" createVehicle _pos;

Lightlist = ["Lamps_base_F","Land_LampStreet_small_F","Land_LampStreet_F","Land_LampDecor_F","Land_LampHalogen_F","Land_LampHarbour_F","Land_LampShabby_F","Land_fs_roof_F"];

//Additional class names may need to be added if custom lamps were used


 

xian_Sparks_fnc = {

    _box = _this select 0;

    _boxPos = position _box;

    //Lightning Variables

    _animationName = "";

    _particleType = "SpaceObject";

    _timerPeriod = 0.25;

    _lifeTime = 0.12;

    _position = [0,0,0];

    _moveVelocity = [0,0,0];

    _rotationVelocity = 0;

    _weight = 25;

    _volume = 10;

    _rubbing = 7.9;

    _scale = [0.01,0.01,0.01,0];

    _color = [[0.4, 0.1, 0.1, 1], [0.4, 0.25, 0.25, 0.5], [0.7, 0.5, 0.5, 0]];

    _animationSpeed = [0.1];

    _randomDirectionPeriod = 0;

    _randomDirectionIntensity = 0;

    _onTimerScript = "";

    _beforeDestroyScript = "";

    _follow = _this;

    _angle = 0;

    _onSurface = false;

    _bounceOnSurface = 0;

    _emissiveColor = [[0,0,0,1]];

    //Lightning Code

    _s_1_elec = "#particlesource" createVehicleLocal _boxPos;

    _s_1_elec setParticleCircle [0, [5, 0, -2]];

    _s_1_elec setParticleRandom [0, [0.25, 0.25,0], [0.175, 0.175, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];

    _s_1_elec setParticleParams [["\A3\data_f\blesk1",1, 0,1],

    _animationName,_particleType,_timerPeriod,_lifeTime,_position,_moveVelocity,_rotationVelocity,_weight,_volume,_rubbing,_scale,_color,_animationSpeed,_randomDirectionPeriod,

    _randomDirectionIntensity,_onTimerScript,_beforeDestroyScript,_follow,_angle,_onSurface,_bounceOnSurface,_emissiveColor];

    _s_1_elec setDropInterval 0.05;

    _s_1_light = "#lightpoint" createVehicleLocal _boxPos;

    _s_1_light setLightBrightness 1;

    _s_1_light setLightColor [0.8,0.8,1];

    _s_1_light lightAttachObject [_box, [0,0,0]];

    sleep 1.8;

    deleteVehicle _s_1_elec;

    deleteVehicle _s_1_light;

};

 

xian_GroundSparks_fnc = {

    private _sparkSource = _this select 0;

    private _sparkPos = position _sparkSource;

    private _xvalue = ((random 2)+0.6);

    private _yvalue = ((random 2)+0.6);

    private _zvalue = 0;

    private _spark = "#particlesource" createVehicleLocal [0,0,0];

    _spark setParticleCircle [0, [0, 0, 0]];

    _spark setParticleRandom        /*LifeTime*/        [6,

                                    /*Position*/        [0,0,0],

                                    /*MoveVelocity*/    [_xvalue,_yvalue,_zvalue],

                                    /*rotationVel*/     30,

                                    /*Scale*/       0.25,

                                    /*Color*/       [0,0,0,1],

                                    /*randDirPeriod*/   0.50,

                                    /*randDirIntesity*/ 0.50,

                                    /*Angle*/       30];

    _spark setParticleParams [["\A3\data_f\cl_water", 1, 0, 1], "", "Billboard", 1, 3, [0.10, 0, 0.90],[(random 0.50),(random 0.50),-2], 500, 1050, 7.9, 0.1, [0.10,0.10], [[0.75,0.75,1, 1], [0.75,0.75,1,1]], [0.16], 0, 0, "", "", _sparkSource,0,false,0.20,[[0,0,0,1]]];

    _spark attachTo [_sparkSource,[0,0,0]];

    _spark setDropInterval 0.001;

    uiSleep 0.15;

    deleteVehicle _spark;

};

 

_randomTime = (random 1 + 1);

 

{

    _lamps = nearestObjects [_x,Lightlist,100];

    [_x,["bulb_burst",200,1]] remoteExec ["say3D",0];

    {_x setHit ["light_1_hitpoint",0.99]} forEach _lamps;

    {_x setHit ["light_2_hitpoint",0.99]} forEach _lamps;

    {_x setHit ["light_3_hitpoint",0.99]} forEach _lamps;

    {_x setHit ["light_4_hitpoint",0.99]} forEach _lamps;

    [_x] spawn xian_Sparks_fnc;

    [_x] spawn xian_GroundSparks_fnc;

    sleep _randomTime;

} forEach _lampArray;





 

 

  • Thanks 2

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

×