Jump to content
Sign in to follow this  
cobra5000

Flood effect

Recommended Posts

Do you know how i make flood on any ARMA2 island just like in ACR DLC?

Share this post


Link to post
Share on other sites

DLC just came out so I dont think many people have figured this out yet. I'd guess they lowered the elevation of the map below sea level.

Share this post


Link to post
Share on other sites

It's actually 100x100m 'ponds' placed in a grid to cause the flooding as I've understood. Got no details on the exact way to cause it though.

Share this post


Link to post
Share on other sites

could be an editor object, try looking under misc objects, or in a new category (if there is one) if not, try finding the classname of it (could be a hidden object like the invisible soldier and invisible door classes)

Share this post


Link to post
Share on other sites

In the "Empty" part of the units tab there is an item called "POND Verticales". No Verticales is not a spelling mistake, its labeled that.

Share this post


Link to post
Share on other sites

The object's class name is: pond_ACR

Here is the flood mission that was in the missions_acr.pbo mission 'There will be flood'

Missing a chunk of code but i'm still going through it with a text editor because they changed the headers in their ACR content so Eliteness and cpbo can't extract it.

But overall works and will give you a sense on how they do it, i'm sure with a few days someone will have a better automated way to generate the 'flood' effect.

http://armafiles.info/floodtest.Woodland_ACR.rar

Did my best to piece it together for a source view.

Edited by Tonic-_-

Share this post


Link to post
Share on other sites

waituntil {alive player};

hint "Flooding!";
flood1 = "pond_acr" createvehicle (getpos loc1); flood1 setpos [position flood1 select 0, position flood1 select 1, -1];

while {true} do {if(position flood1 select 2 < 500) then 
{

flood1 setpos [position flood1 
select 0, position flood1 select 1, (position flood1 select 2) + .02]; hintsilent format["Flood Height: %1",(position 
flood1 select 2)];sleep 1;};

};

Here. This will make a flood at an object named "loc1", and it will give you a hint on the height the flood is at.

I have a question though. How do I script a radius around a position? That way I can script in locations around a circumference of an object, while expanding the radius to make a bomb effect.

Share this post


Link to post
Share on other sites
waituntil {alive player};

hint "Flooding!";
flood1 = "pond_acr" createvehicle (getpos loc1); flood1 setpos [position flood1 select 0, position flood1 select 1, -1];

while {true} do {if(position flood1 select 2 < 500) then 
{

flood1 setpos [position flood1 
select 0, position flood1 select 1, (position flood1 select 2) + .02]; hintsilent format["Flood Height: %1",(position 
flood1 select 2)];sleep 1;};

};

Here. This will make a flood at an object named "loc1", and it will give you a hint on the height the flood is at.

I have a question though. How do I script a radius around a position? That way I can script in locations around a circumference of an object, while expanding the radius to make a bomb effect.

If you're using a trigger you can do:

_areaX = (triggerArea testTrigger) select 0;

_areaY = (triggerArea testTrigger) select 1;

Or if it's a marker...

_areaX = (getMarkerSize "testMarker") select 0;

_areaY = (getMarkerSize "testMarker") select 1;

You can also look over the code BIS uses to create the flood on their mission: 'There will be flood' with the link I provided.

Share this post


Link to post
Share on other sites

Did some messing around with ponds; maybe some will find this useful.

Creates ponds in an area:

private ["_aslHeight","_pond","_yPos","_xPos","_pondSize","_ponds","_centerPosASL","_size","_pondClass","_waterHeightASL","_lenTiles"];

_pondSize = 52;

_centerPosASL = _this select 0;
if (typeName _centerPosASL == "OBJECT") then { _centerPosASL = getPosASL _centerPosASL; };
_size = _this select 1;
_aslHeight = if (count _this > 2) then {_this select 2} else {0.4};

_ponds = [];
_waterHeightASL = (_centerPosASL select 2) + _aslHeight;
_lenTiles = ceil ((_size) / _pondSize);
_ponds resize (_lenTiles * _lenTiles);
_pondClass = "pond_ACR";

_xPos = (_centerPosASL select 0) - (_lenTiles * _pondSize) / 2;
for "_i" from 0 to (_lenTiles-1) do {
_yPos = (_centerPosASL select 1) - (_lenTiles * _pondSize) / 2;
for "_j" from 0 to (_lenTiles-1) do {
	_pond = createVehicle [_pondClass, [0,0,0], [], 0, "NO_COLLIDE"];
	_pond setDir 0;
	_pond setPosASL [_xPos, _yPos, _waterHeightASL];
	_yPos = _yPos + _pondSize;
	//hint str (_i * _lenTiles + _j);
	_ponds set [_i * _lenTiles + _j, _pond];
};
_xPos = _xPos + _pondSize;
};

_ponds

Raises or lowers ponds over time:

private ["_pondPos","_forEachIndex","_rise","_totalTime","_interval","_ponds","_steps","_risePerStep","_newPositions"];

_ponds = _this select 0; //Ponds to manage
_rise = _this select 1;   //How many m to rise [meters]
_totalTime = _this select 2;  //How long time to take to do it [seconds]

//Find interval - 0.015M per change is nice
_interval = 0.015 / (_rise / _totalTime);

//But never more than twice per seconds
_interval = _interval max 0.5;

_steps = _totalTime / _interval;
_risePerStep = _rise / _steps;

_newPositions = [];
_newPositions resize (count _ponds);

//Fill x, y, positions
{
_pondPos = getPosASL _x;
_newPositions set [_forEachIndex, [_pondPos select 0, _pondPos select 1, _pondPos select 2]];
} forEach _ponds;

for "_i" from 0 to _steps do {
//Raise all positions
{
	_x set [2, (_x select 2) + _risePerStep];
} forEach _newPositions;
//Repos ponds
{
	_x setPosASL (_newPositions select _forEachIndex);
} forEach _ponds;

sleep _interval;
};

EDIT - Added example:

Let's call the first file createPonds.sqf and the other raisePonds.sqf. Then how you could use them:

//Create ponds centered on someObject that covers a square 500x500M (minimum, size ponds are 52x52 it will actually be 520x520m) and 0.4m above ground (measured at someObjects height).
ponds = [someObject, 500, 0.4] call compile preProcessFile "createPonds.sqf";
//Now to flood the area: will raise the flood 5m over a period of  600s = 10min roughly.
[ponds, 5, 10*60] execVM "raisePonds.sqf";

Edited by Muzzleflash

Share this post


Link to post
Share on other sites

mhhhhhh creating rivers? any one? Takistan, zagrabad? or other maps, new maps with rivers in them. maybe the time of making rivers with the ocean is over.

Share this post


Link to post
Share on other sites

Posting in an epic thread.

Parts of this should be stickied or added to the wiki or something! Thanks to the explorers who are sharing their code!

Share this post


Link to post
Share on other sites
Posting in an epic thread.

Parts of this should be stickied or added to the wiki or something! Thanks to the explorers who are sharing their code!

Definitely an epic thread.

Share this post


Link to post
Share on other sites

Making rivers should be possible, maybe even water falls with the setvector commands or pitches. This is something BIS did well!

They should make a module that floods an area given the parameters of the area, and height.

Share this post


Link to post
Share on other sites

This still suffers some problems though. It is totally possible to walk under the water for hours, to shoot, even.

Share this post


Link to post
Share on other sites
This still suffers some problems though. It is totally possible to walk under the water for hours, to shoot, even.

Go Navy SEALS! :)

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
Sign in to follow this  

×