Ground Fog - Guide

Andrew_S90

Valued Member!
Staff member
Hey guys, I will be showing you how to add fog to your server that looks like the fog from breaking point DayZ mod. It looks like this.. covering Balota airfield.


To add fog to your server you will need to only need to edit your mission.sqm file and add one more file.
Before I teach you guys how to add fog I need to explain what it is and what it does (might seem like something stupid to do.. but it will help with understanding later) The fog is spawned around a set point. For an example, 4743.666,9,2542.4561 is a point at Balota Airfield where the fog above is spawning.
I will teach you how to spawn/put fog in two different ways.
You place fog on points and it spreads out in a set distance in x and y, so you can place it in certain places on the map. >Airfields, Big cities, Forests
OR you can place one point of fog in the center of the map and have it spread around the whole map.. giving an eerie look where ever you go.
On to what you have to do

First you will need to create a file called fog.sqs and paste this inside of it (I will also attach my fog file for you guys at the bottem.. to make it easier)

Code:
_Center = _this select 0
_dist1=_this select 1
_dist2= _this select 2
 
_height=-0.3
_Rradius=250
#bigloop
@(Player distance _Center)<_dist2
_i=0
#loop
_Cloudalpha=1
?((Player distance _Center)>_dist1):_Cloudalpha= 1-(((Player distance _Center) - _dist1)/(_dist2- _dist1))
_radius=(random 10)+random _Rradius
_angle=(random 360)
_size = 5
_col = 1
_CC=[_col,_col,_col,.3*_Cloudalpha]
drop ["\ca\data\cl_basic", "", "Billboard", 8+random 1,8+random 1,  [(getpos Player select 0)+_radius*(sin(_angle)),(getpos Player select 1)+_radius*(cos(_angle)),_height],[0,0,0],5 , 0.2, 0.1568, 0,[_size], [[_col,_col,_col,0],_CC,_CC,_CC,_CC,_CC,_CC,[_col,_col,_col,0]], [0],0,0,"", "",""]
_i=_i+1
?(_i<1800):goto "loop"
~1
goto "bigloop"
Explaining what some values you can edit in here (best to leave them alone.. but are editable if needed)
height - the spawn height of the clouds.. best to have that under zero for the effect of being ground fog..

Pack that into your mission.pbo - you don't need to edit it more.

Now how to place fog around the map!

Method One.
To place fog in packets around the map, so they are only in certain points and not everywhere you open your mission.sqm file scroll all the way down.. past the first class items 0-99 to the next class items starting at class item1 which looks like this at about line 1146 (using notepad++)
AFTER THIS IS WHERE YOU START EDITING FOG*** Posting this to help you guys find where you need to edit - Using cntrl+f or however you go about it
Code:
class Item1
        {
            side="LOGIC";
            class Vehicles
            {
                items=1;
                class Item0
                {
                    position[]={708.96582,35.858719,3533.1272};
                    id=50;
                    side="LOGIC";
                    vehicle="FunctionsManager";
                    leader=1;
                    lock="UNLOCKED";
                    skill=0.60000002;
                };
            };
        };
AFTER THE LAST CLOSURE IS WHERE YOU EDIT
Code:
class Item2
{
side="LOGIC";
class Vehicles
{
items=1;
class Item0
{
position[]={4743.666,9,2542.4561};
id=1;
side="LOGIC";
vehicle="Logic";
leader=1;
skill=0.60000002;
init="[this,100,150] exec ""fog.sqs""";
};
};
};
class Item3
{
side="LOGIC";
class Vehicles
{
items=1;
class Item0
{
position[]={4838.4629,5.7515168,2328.8635};
id=2;
side="LOGIC";
vehicle="Logic";
leader=1;
skill=0.60000002;
init="[this,100,150] exec ""fog.sqs""";
};
};
};
Paste that before classmarkers but still in the class items section (looking at mission.sqm you will understand)
That will spawn one set of fog at balota airfield near the ATC tower and one near the industrial hangers (based on coordinates - edit to whatever you want)
class Item1 is the functionsmanager so class item2 and above can be anything

TO EDIT FOG LOCATION/VALUES
Edit the Coordinates based on ARMA 2 COORDS - {X,Z,Y} On where you want the fog to be
id=1 Change that for each set of fog you need to add +1 to each set of fog placements you add so my first fog is id=1 then the second fog is id=2 and so on (3rd fog would be id=3 etc..)
Down to the last bit of code.. where it says [this,100,150] is where you can edit how big the fog is, increasing to how far it spawns. [X,Y]

