This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--extends the GetAllSquaresOfTypeInRingAroundSquare() function in that you can choose the number of tiles to draw which are randomly placed in a ring | |
--rowCoord and colCoord is the square position for the ring centre | |
--numberOfTilesToDraw is the number of tiles you want to draw which are randomly positioned in the ring | |
--chosenTerrain is the terrain to draw | |
--ringRadius is the distance in squares from the center | |
--ringWidth is the thickness of the ring inwards towards the center | |
--terrainTypes is a list of terrain types that can be selcted in the ring. If a potential ring square does not match one of the types it won't be selected | |
--terrainLayoutResult is the coarse grid layout | |
function drawNumberOfTilesInRingRandom(rowCoord, colCoord, numberOfTilesToDraw, chosenTerrain, ringRadius, ringWidth, terrainTypes, terrainLayoutResult) | |
count = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--draws a box starting from top left coordinates and expands down and to the right | |
--copy and paste code to preview at https://aoe4.app/ | |
--rowCoord is the top left row of where your box draw begins | |
--colCoord is the top left col of where your box draw begins | |
--rowSize how far down do you want to draw your box | |
--colSize how far across do you want to draw your box | |
--pickedTerrain the terrainType e.g. tt_lake_shallow | |
function drawBox(rowCoord, colCoord, rowSize, colSize, pickedTerrain) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--tells you what is the closest and furthest edge from a given coordinate | |
--copy and paste code to preview at https://aoe4.app/ | |
--returns the closest edge of a given coordinate | |
--rowCoordinate (int) grid coordinate | |
--colCoordinate (int) grid coordinate | |
--edgesCompare (array) the edges to compare e.g. { 'left', 'right' } what is closest edge, left or right | |
--returns (string) 'top' 'right' 'bottom' 'left' | |
function closestEdge(rowCoordinate, colCoordinate, edgesCompare) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--draws a circle that is filled | |
--copy and paste code to preview at https://aoe4.app/ | |
local function circleFill(centerCoord, tileCoord, radius) | |
dx = centerCoord.row - tileCoord.row | |
dy = centerCoord.col - tileCoord.col | |
distanceSquared = (dx*dx) + (dy*dy) | |
return distanceSquared <= radius*radius | |
end | |
centerCoord = { row = mapHalfSize, col = mapHalfSize } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--draws a circle outline | |
--copy and paste code to preview at https://aoe4.app/ | |
--radius (float) the radius of the circle | |
--centerCoord (table) x y coordinates of the circle center | |
--pickedTerrain (str/var) the terrainType name to draw | |
--implodeWidth (float) experimental and can produce interesting results when increasing | |
--iterations (int) the number of circle iterations to draw, used in conjunction with strokeSpacing | |
--strokeWidth (int) the circles outline width | |
--strokeSpacing (float) the amount of spacing between circles if there are multiple iterations set |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--draws a diagonal cross | |
--copy and paste code to preview at https://aoe4.app/ | |
for i = 1, gridSize do | |
terrainLayoutResult[i][i].terrainType = tt_lake_shallow | |
terrainLayoutResult[gridSize - i + 1][i].terrainType = tt_lake_shallow | |
end |