• 🏆 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!

[Trigger] Terrain Changer trigger bug

Status
Not open for further replies.
Level 22
Joined
Feb 3, 2009
Messages
3,292
Hello, in my map I have a terrain editor unit, this unit has many abilities to change the terrain type at the target point, they're based on channel, each have an unique ability id. Most of them work, however a couple of random ones just either don't do anything (nothing happens upon cast) or change the terrain into something completely else. Examples: Snow does nothing, Grass Trim creates a dirt terrain, dark marble creates the road type, etc.


  • Terrain Change
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Unit-type of (Triggering unit)) Not equal to (!=) Dummy Caster
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to (==) Terrain Change - Grass
        • Then - Actions
          • Environment - Change terrain type at (Target point of ability being cast) to Cityscape - Grass using variation -1 in an area of size TerrainInt[(Player number of (Owner of (Triggering unit)))] and shape Square
        • Else - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Ability being cast) Equal to (==) Terrain Change - Light Grass
            • Then - Actions
              • Environment - Change terrain type at (Target point of ability being cast) to Lordaeron Summer - Dark Grass using variation -1 in an area of size TerrainInt[(Player number of (Owner of (Triggering unit)))] and shape Square
            • Else - Actions
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Ability being cast) Equal to (==) Terrain Change - Grass Trim
                • Then - Actions
                  • Environment - Change terrain type at (Target point of ability being cast) to Cityscape - Grass Trim using variation -1 in an area of size TerrainInt[(Player number of (Owner of (Triggering unit)))] and shape Square
                • Else - Actions
                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Ability being cast) Equal to (==) Terrain Change - Road
                    • Then - Actions
                      • Environment - Change terrain type at (Target point of ability being cast) to Cityscape - Round Tiles using variation -1 in an area of size TerrainInt[(Player number of (Owner of (Triggering unit)))] and shape Square
                    • Else - Actions
                      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Ability being cast) Equal to (==) Terrain Change - White Marble
                        • Then - Actions
                          • Environment - Change terrain type at (Target point of ability being cast) to Cityscape - White Marble using variation -1 in an area of size TerrainInt[(Player number of (Owner of (Triggering unit)))] and shape Square
                        • Else - Actions
                          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Ability being cast) Equal to (==) Terrain Change - Black Marble
                            • Then - Actions
                              • Environment - Change terrain type at (Target point of ability being cast) to Cityscape - Black Marble using variation -1 in an area of size TerrainInt[(Player number of (Owner of (Triggering unit)))] and shape Square
                            • Else - Actions
                              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Ability being cast) Equal to (==) Terrain Change - Square Tiles
                                • Then - Actions
                                  • Environment - Change terrain type at (Target point of ability being cast) to Cityscape - Square Tiles using variation -1 in an area of size TerrainInt[(Player number of (Owner of (Triggering unit)))] and shape Square
                                • Else - Actions
                                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (Ability being cast) Equal to (==) Terrain Change - Black Bricks
                                    • Then - Actions
                                      • Environment - Change terrain type at (Target point of ability being cast) to Icecrown Glacier - Black Bricks using variation -1 in an area of size TerrainInt[(Player number of (Owner of (Triggering unit)))] and shape Square
                                    • Else - Actions
                                      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • (Ability being cast) Equal to (==) Terrain Change - Dirt
                                        • Then - Actions
                                          • Environment - Change terrain type at (Target point of ability being cast) to Cityscape - Dirt using variation -1 in an area of size TerrainInt[(Player number of (Owner of (Triggering unit)))] and shape Square
                                        • Else - Actions
                                          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • (Ability being cast) Equal to (==) Terrain Change - Sand
                                            • Then - Actions
                                              • Environment - Change terrain type at (Target point of ability being cast) to Sunken Ruins - Sand using variation -1 in an area of size TerrainInt[(Player number of (Owner of (Triggering unit)))] and shape Square
                                            • Else - Actions
                                              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                • If - Conditions
                                                  • (Ability being cast) Equal to (==) Terrain Change - Snow
                                                • Then - Actions
                                                  • Environment - Change terrain type at (Target point of ability being cast) to Northrend - Snow using variation -1 in an area of size TerrainInt[(Player number of (Owner of (Triggering unit)))] and shape Square
                                                • Else - Actions
                                                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    • If - Conditions
                                                      • (Ability being cast) Equal to (==) Terrain Change - Blight
                                                    • Then - Actions
                                                      • Environment - Create Blight for (Owner of (Triggering unit)) from (Target point of ability being cast) to a radius of ((Real(TerrainInt[(Player number of (Owner of (Triggering unit)))])) x 250.00)
                                                    • Else - Actions
                                                      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                        • If - Conditions
                                                          • (Ability being cast) Equal to (==) Terrain Change - Remove Blight
                                                        • Then - Actions
                                                          • Environment - Remove Blight for (Owner of (Triggering unit)) from (Target point of ability being cast) to a radius of ((Real(TerrainInt[(Player number of (Owner of (Triggering unit)))])) x 250.00)
                                                        • Else - Actions
                                                          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                            • If - Conditions
                                                              • (Ability being cast) Equal to (==) Terrain Change - Dry Magma
                                                            • Then - Actions
                                                              • Environment - Change terrain type at (Target point of ability being cast) to Dungeon - Dark Rocks using variation -1 in an area of size TerrainInt[(Player number of (Owner of (Triggering unit)))] and shape Square
                                                            • Else - Actions
                                                              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                                • If - Conditions
                                                                  • (Ability being cast) Equal to (==) Terrain Change - Lava
                                                                • Then - Actions
                                                                  • Environment - Change terrain type at (Target point of ability being cast) to Dungeon - Lava using variation -1 in an area of size TerrainInt[(Player number of (Owner of (Triggering unit)))] and shape Square
                                                                • Else - Actions
                                                                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                                    • If - Conditions
                                                                      • (Ability being cast) Equal to (==) Terrain Change - Rough Dirt
                                                                    • Then - Actions
                                                                      • Environment - Change terrain type at (Target point of ability being cast) to Barrens - Rough Dirt using variation -1 in an area of size TerrainInt[(Player number of (Owner of (Triggering unit)))] and shape Square
                                                                    • Else - Actions