LAST PART! VERY IMPORTANT
Edit this number based on how much fog you add at the points I showed you above.
Lets say you add 2 spots of fog like I did.
On the top of mission.sqm it says class Groups on line 33 One line below this it says items=2 which accounts for the first classitem 0-99 and the second set which we are editing.
For each placement of fog you add you need to add +1 to that items= If you added 2 fog placement points edit that number to items=4.. if you added 3 fog placements edit that to be items=5 and so on!

Method Two.
If you want to place fog through out the entire map follow this!

You edit under the same values as before ^ follow above
For data points I choose stary since its almost the center
Code:
class Item2
        {
            side="LOGIC";
            class Vehicles
            {
                items=1;
                class Item0
                {
                    position[]={6288.5488,304.98645,7825.8896};
                    id=3;
                    side="LOGIC";
                    vehicle="Logic";
                    leader=1;
                    skill=0.60000002;
                    init="[this,10000,10000] exec ""fog.sqs""";
                };
            };
        };
Change your items= to items=3 under class groups ^ addressed above and you are done!




To set a fog trigger to spawn fog during the night only see this post (bottom of the page)

Enjoy

Let me know if you need me to be clearer on any parts of this.. Thanks




I cannot upload a .sqs file so please change it to a .sqs file after you download or make your own shown above!
 

Attachments

Is this what it'll look like in my mission.sqm

