• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Redoing your maps Terrain(Advanced)

dab

dab

Level 10
Joined
Oct 30, 2008
Messages
412

How to:

Change your maps Tileset with Triggers, and making people vote about which terrain type they want.

Notice: This will NOT affect your walls, so choose something that is color neutral to the terrain types you want.

1. Setting up the variables

2. Creating our dialog

3. Creating the Triggers



1:

This is only nessesary if you want player to vote about your tileset. If this is not your plan, skip this tutorial. The variables is:
gametype(Dialog Button, array: 3(depends on, how many chooseable terrains you want + 1 for "No Changes"))
GameTypeDiablog(Dialog, array: 1-2(depending if you want a "yes/no" or just pure voting))
VoteTerrainVotes(Interger, array: 3(still depending on how many terrains you want + 1 for "No Changes"))
VoteTerrainTimer(Timer)
That's the variables. Now, the Dialog.

2:

We start off by creating a trigger which looks like this:
  • Events - Map Initialization or Elapsed game time is 0.50 seconds
  • Conditions
  • Actions
    • Dialog - Create a button for GameTypeDialog[1] labelled Terrain: Desert
    • Set gametype[1] = (Last created Dialog Button)
    • Dialog - Create a button for GameTypeDialog[1] labelled Terrain: Snow
    • Set gametype[2] = (Last created Dialog Button)
    • Dialog - Create a button for GameTypeDialog[1] labelled Terrain: Lava
    • Set gametype[3] = (Last created Dialog Button)
    • Dialog - Create a button for GameTypeDialog[1] labelled No Changes
    • Set gametype[0] = (Last created Dialog Button)
    • Wait 0.20 seconds
    • Game - Display to (All Players) the text: You now have 15 seconds to vote
    • Countdown Timer - Start VoteTerrainTimer as a One-Shot timer that will expire in 15 seconds
    • Player Group - Pick every player in (All Players) and do (Actions)
      • Loop -
        • Dialog - Show GameTypeDialog[1] for (Picked Player)
Now, our second Trigger named VoteTerrainVotes

3:

This is the final triggers. Be patient as you read, because THIS is some of a large load.
  • Events
    • A button is clicked for GameTypeDialog[1]
  • Conditions
  • Actions
    • If(All Conditions are true) then do(Then actions) else do (Else actions)
      • If - Conditions
        • (Clicked dialog Button) Equal to gametype[1]
      • Then - Actions
        • Set VoteTerrainVotes[1] = (VoteTerrainVotes[1] + 1)
      • Else - Actions
        • If(All Conditions are true) then do(Then actions) else do (Else actions)
      • If - Conditions
        • (Clicked dialog Button) Equal to gametype[2]
      • Then - Actions
        • Set VoteTerrainVotes[2] = (VoteTerrainVotes[2] + 1)
      • Else - Actions
        • If(All Conditions are true) then do(Then actions) else do (Else actions)
      • If - Conditions
        • (Clicked dialog Button) Equal to gametype[3]
      • Then - Actions
        • Set VoteTerrainVotes[3] = (VoteTerrainVotes[3] + 1)
      • Else - Actions
        • If(All Conditions are true) then do(Then actions) else do (Else actions)
      • If - Conditions
        • (Clicked dialog Button) Equal to gametype[0]
      • Then - Actions
        • Set VoteTerrainVotes[0] = (VoteTerrainVotes[0] + 1)
      • Else - Actions
That counts the votes for each Terrain type. Now, to the trigger which actually changes the tileset:
  • Events
    • Time - VoteTerrainTimer expires
  • Conditions
  • Actions
    • If(All Conditions are true) then do(Then actions) else do (Else actions)
      • If - Conditions
        • And - All (Conditions) are true
          • Conditions
            • VoteTerrainVotes[1] Greater than VoteTerrainVotes[2]
            • VoteTerrainVotes[1] Greater than VoteTerrainVotes[3]
            • VoteTerrainVotes[1] Greater than VoteTerrainVotes[0]
        • Then - Actions
          • Enviroment - Change terrain type at (Center of (Region centered at (Center of (Playable Map) with size (10000000000.00, 10000000000.00) to Barrens - Dirt usng variation -1 in a area of size 10000000000 and shape Square
          • Game - Display to (All Players) the text: Terrain has been changed to Terrain: Desert
        • Else - Actions
          • If(All Conditions are true) then do(Then actions) else do (Else actions)
      • If - Conditions
        • And - All (Conditions) are true
          • Conditions
            • VoteTerrainVotes[2] Greater than VoteTerrainVotes[1]
            • VoteTerrainVotes[2] Greater than VoteTerrainVotes[3]
            • VoteTerrainVotes[2] Greater than VoteTerrainVotes[0]
        • Then - Actions
          • Enviroment - Change terrain type at (Center of (Region centered at (Center of (Playable Map) with size (10000000000.00, 10000000000.00) to Northrend - Snow usng variation -1 in a area of size 10000000000 and shape Square
          • Game - Display to (All Players) the text: Terrain has been changed to Terrain: Snow
        • Else - Actions
          • If(All Conditions are true) then do(Then actions) else do (Else actions)
      • If - Conditions
        • And - All (Conditions) are true
          • Conditions
            • VoteTerrainVotes[3] Greater than VoteTerrainVotes[1]
            • VoteTerrainVotes[3] Greater than VoteTerrainVotes[2]
            • VoteTerrainVotes[3] Greater than VoteTerrainVotes[0]
        • Then - Actions
          • Enviroment - Change terrain type at (Center of (Region centered at (Center of (Playable Map) with size (10000000000.00, 10000000000.00) to Dungeon - Lava Cracks usng variation -1 in a area of size 10000000000 and shape Square
          • Game - Display to (All Players) the text: Terrain has been changed to Terrain: Lava
        • Else - Actions
          • If(All Conditions are true) then do(Then actions) else do (Else actions)
  • If - Conditions
    • And - All (Conditions) are true
      • Conditions
        • VoteTerrainVotes[0] Greater than VoteTerrainVotes[1]
        • VoteTerrainVotes[0] Greater than VoteTerrainVotes[2]
        • VoteTerrainVotes[0] Greater than VoteTerrainVotes[3]
    • Then - Actions
      • Game - Display to (All Players) the text: Terrain has not been changed.
    • Else - Actions
      • Bug! OMFG!
Phew! That was some of a large trigger to write, even tho i copy/pasted and then changed the values..

Hope you can use it ^^
 
Last edited:
Top