• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Making a random doodads, terrains system

Level 9
Joined
Jul 24, 2007
Messages
308
Making a random doodad, terrain system


In this tutorial, i will learn you how to make a random doodad system, which generates random doodads each game!
Open the trigger editor, then make this big trigger:
Variables:
Random_Terrain : An arrayed Terrain Type
Random_Position : Point
  • Ashenvale
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Set Random_Terrain[1] = Ashenvale - Dirt
      • Set Random_Terrain[2] = Ashenvale - Rough Dirt
      • Set Random_Terrain[3] = Ashenvale - Lumpy Grass
      • Set Random_Terrain[4] = Ashenvale - Vines
      • Set Random_Terrain[5] = Felwood - Grass
      • Set Random_Terrain[6] = Felwood - Leaves
      • Set Random_Terrain[7] = Ashenvale - Rock
      • -------- Random Terrain --------
  • //These terrains are the ones which will be used in the map
    • For each (Integer A) from 1 to 600, do (Actions)
      • Loop - Actions
        • Set Random_Position = (Random point in (Entire map))
        • Environment - Change terrain type at Random_Position to Random_Terrain[(Random integer number between 1 and 5)] using variation -1 in an area of size (Random integer number between 3 and 4) and shape Circle
        • Custom script: call RemoveLocation (udg_Random_Position)
  • //For 600 times, these actions pick a random point in the map, and creates a
  • //3-4 size circle terrain.
    • -------- Doodads --------
    • For each (Integer A) from 1 to 256, do (Actions)
      • Loop - Actions
        • Set Random_Position = (Random point in (Entire map))
        • Destructible - Create a Grass at Random_Position facing (Random angle) with scale (Random real number between 1.00 and 3.00) and variation (Random integer number between 1 and 3)
        • Custom script: call RemoveLocation (udg_Random_Position)
  • //For 256 times, this trigger creates a doodad (type : Grass) at a random
  • //point in the map, its scale is from 1-3 you can customize the number
  • //of doodads that you want to create
    • For each (Integer A) from 1 to 256, do (Actions)
      • Loop - Actions
        • Set Random_Position = (Random point in (Entire map))
        • Destructible - Create a Ashenvale Tree Wall at Random_Position facing (Random angle) with scale 0.50 and variation (Random integer number between 1 and 3)
        • Custom script: call RemoveLocation (udg_Random_Position)
  • //same happens in this action, for 256 times it creates an ashenvale tree
  • //at a random point in the map
    • For each (Integer A) from 1 to 256, do (Actions)
      • Loop - Actions
        • Set Random_Position = (Random point in (Entire map))
        • Destructible - Create a Ashenvale Tree Wall at Random_Position facing (Random angle) with scale (Random real number between 1.00 and 2.00) and variation (Random integer number between 1 and 10)
        • Custom script: call RemoveLocation (udg_Random_Position)
    • For each (Integer A) from 1 to 64, do (Actions)
      • Loop - Actions
        • Set Random_Position = (Random point in (Entire map))
        • Destructible - Create a Ashenvale Canopy Tree at Random_Position facing (Random angle) with scale 1.00 and variation (Random integer number between 1 and 3)
        • Custom script: call RemoveLocation (udg_Random_Position)
  • //you can continue as much as you want, and change numbers to your choice.
  • //the Custom Script was used to fix leaks, leaks are same as
  • //"lagness", they cause the game to lag if they are not fixed
    • -------- Misc --------
    • Environment - Set sky to Lordaeron Summer Sky
You can customize doodads/terrains type to your choice.
Make such trigger, then test the map, and see yourself.
Congratulations, you just made a random terrain,doodad system!
 
Last edited:
The most important thing this tutorial needs is to walk the reader through what they are doing (and some more indenting would also be nice)

Try doing this. ;) Because it simply shows the trigger right now.

And btw, maybe you should add a test map so people don't have to create the whole trigger by themselves, but instead can C'n'P one from your map.
 
Level 22
Joined
Feb 26, 2008
Messages
891
I agree with the statement that this is more of a system than a tutorial.
You're not really teaching anyone how to do anything here. That's the purpose of a tutorial.
See if you can rework this so that you actually teach some concepts instead of just handing someone a trigger. :wink:
 
Level 22
Joined
Feb 26, 2008
Messages
891
Well, that's a start, but in my opinion, you should probably explain the concepts behind what you're doing before you show any code, and I think you should give the code in pieces instead of just lumping it all out there at once. It could be a bit overwhelming, especially considering that you can't just copy and paste GUI. Walk the reader through the processes involved.
 
Level 3
Joined
Jun 23, 2007
Messages
32
have u actually tried doing this??

i implemented a similar random terrain system on my map..and its buggy

for example, when i want northrend - dark ice at a random point, it gives me something like lorderon - grassy dirt.

dark ice isnt the only terrain tile giving me problems.

does anyone know how to fix this?
 
Top