Why does it look like ""fog.sqs""" rather than "fog.sqs" ?

Code:
                class Item99
                {
                    position[]={-7100.854,16.640259,17337.738};
                    azimut=-17.0839;
                    id=95;
                    side="WEST";
                    vehicle="Survivor1_DZ";
                    player="PLAY CDG";
                    skill=0.60000002;
                    init="this enableSimulation false;this allowDammage false;this disableAI 'FSM';this disableAI 'ANIM';this disableAI 'MOVE';";
                };
            };
        };
        class Item1
        {
            side="LOGIC";
            class Vehicles
            {
                items=1;
                class Item0
                {
                    position[]={-5067.9063,18.804712,17270.482};
                    id=50;
                    side="LOGIC";
                    vehicle="FunctionsManager";
                    leader=1;
                    lock="UNLOCKED";
                    skill=0.60000002;
                };
            };
        };
        class Item2
        {
            side="LOGIC";
            class Vehicles
            {
                items=1;
                class Item0
                {
                    position[]={8278.7617,14.67,2390.874};
                    id=1024;
                    side="LOGIC";
                    vehicle="Logic";
                    leader=1;
                    skill=0.60000002;
                    init="{_x setDamage 1} forEach nearestObjects [getPos this,[],20];";
                };
            };
        };
        class Item3
        {
            side="LOGIC";
            class Vehicles
            {
                items=1;
                class Item0
                {
                    position[]={9106.2754,17.508736,2756.3599};
                    id=1025;
                    side="LOGIC";
                    vehicle="Logic";
                    leader=1;
                    skill=0.60000002;
                    init="{_x setDamage 1} forEach nearestObjects [getPos this,[""Land_Mil_Barracks_i""],50]";
                };
            };
        };
        class Item4
        {
            side="LOGIC";
            class Vehicles
            {
                items=1;
                class Item0
                {
                    position[]={10751.108,6.4000001,990.1853};
                    id=1026;
                    side="LOGIC";
                    vehicle="Logic";
                    leader=1;
                    skill=0.60000002;
                    init="{_x setDamage 1} forEach nearestObjects [getPos this,[""House""],3]";
                };
            };
        };
        class Item5
        {
            side="LOGIC";
            class Vehicles
            {
                items=1;
                class Item0
                {
                    position[]={6760.0996,0,7975.769};
                    id=1027;
                    side="LOGIC";
                    vehicle="Logic";
                    leader=1;
                    skill=0.60000002;
                    init="[this,12000,12000] exec ""fog.sqs""";
                };
            };
        };
    };
    class Vehicles
    {
        items=2984;
        class Item0
        {
            position[]={8874.4424,14.730334,2165.959};
            id=101;
            side="EMPTY";
            vehicle="Rubbish1";
            skill=1;
        };
 

Andrew_S90

Valued Member!
Staff member
Is this what it'll look like in my mission.sqm

Why does it look like ""fog.sqs""" rather than "fog.sqs" ?

Code:
                class Item99
                {
                    position[]={-7100.854,16.640259,17337.738};
                    azimut=-17.0839;
                    id=95;
                    side="WEST";
                    vehicle="Survivor1_DZ";
                    player="PLAY CDG";
                    skill=0.60000002;
                    init="this enableSimulation false;this allowDammage false;this disableAI 'FSM';this disableAI 'ANIM';this disableAI 'MOVE';";
                };
            };
        };
        class Item1
        {
            side="LOGIC";
            class Vehicles
            {
                items=1;
                class Item0
                {
                    position[]={-5067.9063,18.804712,17270.482};
                    id=50;
                    side="LOGIC";
                    vehicle="FunctionsManager";
                    leader=1;
                    lock="UNLOCKED";
                    skill=0.60000002;
                };
            };
        };
        class Item2
        {
            side="LOGIC";
            class Vehicles
            {
                items=1;
                class Item0
                {
                    position[]={8278.7617,14.67,2390.874};
                    id=1024;
                    side="LOGIC";
                    vehicle="Logic";
                    leader=1;
                    skill=0.60000002;
                    init="{_x setDamage 1} forEach nearestObjects [getPos this,[],20];";
                };
            };
        };
        class Item3
        {
            side="LOGIC";
            class Vehicles
            {
                items=1;
                class Item0
                {
                    position[]={9106.2754,17.508736,2756.3599};
                    id=1025;
                    side="LOGIC";
                    vehicle="Logic";
                    leader=1;
                    skill=0.60000002;
                    init="{_x setDamage 1} forEach nearestObjects [getPos this,[""Land_Mil_Barracks_i""],50]";
                };
            };
        };
        class Item4
        {
            side="LOGIC";
            class Vehicles
            {
                items=1;
                class Item0
                {
                    position[]={10751.108,6.4000001,990.1853};
                    id=1026;
                    side="LOGIC";
                    vehicle="Logic";
                    leader=1;
                    skill=0.60000002;
                    init="{_x setDamage 1} forEach nearestObjects [getPos this,[""House""],3]";
                };
            };
        };
        class Item5
        {
            side="LOGIC";
            class Vehicles
            {
                items=1;
                class Item0
                {
                    position[]={6760.0996,0,7975.769};
                    id=1027;
                    side="LOGIC";
                    vehicle="Logic";
                    leader=1;
                    skill=0.60000002;
                    init="[this,12000,12000] exec ""fog.sqs""";
                };
            };
        };
    };
    class Vehicles
    {
        items=2984;
        class Item0
        {
            position[]={8874.4424,14.730334,2165.959};
            id=101;
            side="EMPTY";
            vehicle="Rubbish1";
            skill=1;
        };
I am not sure, thats how it was when I originally found it and modified it, the weird quotation marks work though, feel free to try with only one on each side though, I am sure it wont make much of a difference
 

Andrew_S90

Valued Member!
Staff member
did you edit your items= at the top to +1 to incorporate the fog? you could post your mission.sqm and I could look at it if you would like
also did you edit the fog.sqs file at all?


I can also post both of mine if you would like to see how I did it, but its pretty much what I explained above


Thats how it should look but I am not sure why your id numbers are so high, but other than that everything looks fine
 

Andrew_S90

Valued Member!
Staff member
I used the fog.sqs that you linked.

Here is what I was trying to use. For w.e reason can't UL the .sqm, so her eit is in .txt
did you change the fog.sqf file that I attached to the thread to fog.sqs? because the file I uploaded and the file you need are different, you cant upload .sqs files so that might be your problem
 
Yes, it is a fog.sqs. I changed it once I got it. It isn't that. Perhaps its the item count you're talking about, can you tell me where in the mission.sqm i'd change that count.
 

Andrew_S90

Valued Member!
Staff member
Code:
randomSeed=11171215;
    class Intel
    {
        briefingName="Celle";
        briefingDescription="Zeds, Zeds Everywhere!";
        startWeather=0.00;
        forecastWeather=0.00;
        year=2013;
        month=8;
        day=13;
        hour=12;
    };
    class Groups
    {
        [COLOR=#ff0000]items=5;[/COLOR]
        class Item0
        {
            side="WEST";
            class Vehicles
            {
                items=100;
                class Item0
                {
                    position[]={-7100.814,16.639297,17337.652};
                    azimut=-17.0839;
                    id=11;
                    side="WEST";
                    vehicle="Survivor1_DZ";
                    player="PLAY CDG";
                    skill=0.60000002;
                    init="this enableSimulation false;this allowDammage false;this disableAI 'FSM';this disableAI 'ANIM';this disableAI 'MOVE';";
                };
                class Item1
Change the data value in red to 6 - then it should work (its on line 140)

You are on celle correct? I havent tested the fog out on other maps so let me know what happens, might be chernarus only, because you seem to have a lot of edited stuff :p
 
Thanks it works !
Preview in video (forest + night + fogs) :

I just have one little problem, its when you are in a car, and drive, you see many little little fogs. Could be much larger for vehicle speed and height.
:) thx
 

Andrew_S90

Valued Member!
Staff member
Awesome :D glad it works! Did you find out how to set a trigger for it only to appear at night? or does it just happen to be night?
 

Fr1nk

Valued Member!
Hey nice script. I sorta got it to work but the effects on the ground happen in small spots all over like this:



Did I do something wrong, or is there interference from something else?
 
Hey nice script. I sorta got it to work but the effects on the ground happen in small spots all over like this:



Did I do something wrong, or is there interference from something else?
I have the same problem, thats why I was asking for much larger fogs, you can see my screens here: http://imgur.com/a/UoYac#0 (1 with a horizontal ground (perfect) and 1 with curvy ground (sorry for my english))

@Fr1nK :
I set it all the time.
 

Fr1nk

Valued Member!
I have the same problem, thats why I was asking for much larger fogs, you can see my screens here: http://imgur.com/a/UoYac#0 (1 with a horizontal ground (perfect) and 1 with curvy ground (sorry for my english))

@Fr1nK :
I set it all the time.
I also used method 2 (fog all over map).

Deezit, your fog seems to be ok though? My little fog spots don't grow..they kinda move a bit but that's all.

edit: nvm it's late and I didn't pay close enough attention to your first screenshot
 

Andrew_S90

Valued Member!
Staff member
Hey nice script. I sorta got it to work but the effects on the ground happen in small spots all over like this:



Did I do something wrong, or is there interference from something else?
That happens as you get farther away from the source, placing all around the map works best if you dont want this
 

Fr1nk

Valued Member!
Also editing the radius in fog.sqs may get you bigger fog clouds, although I am not sure! Feel free to test this

Yeah, I just noticed that...might experiment with that tomorrow.

Also, for:

Code:
init="[this,10000,10000] exec ""fog.sqs""";
Would increasing the 10000 make any difference?

Thanks
 

Andrew_S90

Valued Member!
Staff member
Yeah, I just noticed that...might experiment with that tomorrow.

Also, for:

Code:
init="[this,10000,10000] exec ""fog.sqs""";
Would increasing the 10000 make any difference?

Thanks
That is just the X and Y values that the fog spreads around, so it will spawn 10K from that point, it will make like a cube of fog, so it will make the spawn distance increase, not cloud size
 
Modification for night only ground fogs :

your fogs.sqs :
Code:
_Center = _this select 0
_dist1=_this select 1
_dist2= _this select 2
 
?(count _this > 3):_endNight=_this select 3;_startNight=_this select 4; goto "nighttest"
?(count _this == 3):goto "bigloop"
 
#nighttest
_hours = Date select 3
?((_hours>=_endNight) && (_hours<_startNight)): goto "waittoactivate"
 
#bigloop
@(Player distance _Center)<_dist2
_i=0
#loop
_height=-0.3
_Rradius=180
_Cloudalpha=1
?((Player distance _Center)>_dist1):_Cloudalpha= 1-(((Player distance _Center) - _dist1)/(_dist2- _dist1))
_radius=(random 10)+random _Rradius
_angle=(random 360)
_size = 5
_col = 1
_CC=[_col,_col,_col,.3*_Cloudalpha]
drop ["\ca\data\cl_basic", "", "Billboard", 8+random 1,8+random 1,  [(getpos Player select 0)+_radius*(sin(_angle)),(getpos Player select 1)+_radius*(cos(_angle)),_height],[0,0,0],5 , 0.2, 0.1568, 0,[_size], [[_col,_col,_col,0],_CC,_CC,_CC,_CC,_CC,_CC,[_col,_col,_col,0]], [0],0,0,"", "",""]
_i=_i+1
?(_i<1800):goto "loop"
~1
?(count _this == 3): goto "bigloop"
goto "nighttest"
 
 
 
#waittoactivate
~300
goto "[B][COLOR=#ff0000]nighttest[/COLOR][/B]"
mission.sqm for fogs ONLY FROM 7pm to 7am :
Code:
init="[this, 10000, 10000, 7, 19] exec ""fogs.sqs""";
mission.sqm for fogs ALL THE TIME :
Code:
init="[this, 10000, 10000] exec ""fogs.sqs""";
If you have set the hours for the night, it will recheck each 5 minutes (line 35)

I also have modified the radius on my server, set to 180, looks better for me. Hope it helps !
Result : http://imgur.com/a/PcONs
EDIT: last line its not : goto "bigloop" but goto "nighttest"
 
Top