1. The glory of the 20th Icon Contest is yours for the taking!
    Dismiss Notice
  2. Fill your cup and take your pick among the maps best suited for this year's Hive Cup. The 6th Melee Mapping Contest Poll is up!
    Dismiss Notice
  3. Shoot to thrill, play to kill. Sate your hunger with the 33rd Modeling Contest!
    Dismiss Notice
  4. Do you hear boss music? It's the 17th Mini Mapping Contest!
    Dismiss Notice
  5. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Making a mui 2d "map"?

Discussion in 'World Editor Help Zone' started by Jahjahbinks, Sep 13, 2020.

  1. Jahjahbinks

    Jahjahbinks

    Joined:
    Jul 28, 2019
    Messages:
    69
    Resources:
    0
    Resources:
    0
    I'm trying to create a "Slay the Spire" Warcraft edition map demo. Meaning everyone (1-4? players) would start at the bottom. Each 'round' player fights or shops or heals or whatever happens at that spot. Sometimes the spots lead to another and then the players will interact/fight. If possible, it would be randomly generated but could just one out of 5-10 premade layouts. It could also be more of a grid layout, where you choose left, up, right for your next spot. Anyway, anyone know an intelligent way to go about this, any of those ways?

    I'm not too hot at jass but I'm trying. Much quicker with gui.

    Here's what the map would sorta look like.
    [​IMG]
     
  2. Uncle

    Uncle

    Joined:
    Aug 10, 2018
    Messages:
    2,157
    Resources:
    0
    Resources:
    0
    Here's something that can get you started:
    • Setup Variables
      • Events
        • Map initialization
      • Conditions
      • Actions
        • Hashtable - Create a hashtable
        • Set VariableSet Room_Hashtable = (Last created hashtable)
        • -------- --------
        • Set VariableSet Room_Types[1] = Unknown
        • Set VariableSet Room_Types[2] = Merchant
        • Set VariableSet Room_Types[3] = Treasure
        • Set VariableSet Room_Types[4] = Rest
        • Set VariableSet Room_Types[5] = Enemy
        • Set VariableSet Room_Types[6] = Elite
        • -------- --------
        • Trigger - Run Generate Rooms <gen> (ignoring conditions)

    • Generate Rooms
      • Events
      • Conditions
      • Actions
        • Set VariableSet Path_Index = (Path_Index + 1)
        • -------- Create the rooms --------
        • For each (Integer Loop) from 1 to 25, do (Actions)
          • Loop - Actions
            • Set VariableSet Roll = (Random integer number between 1 and 6)
            • Hashtable - Save Roll as Loop of Path_Index in Room_Hashtable.
    So this would create 25 random Rooms for a designated Path. You can then load these values and get the Room type for Rooms 1 to 25. Generated Floors is the map name.

    Edit:
    I added onto it some more to show you how to put it to use. Note that it's not perfect and can only create straight paths with no choices besides going forward/backwards. Generated Dungeon v.1 is the map name:
    This trigger sets everything up.
    • Setup Variables
      • Events
        • Map initialization
      • Conditions
      • Actions
        • Hashtable - Create a hashtable
        • Set VariableSet Room_Hashtable = (Last created hashtable)
        • -------- --------
        • -------- These are the different Room Types. They are Integer values: --------
        • Set VariableSet Room_Types[1] = Unknown
        • Set VariableSet Room_Types[2] = Merchant
        • Set VariableSet Room_Types[3] = Treasure
        • Set VariableSet Room_Types[4] = Rest
        • Set VariableSet Room_Types[5] = Enemy
        • Set VariableSet Room_Types[6] = Elite
        • -------- --------
        • -------- These are just the names of the different Room Types. Used for displaying in Text Messages: --------
        • Set VariableSet Room_Strings[1] = Unknown
        • Set VariableSet Room_Strings[2] = Merchant
        • Set VariableSet Room_Strings[3] = Treasure
        • Set VariableSet Room_Strings[4] = Rest
        • Set VariableSet Room_Strings[5] = Enemy
        • Set VariableSet Room_Strings[6] = Elite
        • -------- --------
        • -------- Set the total number of Paths and how many Rooms will be created per Path: --------
        • Set VariableSet Total_Paths = 5
        • Set VariableSet Total_Rooms = 10
        • -------- --------
        • -------- This creates X Paths and Y Rooms per Path, each Room randomized to be one of the 6 Room Types: --------
        • Trigger - Run Generate Rooms <gen> (ignoring conditions)
        • -------- --------
        • -------- DEMO STUFF: --------
        • Game - Display to (All players) for 30.00 seconds the text: Type |cff00ff00-pat...
        • Visibility - Create an initially Enabled visibility modifier for Player 1 (Red) emitting Visibility across (Playable map area)

    This trigger chooses your current Path. It will reset you back to Room 1.
    • Choose Path
      • Events
        • Player - Player 1 (Red) types a chat message containing -path as A substring
      • Conditions
      • Actions
        • -------- Go to the next room --------
        • Set VariableSet Value = (Integer((Substring((Entered chat string), 7, 8))))
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Value Greater than or equal to 1
            • Value Less than or equal to Total_Paths
          • Then - Actions
            • Game - Display to (All players) for 5.00 seconds the text: (Starting on Path # + (String(Value)))
            • Set VariableSet Current_Path = Value
            • Set VariableSet Current_Room = 0
            • Trigger - Run Go To Next Room <gen> (ignoring conditions)
          • Else - Actions

    This triggers move you to the next Room.
    • Go To Next Room
      • Events
        • Player - Player 1 (Red) types a chat message containing -next as An exact match
      • Conditions
        • Current_Path Not equal to 0
        • Current_Room Less than Total_Rooms
      • Actions
        • -------- Go to the next room --------
        • Set VariableSet Current_Room = (Current_Room + 1)
        • Game - Display to (All players) for 5.00 seconds the text: (Going to Room # + (String(Current_Room)))
        • Trigger - Run Spawn Room <gen> (ignoring conditions)

    This triggers moves you back to the previous Room.
    • Go To Previous Room
      • Events
        • Player - Player 1 (Red) types a chat message containing -previous as An exact match
      • Conditions
        • Current_Path Not equal to 0
        • Current_Room Greater than 1
      • Actions
        • -------- Go to the previous room --------
        • Set VariableSet Current_Room = (Current_Room - 1)
        • Game - Display to (All players) for 5.00 seconds the text: (Going back to Room # + (String(Current_Room)))
        • Trigger - Run Spawn Room <gen> (ignoring conditions)

    This triggers displays the name of each Room Type in your current Path.
    • Show Path Info
      • Events
        • Player - Player 1 (Red) types a chat message containing -info as An exact match
      • Conditions
      • Actions
        • For each (Integer Loop) from 1 to Total_Rooms, do (Actions)
          • Loop - Actions
            • Set VariableSet Value = (Load Loop of Current_Path from Room_Hashtable.)
            • Game - Display to (All players) for 20.00 seconds the text: ((Room # + ((String(Loop)) + : |cff00ff00)) + (Room_Strings[Value] + |r))

    This trigger sets up the Paths/Rooms in the Hashtable, saving random Room Types throughout it.
    • Generate Rooms
      • Events
      • Conditions
      • Actions
        • -------- Create the paths --------
        • For each (Integer Path_Index) from 1 to Total_Paths, do (Actions)
          • Loop - Actions
            • -------- Create the rooms --------
            • For each (Integer Loop) from 1 to Total_Rooms, do (Actions)
              • Loop - Actions
                • Set VariableSet Value = (Random integer number between 1 and 6)
                • Hashtable - Save Value as Loop of Path_Index in Room_Hashtable.

    This trigger creates the units/items/whatever associated with the Room.
    • Spawn Room
      • Events
      • Conditions
      • Actions
        • -------- Clear any leftover stuff from the previous room --------
        • Custom script: set bj_wantDestroyGroup = true
        • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Or - Any (Conditions) are true
                  • Conditions
                    • (Owner of (Picked unit)) Equal to Neutral Hostile
                    • (Owner of (Picked unit)) Equal to Neutral Passive
              • Then - Actions
                • Unit - Remove (Picked unit) from the game
              • Else - Actions
        • Item - Pick every item in (Playable map area) and do (Actions)
          • Loop - Actions
            • Item - Remove (Picked item)
        • -------- --------
        • -------- Spawn the next room --------
        • Set VariableSet Value = (Load Current_Room of Current_Path from Room_Hashtable.)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Value Equal to Unknown
          • Then - Actions
            • -------- Generate a random room type that ISN'T Unknown and run this trigger again --------
            • Set VariableSet Value = (Random integer number between 2 and 6)
            • Hashtable - Save Value as Current_Room of Current_Path in Room_Hashtable.
            • Trigger - Run Spawn Room <gen> (ignoring conditions)
          • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Value Equal to Merchant
              • Then - Actions
                • Unit - Create 1 Goblin Merchant for Neutral Passive at (Center of (Playable map area)) facing Default building facing degrees
                • Game - Display to (All players) for 5.00 seconds the text: (Room Type: |cff00ff00 + (Room_Strings[Value] + |r))
              • Else - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • Value Equal to Treasure
                  • Then - Actions
                    • Item - Create Claws of Attack +15 at (Center of (Playable map area))
                    • Game - Display to (All players) for 5.00 seconds the text: (Room Type: |cff00ff00 + (Room_Strings[Value] + |r))
                  • Else - Actions
                    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • Value Equal to Rest
                      • Then - Actions
                        • Unit - Create 1 Fountain of Health for Neutral Passive at (Center of (Playable map area)) facing Default building facing degrees
                        • Game - Display to (All players) for 5.00 seconds the text: (Room Type: |cff00ff00 + (Room_Strings[Value] + |r))
                      • Else - Actions
                        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          • If - Conditions
                            • Value Equal to Enemy
                          • Then - Actions
                            • Unit - Create 5 Timber Wolf for Neutral Hostile at (Center of (Playable map area)) facing Default building facing degrees
                            • Game - Display to (All players) for 5.00 seconds the text: (Room Type: |cff00ff00 + (Room_Strings[Value] + |r))
                          • Else - Actions
                            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                              • If - Conditions
                                • Value Equal to Elite
                              • Then - Actions
                                • Unit - Create 1 Firelord for Neutral Hostile at (Center of (Playable map area)) facing Default building facing degrees
                                • Game - Display to (All players) for 5.00 seconds the text: (Room Type: |cff00ff00 + (Room_Strings[Value] + |r))
                              • Else - Actions
    This is all just meant to give you a general idea of how you can go about creating something like this. How one would go about creating randomly generated paths that intersect with one another is beyond me. I'm sure it's not too difficult but I've never done anything like it before and would have to do some research on it.
     

    Attached Files:

    Last edited: Sep 14, 2020
  3. Jahjahbinks

    Jahjahbinks

    Joined:
    Jul 28, 2019
    Messages:
    69
    Resources:
    0
    Resources:
    0
    Tyvm. Was going to ask what you answered in your edit. I'll start with the grid design for now, it might be better/less confusing for the player anyway. See how it plays then consider a fancier/StS layout.
    If anyone has idea or experience with a "2d map" plz share, be it logic part or the aesthetic part.
    Currently working on using units/buildings with different color heroglow.mdx to show spaces etc.
     
  4. Uncle

    Uncle

    Joined:
    Aug 10, 2018
    Messages:
    2,157
    Resources:
    0
    Resources:
    0
    A grid design seems less confusing to make and you could save the Rooms in a Hashtable like I was already doing. I attached a picture with the general idea. I'll throw together an example map as well.
     

    Attached Files:

  5. Chaosy

    Chaosy

    Joined:
    Jun 9, 2011
    Messages:
    10,915
    Resources:
    17
    Maps:
    1
    Spells:
    10
    Tutorials:
    6
    Resources:
    17
    Not trying to discourage you too much but making 2d maps in wc3 is not a good option. It takes 2x the effort compared to using a game engine that is actually meant for it.

    It's just a flex if you manage to get it to work on a decent level, but that's about it.
     
  6. Uncle

    Uncle

    Joined:
    Aug 10, 2018
    Messages:
    2,157
    Resources:
    0
    Resources:
    0
    Here's a working system using the grid style, not sure if it's exactly what you were aiming for.

    You can move between adjacent rooms north/south/east/west of you.
     

    Attached Files:

    Last edited: Sep 14, 2020
  7. Jahjahbinks

    Jahjahbinks

    Joined:
    Jul 28, 2019
    Messages:
    69
    Resources:
    0
    Resources:
    0
    Not trying to pull a z1z1z1. Most of the gameplay is "3d". The 2d map is so players know what's next, I hope it ends up strategic fun, not annoying..

    Big ty, this saves me many hours of fumbling.
    It's pretty close. Original plan was to only be able to move "up" = mid/left/right. However now I am debating what it the most fun/competitive/compelling. Should all players share a turn timer or should it be more of a race? How severe is dying? etc... the answers will come over time.
     
  8. Chaosy

    Chaosy

    Joined:
    Jun 9, 2011
    Messages:
    10,915
    Resources:
    17
    Maps:
    1
    Spells:
    10
    Tutorials:
    6
    Resources:
    17
    Oh, so you just want 2d UI to make a decision of some sort and then go back to "standard" gameplay?
     
  9. Jahjahbinks

    Jahjahbinks

    Joined:
    Jul 28, 2019
    Messages:
    69
    Resources:
    0
    Resources:
    0
    Yes, for example like this: (each location would lead to an arena/room)
    [​IMG]

    A literal 2d version might be nice if the map turns out fun. Otherwise this gets the job done. Going to work on a single player version with this.
    I don't know how to enjoyable add a multiplayer component, people on bnet don't like waiting for other's turns or too much pve. Best idea so far is a classic rogue like system, per Uncle's demo. Would look kinda like below.. Where players could run through rooms in real time, without waiting on others.
    [​IMG]
     
  10. Jahjahbinks

    Jahjahbinks

    Joined:
    Jul 28, 2019
    Messages:
    69
    Resources:
    0
    Resources:
    0
    Few questions...
    What is an elegant way to store spawn points for "arenas"? Some of my "arenas" are slightly different sizes. Using many if/then/else statements seems messy, especially if there ends up being many arenas. Would using Hashtable the easiest? For arena [3], save spawnpoint1 as x, save spawnpoint2 as y..etc
    pic for example
    [​IMG]

    if I say Unit - Move unit to temppoint facing center of region. The temppoint address needs to be cleaned up, but does the generic "center of region" (thus need to be defined as a point to be removable)? I guess yes.

    Why do way gates stop working if they are 'moved'? At least that is what I am experiencing. Even if I use a trigger redefine waygate teleport location. I have tried using "stock" waygate, custom unit waygate, waygate with default or no pathing, making sure its 'walkable'. It seems waygates are not working unless it's placed+defined in editor. If I move it or spawn one and define the teleport location, it doesnt work... Is there some weird setting or something I am missing?
    If way gates aren't going to happen...Any elegant ways for player to assert when ready to leave current room? Pressing Esc or another key is an option. Seems a bit clunky. Any thoughts?
     
    Last edited: Sep 19, 2020
  11. Uncle

    Uncle

    Joined:
    Aug 10, 2018
    Messages:
    2,157
    Resources:
    0
    Resources:
    0
    Hashtables make the most sense:
    • Untitled Trigger 001
      • Events
        • Player - Player 1 (Red) skips a cinematic sequence
      • Conditions
      • Actions
        • Set VariableSet X = -192
        • Set VariableSet Y = 192
        • For each (Integer Int) from 1 to 16, do (Actions)
          • Loop - Actions
            • Set VariableSet TempPoint = (Point((Real(X)), (Real(Y))))
            • Hashtable - Save Handle OfTempPoint as Int of ArenaIndex in Room_Hashtable.
            • -------- --------
            • -------- Move Coordinates --------
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Int mod 4) Equal to 0
              • Then - Actions
                • Set VariableSet X = -192
                • Set VariableSet Y = (Y - 128)
              • Else - Actions
                • Set VariableSet X = (X + 128)
        • -------- --------
        • For each (Integer Int) from 1 to 16, do (Actions)
          • Loop - Actions
            • Unit - Create 1 Rifleman for Player 1 (Red) at (Load Int of ArenaIndex in Room_Hashtable.) facing Default building facing degrees

    And if working with coordinates is a pain, you can use Regions instead. Save them in the Hashtable as Rects. Then you set Point at the center of these Regions as you load them and then create your unit at that Point.
    • Untitled Trigger 001
      • Events
        • Player - Player 1 (Red) skips a cinematic sequence
      • Conditions
      • Actions
        • -------- Set this to some Index that isn't being used in your Hashtable --------
        • Set VariableSet ArenaIndex = 17
        • -------- --------
        • -------- Save the Regions (Rects) in the Hashtable --------
        • Hashtable - Save Handle Of Region a1s1 <gen> as 1 of ArenaIndex in Dungeon_Hashtable.
        • Hashtable - Save Handle Of Region a1s2 <gen> as 2 of ArenaIndex in Dungeon_Hashtable.
        • Hashtable - Save Handle Of Region a1s3 <gen> as 3 of ArenaIndex in Dungeon_Hashtable.
        • -------- --------
        • -------- Load the Regions Example --------
        • For each (Integer Int) from 1 to 3, do (Actions)
          • Loop - Actions
            • Set VariableSet TempPoint = (Center of (Load Int of ArenaIndex in Dungeon_Hashtable.))
            • Unit - Create 1 Rifleman for Player 1 (Red) at TempPoint facing Default building facing degrees
            • Custom script: call RemoveLocation (udg_TempPoint)

    And I don't know about Waygates, I don't ever really use them. I imagine a trigger like this does exactly the same thing in your case: A unit enters region -> Move triggering unit

    But i'm sure you can come up with something more polished.
     
    Last edited: Sep 19, 2020