mandoble 1 Posted January 25, 2007 Just a curiosity. This is how many people determine it: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _plane = _this select 0 _sea = "EmptyDetector" createVehicle [0,0,0] _ground = "logic" createVehicle [0,0,0] #check _posplane = getPos _plane _sea setPos [_posplane select 0, _posplane select 1,0] _ground setPos [_posplane select 0, _posplane select 1,0] _distance = _sea distance _ground ?_distance > 1:hint "Over land" ?_distance <= 1:hint "Over sea" ~1 goto "check" The problem is that the logic over sea will never go exactly to height 0, as real sea level changes with the time. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _plane = _this select 0 _sea = "EmptyDetector" createVehicle [0,0,0] _ground = "logic" createVehicle [0,0,0] #check _posplane = getPos _plane _sea setPos [10,10,0] _ground setPos [10,10,0] _sealevel = _sea distance _ground _sea setPos [_posplane select 0, _posplane select 1,0] _ground setPos [_posplane select 0, _posplane select 1,0] _distance = _sea distance _ground ?_distance > (_sealevel + 1):hint "Over land" ?_distance <= (_sealevel + 1):hint "Over sea" ~1 goto "check" Share this post Link to post Share on other sites
fasad 1 Posted January 26, 2007 this is how the ecp rotor_wash effect checks whether the player is over water: Quote[/b] ]_sensor = "EmptyDetector" createVehicle [0,0,0]_calcH = {private["_result"]; _sensor setpos [getpos _unit select 0, getpos _unit select 1]; _result = getpos _sensor select 2; _result}; ... ... ? abs (call _calcH) <= 2.4:goto "water" seems simple enough. how precise do you need to be? Share this post Link to post Share on other sites
mandoble 1 Posted January 26, 2007 That's the problem, sealevel of sea itself is not always near 2.4m, it depends a lot on the time of the day. If you want to create dust or water trails for a fast low level flying object, you need to know exactly over what is your object every time. Else you may end generating water trail over beach sand or green dust over water Share this post Link to post Share on other sites
baddo 0 Posted January 26, 2007 Maybe build up a lookup table for different islands; depending on date&time, where is sea level. Lots of work no doubt about that, might need quite big arrays depending on how much the tide varies between dates. Also how could you get the current date into your script? Does date affect tide or just time of day? I recall date too affects tide but I could be wrong. Maybe some easier solution can be found. Edit: Hey can you put some object floating into the water and check its height position, couldn't that be used? Boat? An invisible, small boat? Or better to use existing OFP boat, create it into corner of map, get its position, work out the difference to actual sea level for that boat type. Share this post Link to post Share on other sites
mandoble 1 Posted January 26, 2007 Well I already posted the solution, it is the second script of first post. It was just a curiosity to keep in mind when you need to make sea level calculations The object over the water to calculate its altitude over sea level is just the ground logic. You place the sensor just at 0m, then the logic at 0m (but the logic will keep just over the water, not 0m), then you get the distance and it is the ASL altitude of the sea itself. Share this post Link to post Share on other sites
baddo 0 Posted January 26, 2007 Oh yes Seems like I somehow missed the gamelogic in your script while reading through it, and I didn't realize it is the solution. Share this post Link to post Share on other sites