3rd Person Land Creator

Type: Player Brain
Level: 3 star
Pages: 2
Description: Allows your player to change the terrain paint and raise the land under his feet (like Avatar cartoon – Earthbending). The paint type is controlled by the Dpad left and right, the radius of the amount of land affected is controlled by the d pad up and down. Press right trigger to paint, right trigger and A or Y to grow land and X to remove land. Also throws a barrel that changes the terrain paint.

There is a serious problem with this kode in that the player can remove and grow land with no restrictions and could easily tunnel or grow outside the bounds of the game and get destroyed. See kode below.

Kode

Page1  @Playercontrols – Land Creator

  1. WHEN [once] DO [team][equals][team 1]

    Default variables for the paint radius and the paint type

  2. …WHEN DO [numvar:paint index][equals][1]
  3. …WHEN DO [numvar:radius][equals][1.5]
  4. …WHEN DO[numvar: painting][equals][0]
  5. WHEN DO [follow camera]
  6. WHEN DO [display meter][health][screen top left]
  7. WHEN [right trigger][or][left mouse button] DO [call page][page:@Buildland] // brings in the Earthbending kode
  8. …WHEN [else]

    Action buttons

  9. …/…WHEN [button:Y][pressed] DO [throw][Wooden barrel]
  10. …/…WHEN [button:X][pressed] DO [attack]

    Standard Interaction Kode

  11. …/…WHEN [detect][interactable][objects in front]
  12. …/…/…WHEN DO[highlight it yellow]
  13. …/…/…WHEN [is using keyboard] DO [display][middle mouse button][ above ][ it]
  14. …/…/…WHEN[using controller][or][is using touch] DO [display][icon:B][above] [it]
  15. …/…/…WHEN [button B][pressed] DO [interact]
  16. …/…/…WHEN [else]
  17. …/…/…/…WHEN [button B][pressed] DO [dodge][with strafing][invulnerable]

    More action buttons

  18. WHEN [left stick] DO [move]
  19. WHEN [button A][pressed] DO [jump]

    Dpad/ mouse control of terrain paint and radius of effect

  20. WHEN [D pad][or][mouse wheel] DO [numvar:radius][increment by][(][dpad][y][plus][mouse wheel][)][divided by][30]
  21. …WHEN DO [numvar:radius][equals][clamp][numvar:radius][min][1.5][max][5]
  22. …WHEN DO [numvar:painting][equals][2]
  23. …WHEN DO [plax fx][fx:Energy ring][scale][0.25][multiplied by][numvar:radius][at position][position][plus][up][multiplied by][0.1]
  24. WHEN [dpad][pressed] DO [numvar:paintindex][increment by][dpad][x]
  25. WHEN [key:R][pressed] DO [numvar:paintindex][increment by][1]
  26. WHEN [key:F][pressed] DO [numvar:paintindex][decrement by][1]
  27. WHEN [numvar:paintindex][changed]
  28. …WHEN DO [numvar:paintindex][equals][clamp][numvar:paintindex][min][0][max][15]
  29. …WHEN DO [numvar:painting][equals][2]
  30. WHEN [numvar:painting][greater than][0]
  31. …WHEN DO [numvar:painting][decrement by][4][divided by][30
  32. …WHEN DO [paint terrain][radius][numvar:radius][amount][1][material][numvar:paintindex][position][position]

    Paint effects of the thrown barrel

  33. WHEN [for each of][projectiles]
  34. …WHEN DO [it][pitch][-10]
  35. …WHEN [it][bump][or][it][bump terrain]
  36. …/…WHEN DO [paint terrain][radius][5][amount][1][material][numvar:paintindex][position][it][position]
  37. …/…WHEN DO [play fx][fx:dirt Land Large][at position][it][position]
  38. …/…WHEN DO [destroy][it]

 

Page 2 @Build Land

  1. WHEN [button:Y][or][key:E] DO [position][y][increment by][0.15]
  2. WHEN [button:X][or][key:Q] DO [position][y][decrement by][0.15]
  3. WHEN DO [vectorvar:subtract position][equals][position][plus][world up][multiplied by][1.6][plus][forward][multiplied by][0.5]
  4. WHEN DO [vectorvar:add position][equals][position][plus][world down][multipiled by][1.5][plus][forward][multiplied by][0.5]
  5. WHEN DO [subtract terrain][position][vectorvar:subtract position][cylinder][height][3][radius][numvar:radius]
  6. WHEN DO [add terrain][position][vectorvar:add position][cylinder][height][3][radius][numvar:radius][material][numvar:paintindex][minus][1]
  7. WHEN DO [numvar:painting][equals][2]

 

Alterations

Stop player changing the terrain paint
Although being able to change the terrain paint is interesting, it may not be a good idea to allow the player the whole range of paint options, and it is more likely that you will only want one terrain paint. Without changing the entire brain just change line 28 so it clamps at the default paint index number set in line 2.
eg.
…WHEN DO [numvar:paintindex][equals][clamp][numvar:paintindex][min][1][max][1]

Stop player exceeding boundaries.
You will not want your player to get too high or too low with this ability.
Stop them tunnelling
Add on page 2 before line 2 as a parent line
WHEN [position][y][greater than or equal to][10] // This is the default land level.
Stop them getting too high
Add on page 2 line 6
WHEN [position][y][less than][60] DO …..same as // you can change the height to whatever you wish

Make land created temporary
This ability could wreak havoc on your world design, so you may like this ability to only create temporary land.  Add
[duration][3] to line 6 after the [add terrain] and [subtract terrain] tiles.

 

Comments are closed.

Powered by WordPress.com.

Up ↑

%d bloggers like this: