Creepy night fog

kaysio

Valued Member!
Create a sqf with code below and name what ever you want and save it in your mission.pbo
Then add this at the bottom of your init,
Code:
 [] ExecVM "what ever you called it.sqf";
fog script
Code:
waitUntil {!isNull player};
//waitUntil {time > 30};

while {alive player}do{

if(daytime<5||daytime>21)then {



setWind [0, -2, true];

_obj = player;

_pos = position (vehicle _obj);

_d = 15;
_h = 12;
_h1 = 8;
_h2 = 4;
_density = 20000;



_fog1 = "#particlesource" createVehicleLocal _pos;
_fog1 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
];
_fog1 setParticleRandom [3, [55, 55, 0.2], [0, 0, -0.1], 2, 0.45, [0, 0, 0, 0.1], 0, 0];
_fog1 setParticleCircle [0.001, [0, 0, -0.12]];
_fog1 setDropInterval 0.01;

_fog2 = "#particlesource" createVehicleLocal _pos;
_fog2 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
];
_fog2 setParticleRandom [3, [55, 55, 0.2], [0, 0, -0.1], 2, 0.45, [0, 0, 0, 0.1], 0, 0];
_fog2 setParticleCircle [0.001, [0, 0, -0.12]];
_fog2 setDropInterval 0.01;

_fog3 = "#particlesource" createVehicleLocal _pos;
_fog3 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
];
_fog3 setParticleRandom [3, [55, 55, 0.2], [0, 0, -0.1], 2, 0.45, [0, 0, 0, 0.1], 0, 0];
_fog3 setParticleCircle [0.001, [0, 0, -0.12]];
_fog3 setDropInterval 0.01;

};





sleep 120;
};
};
 
Works wonders on foot, jumping in a vehicle seems to turn it off on Namalsk. Does it function inside vehicles for you?

You were right, performance does drop a bit on less capable machines. The price you must pay for consistent fog apparently.
 
yea is works on foot, but soon as you drive it disappears on cherno.
I never did get around to fix it, but with luck someone might pick it up and polish it off.
 
If you add in the variables as private []; and then tell it that vehicle player == player this might fix the vehicle issue. Going to test this out man. Good Job!
 
If you add in the variables as private []; and then tell it that vehicle player == player this might fix the vehicle issue. Going to test this out man. Good Job!


That would be great if it works.
It just needs someone with better coding skill than me, to take it to the next level.
 
@kayso

There's a bug in the script. There's a "};" too much or?

Is the time 5:00 to 9:00 p.m. where the fog is supposed to be?

Code:
if(daytime<5||daytime>21)then {
 
Does this happen to function with a clear weather script or will I have to make some adjustments to that file?
 
Does this happen to function with a clear weather script or will I have to make some adjustments to that file?
It doesn't work while in vehicles at the moment so it's not of much use.

If I could figure out what the variable for Player is in DayZ I think I could get Rockhount's Fog to work and follow players around, but so far it only works in the editor. When I kick on a real server it doesn't.
 
I have added the fix so this works for players in vehicles.
Code:
waitUntil {!isNull player};
//waitUntil {time > 30};
private ["_obj","_pos","_d","_h","_h1","_h2","_density","_fog1","_fog2","_fog3","_inVehicle","_vehiclePlayer"]
while {alive player}do{
 
if(daytime<5||daytime>21)then {
 
setWind [0, -2, true];
 
_obj = player;
_pos = position (vehicle _obj);
_inVehicle = (vehicle player != player);
_vehiclePlayer = (vehicle player);
_d = 15;
_h = 12;
_h1 = 8;
_h2 = 4;
_density = 20000;
_fog1 = "#particlesource" createVehicleLocal _pos;
_fog1 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
];
_fog1 setParticleRandom [3, [55, 55, 0.2], [0, 0, -0.1], 2, 0.45, [0, 0, 0, 0.1], 0, 0];
_fog1 setParticleCircle [0.001, [0, 0, -0.12]];
_fog1 setDropInterval 0.01;
 
_fog2 = "#particlesource" createVehicleLocal _pos;
_fog2 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
];
_fog2 setParticleRandom [3, [55, 55, 0.2], [0, 0, -0.1], 2, 0.45, [0, 0, 0, 0.1], 0, 0];
_fog2 setParticleCircle [0.001, [0, 0, -0.12]];
_fog2 setDropInterval 0.01;
 
_fog3 = "#particlesource" createVehicleLocal _pos;
_fog3 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
];
_fog3 setParticleRandom [3, [55, 55, 0.2], [0, 0, -0.1], 2, 0.45, [0, 0, 0, 0.1], 0, 0];
_fog3 setParticleCircle [0.001, [0, 0, -0.12]];
_fog3 setDropInterval 0.01;
 
};
sleep 120;
};
:D untested but should work
 
I have added the fix so this works for players in vehicles.
Code:
waitUntil {!isNull player};
//waitUntil {time > 30};
private ["_obj","_pos","_d","_h","_h1","_h2","_density","_fog1","_fog2","_fog3","_inVehicle","_vehiclePlayer"]
while {alive player}do{
 
if(daytime<5||daytime>21)then {
 
setWind [0, -2, true];
 
_obj = player;
_pos = position (vehicle _obj);
_inVehicle = (vehicle player != player);
_vehiclePlayer = (vehicle player);
_d = 15;
_h = 12;
_h1 = 8;
_h2 = 4;
_density = 20000;
_fog1 = "#particlesource" createVehicleLocal _pos;
_fog1 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
];
_fog1 setParticleRandom [3, [55, 55, 0.2], [0, 0, -0.1], 2, 0.45, [0, 0, 0, 0.1], 0, 0];
_fog1 setParticleCircle [0.001, [0, 0, -0.12]];
_fog1 setDropInterval 0.01;
 
_fog2 = "#particlesource" createVehicleLocal _pos;
_fog2 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
];
_fog2 setParticleRandom [3, [55, 55, 0.2], [0, 0, -0.1], 2, 0.45, [0, 0, 0, 0.1], 0, 0];
_fog2 setParticleCircle [0.001, [0, 0, -0.12]];
_fog2 setDropInterval 0.01;
 
_fog3 = "#particlesource" createVehicleLocal _pos;
_fog3 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
];
_fog3 setParticleRandom [3, [55, 55, 0.2], [0, 0, -0.1], 2, 0.45, [0, 0, 0, 0.1], 0, 0];
_fog3 setParticleCircle [0.001, [0, 0, -0.12]];
_fog3 setDropInterval 0.01;
 
};
sleep 120;
};
:D untested but should work



Code:
if(daytime<5||daytime>21)then {
WORK GOD DAMN IT!
};
:D untested but should work

probably should have tested though.
 
It doesn't work while in vehicles at the moment so it's not of much use.

If I could figure out what the variable for Player is in DayZ I think I could get Rockhount's Fog to work and follow players around, but so far it only works in the editor. When I kick on a real server it doesn't.



player


player can be set to any variable you want -

_unit = player;

_frodo = player;

or just simply

player
 
player


player can be set to any variable you want -

_unit = player;

_frodo = player;

or just simply

player
Does that change with a .FSM? Rockhount's fog works fine when you tie it to an object, but since you can't really layer an entire map in fog spawners without graphics anomalies it won't work well.

His script says you can replace a static object with "player" and make it follow, and it works in the map editor, but once I apply it to a real server it doesn't.
 
I have added the fix so this works for players in vehicles.
Code:
waitUntil {!isNull player};
//waitUntil {time > 30};
private ["_obj","_pos","_d","_h","_h1","_h2","_density","_fog1","_fog2","_fog3","_inVehicle","_vehiclePlayer"]
while {alive player}do{
 
if(daytime<5||daytime>21)then {
 
setWind [0, -2, true];
 
_obj = player;
_pos = position (vehicle _obj);
_inVehicle = (vehicle player != player);
_vehiclePlayer = (vehicle player);
_d = 15;
_h = 12;
_h1 = 8;
_h2 = 4;
_density = 20000;
_fog1 = "#particlesource" createVehicleLocal _pos;
_fog1 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
];
_fog1 setParticleRandom [3, [55, 55, 0.2], [0, 0, -0.1], 2, 0.45, [0, 0, 0, 0.1], 0, 0];
_fog1 setParticleCircle [0.001, [0, 0, -0.12]];
_fog1 setDropInterval 0.01;
 
_fog2 = "#particlesource" createVehicleLocal _pos;
_fog2 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
];
_fog2 setParticleRandom [3, [55, 55, 0.2], [0, 0, -0.1], 2, 0.45, [0, 0, 0, 0.1], 0, 0];
_fog2 setParticleCircle [0.001, [0, 0, -0.12]];
_fog2 setDropInterval 0.01;
 
_fog3 = "#particlesource" createVehicleLocal _pos;
_fog3 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
];
_fog3 setParticleRandom [3, [55, 55, 0.2], [0, 0, -0.1], 2, 0.45, [0, 0, 0, 0.1], 0, 0];
_fog3 setParticleCircle [0.001, [0, 0, -0.12]];
_fog3 setDropInterval 0.01;
 
};
sleep 120;
};
:D untested but should work


You didnt actually do anything other than define some variables. They arent being used by anything in the script. This returns the same exact script has the OP other than privatizing the variables. This is why the fog still works but once you enter a vehicle fog disappears until you exit, then it starts the script over.
 
None of us are perfect man. Retra is a decent fellow but we all make mistakes. But here is a thought ( I myself subscribe to the "not perfect" thing, just learned basics of scripting recently.) couldnt you define
Code:
_inVehicle = (vehicle player != player);
_vehiclePlayer = (vehicle player);
within _pos so it recognizes that a player is in a vehicle as well as not in a vehicle ?
 
Back
Top