# SetTerrainAbove20 #By Vertu. $HEIGHT:42 #--Integer, incramented by +-1 via hotkeys. $$BUFFER:2 if(<-inputDelay gt0) <-inputDelay 1 - ->inputDelay endif if(<-phase2 ! GetKeyDown("Space" true) &&) GetPointerTerrainCoords ->y1 ->x1 if(IsV2InMap(V2(<-x1 <-y1))) true ->phase2 Trace4("Lower Coord: " <-x1 " " <-y1) else Trace("That wasn't in the map. Try again.") endif else if(<-phase2 GetKeyDown("Space" true) &&) GetPointerTerrainCoords ->y2 ->x2 if(IsV2InMap(V2(<-x2 <-y2))) false ->phase2 Trace4("Upper Coord: " <-x2 " " <-y2) else Trace("That wasn't in the map. Try again.") endif endif endif if(GetKeyDown("Backspace" true) <-x1 neq(-1) && <-x2 neq(-1) &&) <-y2 1 add <-y1 do <-x2 1 add <-x1 do while I J GetTerrain <-setHeight neq repeat SetTerrainInRange(I J <-setHeight dup 0 false 1) endwhile loop loop ClearTraceLog Trace4(<-keyBindText " Height set to " <-setHeight ".") EditAddUndo(0) endif if(GetKeyDown("Keypad0" true)) ClearTraceLog Trace4(<-keyBindText " Height set to " <-setHeight ".") GetPointerTerrainCoords ->posZ ->posX FloodFillTerrain(<-posX <-posZ GetTerrain(<-posX <-posZ) GetTerrain(<-posX <-posZ) 1 + 10,000,000) ->cells do(GetListCount(<-cells) 0) EV2(<-cells[I]) ->cellyZ ->cellyX while <-cellyX <-cellyZ GetTerrain <-setHeight neq repeat SetTerrainInRange(<-cellyX <-cellyZ <-setHeight dup 0 false 1) endwhile loop Trace3("Completed flood fill to height" <-setHeight ".") EditAddUndo(0) endif if(GetKey("PageUp" false) <-setHeight lt(100) && <-inputDelay eq0 &&) <-setHeight 1 + ->setHeight ClearTraceLog Trace4(<-keyBindText " Height set to " <-setHeight ".") <-BUFFER ->inputDelay endif if(GetKey("PageDown" false) <-setHeight gt0 && <-inputDelay eq0 &&) <-setHeight 1 - ->setHeight ClearTraceLog Trace4(<-keyBindText " Height set to " <-setHeight ".") <-BUFFER ->inputDelay endif :Once <-HEIGHT ->setHeight "Key binds: SpaceBar to specify coordinates, then backspace to set terrain as a rectangle. PageUp and PageDown to increase and decrease set terrain height. Pressing Keypad0 will conduct a flood-fill to set terrain to specified height." ->keyBindText Trace(<-keyBindText) Trace3("Height set to " <-HEIGHT ".") -1 ->x1 -1 ->x2 -1 ->y1 -1 ->y2