Help greatly appreciated.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
You can only have max 16 tile types in the map, even if you try to change them with triggers. Store the target point into a variable at the beginning and use the variable.

I'd do the thing like this:
  • Untitled Trigger 001
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set ht = (Last created hashtable)
      • Custom script: call SaveInteger(udg_ht, 'AHfs', 0, 'Wrok') // AHfs = Flame Strike, Wrok = Winter Rock
      • Custom script: call SaveInteger(udg_ht, 'AHbz', 0, 'Wsnw') // Blizzard, Winter Snow
  • Untitled Trigger 002
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Custom script: if HaveSavedInteger(udg_ht, GetSpellAbilityId(), 0) then
      • Custom script: set udg_tt = LoadInteger(udg_ht, GetSpellAbilityId(), 0)
      • Environment - Change terrain type at (Target point of ability being cast) to tt using... // leaks
      • Custom script: endif
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,200
Make sure they are the terrain types used on the playfield. There are many grasses for example. Using the grass from a tileset when your map has a different one will count as a new tile type and thus bug if you already have 16 tiles loaded.

Also make sure that the appropiate branches are running. It could be an ability order collision causing the wrong ability to be cast.
 
Last edited:
Level 22
Joined
Feb 3, 2009
Messages
3,292
Place debug messages and check the right paths are being taken in the trigger.

I edited it to a dialog type of trigger by now, you simply write -t and it gives you a dialog to pick the terrain type from, after this a single ability changes terrain to the stored terrain type.

EDIT: I really did miss 1 tile, after getting rid of it it now works.
Thanks to everyone for the help.
 
Last edited:
Status
Not open for further replies.
Top