OK, I didn't anticipate a new update this quick, but looking at Ian Ross's yacht image made me think that it would look better if objects in the water looked like they were interacting with the water. So here is a new script to do that, called "Combo waves". It has a new icon to avoid confusion with the "waves" script.
I considered tagging this onto the end of the "waves" topic. But I think the script is different enough to warrant starting fresh. The interface for generating random waves is identical, and you should follow the instructions posted on the "waves" post
https://www.anim8or.com/smf/index.php/topic,6025.0.html.
If you don't edit the script itself then this script is indistinguishable from my "waves" script. However I have modified the code to allow wave sources to be easily added.
There are two types of wave that can be added:
1) Decaying waves: These are best for boat hulls, drips, etc.
2) Immortal waves: These never reduce in size, and are good for wind produced waves - best if they are placed outside the visible area of the mesh.
As with the original "waves" script the user can play with the run time parameters to create random weather. The values plugged into the "Parametric Plug-in Editor" only act on the randomly generated waves, not the hard coded waves (actually you can write code to read $XTiles, $YTiles, and potentially other passed variables, if you want to do clever things with your hard coded waves).
To add hard coded waves look for the following comment block in the script:
"
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Start of additional hard coded waves block
///////////////////////////////////////////////////////////////////////////////
"
Under this there are two sub sections:"
///////////////////////////////////////////////////////////////////////////////
// Add additional hard coded non-decaying "immortal" wave origins here if required:
"
You can add as many additional wave origins as you want.
Each "immortal" wave origin is added with a line like:
$WaveOrigins.push( (0,0, 0.25, 5) );In this example push() takes the parameter (0, 0, 0.25, 5). Which means the origin is at x=0,y=0, the wave height = 0.25, and the wave length = 5.
The second sub section is where decaying waves origins are added with a line like:
$DecayingWaveOrigins.push( (10, 20, 40, 7) );In this example push takes the parameter (10, 20, 40, 7). Which means the origin is at X=10, and Y=20, with a height of 40, and a wavelength of 7. (Decaying waves need larger height values than immortal waves do.)
You could place it at the center of the grid with:
$DecayingWaveOrigins.push( ($XTiles/2, $YTiles/2, 40, 7) );In this example the width and height the user sets in the "Parametric Plug-in Editor" are read from $XTiles, and $YTiles, and used to find the centre.
Another variable that may be useful is "Max wave height" stored in $MaxWaveHeight
I mark the end of the area where hard coded waves should be added with the comment block:
"
///////////////////////////////////////////////////////////////////////////////
// End of additional hard coded waves block
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
"
Have fun!
John