====== Scripts > Cone overlay ====== ^ Description | Add a cone to the heightfield at a user-specified position, with user-specified radius and height. | ^ Author | [[user>Aaron]] | ^ Created | 2011/01/04 | ^ Updated | 2011/01/04 | ^ Requires | L3DT v2.9 build 4 or later | ^ Download | {{:scripts:cone overlay.zs|cone overlay.zs}} | ===== Script contents ===== // Author: A. Torpy // Created: 04 Jan 2011 // exit immediately if HF is not initialised hvar pHF set pHF assert "Heightfield is not initialised!" // initiailise the settings int ls.x_pos_px int ls.y_pos_px int ls.radius_px float ls.height_m set ls.x_pos_px
2> set ls.y_pos_px
2> set ls.radius_px 100 set ls.height_m 1000 // edit settings UI, and exit if cancelled if > return -1 endif // store a backup L3DTio_Backup.BackupMap "HF" "Apply cone to HF" 0 "view.ShowMap \"HF\"" int PEAK_MODE set PEAK_MODE 0 // 0 = cone, 1 = , 2 = sinusioid, 3 = pseudo-Gaussian int MIX_MODE set MIX_MODE 0 // 0 = add, 1 = subtract, 2 = max, 3 = min, 4 = replace, 5 = multiply map m if > echo "Error: cannot generate peak overlay in 'Cone overlay.zs'" return -1 endif // apply the peak if 0 0>> echo "Error: cannot combine peak overlay with HF in 'Cone overlay.zs'" return -1 endif // refresh the heightfield view.ShowMap "HF" ===== Comments ===== ==== Position ==== The position of the cone is set using the ''x_pos_px'' and ''y_pos_px'' inputs. These are measured from the bottom-left of the map, and are in units of pixels. The default value is the centre of the heightfield. ==== Peak type ==== By default, the peak added to the heightfield is a //cone//. You can change the peak type using the ''PEAK_MODE'' variable, which can have the following values: ^ Value ^ Result ^ | 0 | cone | | 1 | sinusiod | | 2 | pseudo Gaussian | ==== Overlay type ==== By default, the peak is //added// to the heightfield. You can change the overlay mode using the ''MIX_MODE'' variable, which can have the following values: ^ Value ^ Result ^ | 0 | add | | 1 | subtract | | 2 | maximum | | 3 | minimum | | 4 | replace | | 5 | multiply | ==== Undo ==== The script automatically creates an undo point before applying the peak. Thus, if you do not like the peak position, height or radius, you may undo the action by pressing CTRL+Z or by selecting the '//Edit->Undo//' menu item.