• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

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
892
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
892
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