User Tools

Site Tools


crpl:docs:distance

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
crpl:docs:distance [2019/02/27 01:18] – [Distance] added example Karsten75crpl:docs:distance [2024/05/13 14:45] (current) kaiden
Line 11: Line 11:
 <code> <code>
  
-terrain modification script to build a circular pyramid+#Terrain modification script to build a circular pyramid
 +#Keep in mind modifying terrain on a large scale like this can lag the game badly for a short moment, so not recommended to do this mid-level unless you slow the loops.
  
-50 -> centerX  +$radius:30 
-50 -> centerY +$stepWidth:3.0 
-20 -> height+$min:1 
 +$max:10
  
-do (<height add(1) <-height mul(-1)) +once 
-  do (<-height add(1) <-height mul(-1)) + CurrentX ->centerX  
-    <-centerX add(I) ->x + CurrentY ->centerY 
-    <-centerY add(J) ->y + do (<-radius add(1) <-radius mul(-1)) 
-    distance( <-x <-y <-height sub(<-dist)) + do (<-radius add(1) <-radius mul(-1)) 
-  loop + <-centerX add(I) ->x 
-loop+ <-centerY add(J) ->y 
 + distance(CurrentCoords <-x <-y->dist 
 + #Finds what height to set terrain to. Step width divides the height and as a result makes each pyramid step wider. Also rounds up the current value. 
 + ceil(<-radius sub(<-dist) div(<-stepWidth)) ->height 
 + #Caps the terrain to a minimum of 1 and a maximum of 10. Interestingly, the maximum can be set to above its current value if you want a volcano formation. 
 + min(<-max max(<-height <-min)) ->height 
 + SetTerrain(<-x <-y <-height) 
 + loop 
 + loop 
 +endonce
 </code>  </code> 
  
  
crpl/docs/distance.txt · Last modified: 2024/05/13 14:45 by kaiden