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

UI!

Status
Not open for further replies.
Level 10
Joined
Jun 20, 2017
Messages
335
Hey, basically I want all my towers to have an image, by image I mean if you select a game mode you will have a builder with 6 different tier of tower, each tower has its own image.

I want to show those structures images in a specific terrain. Not clickable.
Player 1 chooses the game mode, and when he chooses a mode, it gives each player a builder with different structures.
Therefore, for each player, there is an area where the images of his structures can be shown, but the images cannot be shown to the enemy team.

12 players in two different teams.
A builder has six different types of structures that he can build.
And an upgrade that can change its structures by researching it and get random towers.

For example Footman is t1, Rifleman t2, Knight t3, etc. so it should show you their image at specific location.

Working on the sample map will post it later!
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,576
So you want the sort of UI that Legion TD has where you can see the Icons of the units on the ground?

exaa.png


If that's what you're talking about then I believe this method is being used here:
If I recall correctly this is done using Destructibles and Replaceable Texture Files.

If you want to hide these from the enemy team then you can probably use GetLocalPlayer() and the Hide Destructible action for the appropriate players.


You can also use the new UI natives introduced in 1.32. This tool makes it easy for GUI users:
This allows for proper UI that overlays the screen.
 
Last edited:
Level 10
Joined
Jun 20, 2017
Messages
335
I attached a lowered version.
Thanks.

Well, I'm almost done with this!
But how can I detect the structures that my builder currently has? (it shows the wrong icon) also I'm stuck on how to remove the old one and replace it with a new one!

I think I should use the hashtable to store them, and then delete the previous one and then create a new one in their place!
 

Attachments

  • Custom UI.w3m
    72 KB · Views: 1
Level 10
Joined
Jun 20, 2017
Messages
335
I tried a lot to fix this problem, but I couldn't figure out what structures my builder currently has!
Like how can I check/detect if my unit has some structure to build in his pocket?!
Looking for something like this!
((Triggering unit) has structure Tower1) Equal to True
((Triggering unit) has structure Tower2) Equal to True

When I change my towers with an ability, it gives some random towers (which works fine), but for the icons, it shows the last icon that I have set!
  • Setup Tower without upgrade
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • -------- T1 --------
      • Set VariableSet Integer_Temp = 0
      • Set VariableSet Integer_Temp = (Integer_Temp + 1)
      • Set VariableSet UnitTypes_TowerSet1[Integer_Temp] = Peasant [T1]
      • Set VariableSet DestructibleTypes[Integer_Temp] = Peasant [T1]
      • -------- --------
      • Set VariableSet Integer_Temp = (Integer_Temp + 1)
      • Set VariableSet UnitTypes_TowerSet1[Integer_Temp] = Footman [T1]
      • Set VariableSet DestructibleTypes[Integer_Temp] = Footman [T1]
      • Set VariableSet Integers_TierSet[1] = Integer_Temp
      • -------- --------
      • -------- T2 --------
      • Set VariableSet Integer_Temp = 0
      • Set VariableSet Integer_Temp = (Integer_Temp + 1)
      • Set VariableSet UnitTypes_TowerSet2[Integer_Temp] = Blood Elf Engineer [T2]
      • Set VariableSet DestructibleTypes[Integer_Temp] = Blood Elf Engineer [T2]
      • -------- --------
      • Set VariableSet Integer_Temp = (Integer_Temp + 1)
      • Set VariableSet UnitTypes_TowerSet2[Integer_Temp] = Rifleman [T2]
      • Set VariableSet DestructibleTypes[Integer_Temp] = Rifleman [T2]
      • Set VariableSet Integers_TierSet[2] = Integer_Temp
      • -------- --------
      • -------- T3 --------
      • -------- T4 --------
      • -------- T5 --------
      • -------- T6 --------
  • Tower Changes
    • Events
      • Unit - A unit Finishes research
    • Conditions
      • (Researched tech-type) Equal to tower change
    • Actions
      • -------- Random T1 --------
      • Set VariableSet Integer_Temp = (Random integer number between 1 and Integers_TierSet[1])
      • For each (Integer A) from 1 to Integers_TierSet[1], do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Integer A) Equal to Integer_Temp
            • Then - Actions
              • Player - Limit training of UnitTypes_TowerSet1[(Integer A)] to 100 for (Owner of (Researching unit))
            • Else - Actions
              • Player - Limit training of UnitTypes_TowerSet1[(Integer A)] to 0 for (Owner of (Researching unit))
      • -------- --------
      • -------- Random T2 --------
      • Set VariableSet Integer_Temp = (Random integer number between 1 and Integers_TierSet[2])
      • For each (Integer A) from 1 to Integers_TierSet[2], do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Integer A) Equal to Integer_Temp
            • Then - Actions
              • Player - Limit training of UnitTypes_TowerSet2[(Integer A)] to 100 for (Owner of (Researching unit))
            • Else - Actions
              • Player - Limit training of UnitTypes_TowerSet2[(Integer A)] to 0 for (Owner of (Researching unit))
      • -------- --------
      • -------- --------
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Researching unit)) Equal to Player 1 (Red)
        • Then - Actions
          • Destructible - Pick every destructible in All T Red <gen> and do (Actions)
            • Loop - Actions
              • Destructible - Kill (Picked destructible)
              • Destructible - Remove (Picked destructible)
          • -------- --------
          • Wait 0.10 game-time seconds
          • -------- --------
          • Destructible - Create a DestructibleTypes[Integer_Temp] at Points_Destructibles[1] facing Default building facing with scale 1.50 and variation 0
          • -------- --------
          • Destructible - Create a DestructibleTypes[Integer_Temp] at Points_Destructibles[2] facing Default building facing with scale 1.50 and variation 0
        • Else - Actions
      • -------- --------
      • -------- --------
      • -------- --------
      • -------- Random T3 --------
      • -------- Random T4 --------
      • -------- Random T5 --------
      • -------- Random T6 --------

So I was checking/looking for some hashtable that I could use, and found one and tried to edit it but... I don't know if I'm doing it the right way!
  • Setup Tower Type
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set VariableSet TowerType_Hash = (Last created hashtable)
      • -------- --------
      • -------- Set "TowerType_TierMax" to the maximum tier the towers can have --------
      • -------- Set "TowerType_Max" to the maximum types the towers can reach --------
      • -------- Set "TowerType_Tier" to the tier of the towers --------
      • -------- Set "TowerType[]" to the different tower types for "Tower_Level" --------
      • -------- --------
      • Set VariableSet TowerType_TierMax = 6
      • Set VariableSet TowerType_Max = 2
      • -------- --------
      • -------- T1 --------
      • Set VariableSet TowerType_Tier = 1
      • Set VariableSet TowerType[1] = Peasant [T1]
      • Set VariableSet DestructibleTypes[1] = Peasant [T1]
      • Set VariableSet TowerType[2] = Footman [T1]
      • Set VariableSet DestructibleTypes[2] = Footman [T1]
      • Trigger - Run Add Tower Types To Hashtable <gen> (ignoring conditions)
      • -------- --------
      • -------- T2 --------
      • Set VariableSet TowerType_Tier = 2
      • Set VariableSet TowerType[1] = Blood Elf Engineer [T2]
      • Set VariableSet DestructibleTypes[1] = Blood Elf Engineer [T2]
      • Set VariableSet TowerType[2] = Rifleman [T2]
      • Set VariableSet DestructibleTypes[2] = Rifleman [T2]
      • Trigger - Run Add Tower Types To Hashtable <gen> (ignoring conditions)
      • -------- --------
      • -------- T3 --------
      • -------- T4 --------
      • -------- T5 --------
      • -------- T6 --------
  • Setup Tower Icon
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set VariableSet TowerIcon_Hash = (Last created hashtable)
      • Hashtable - Create a hashtable
      • Set VariableSet TowerIcon_HashUnavailable = (Last created hashtable)
      • -------- --------
      • -------- Set "Tower_PN" to the player number of your desired player --------
      • -------- Set "TowerIcon_Regions[]" to that player's chosen regions --------
      • -------- Set "TowerIcon_RegionsMax" to the maximum number of chosen regions --------
      • -------- --------
      • Set VariableSet TowerIcon_RegionsMax = 6
      • -------- --------
      • -------- Player 1 --------
      • Set VariableSet Tower_PN = 1
      • Set VariableSet TowerIcon_Regions[1] = P1 T1 <gen>
      • Set VariableSet TowerIcon_Regions[2] = P1 T2 <gen>
      • Set VariableSet TowerIcon_Regions[3] = P1 T3 <gen>
      • Set VariableSet TowerIcon_Regions[4] = P1 T4 <gen>
      • Set VariableSet TowerIcon_Regions[5] = P1 T5 <gen>
      • Set VariableSet TowerIcon_Regions[6] = P1 T6 <gen>
      • Trigger - Run Add Chosen Regions To Hashtable <gen> (ignoring conditions)
      • -------- --------
      • -------- Player 2 --------
      • -------- Player 3 --------
      • -------- Player 4 --------
      • -------- Player 5 --------
      • -------- Player 6 --------
  • Create Tower Icon
    • Events
      • Unit - A unit Finishes research
    • Conditions
      • (Researched tech-type) Equal to Change Tower
    • Actions
      • Set VariableSet Tower_PN = (Player number of (Owner of (Triggering unit)))
      • -------- --------
      • For each (Integer Tower_Loop) from 1 to TowerIcon_RegionsMax, do (Actions)
        • Loop - Actions
          • -------- Create a point at the center of the loaded region and then create an icon tower there. It does this once for all 5 chosen regions --------
          • Set VariableSet TowerIcon_Regions[0] = (Load Tower_Loop of Tower_PN in TowerIcon_Hash.)
          • Set VariableSet Tower_Point = (Center of TowerIcon_Regions[0])
          • -------- --------
          • -------- A confusing method I know but we saved our Unit-Types as Integers in the Hashtable so we need to load them as Integers. From there we convert them back to Unit-Types: --------
          • Set VariableSet Tower_Id = (Load (Random integer number between 1 and TowerType_Max) of 1 from TowerType_Hash.)
          • Custom script: set udg_TowerType[0] = udg_Tower_Id
          • -------- --------
          • -------- Create the icon tower --------
          • Destructible - Create a DestructibleTypes[0] at Tower_Point facing Default building facing with scale 1.50 and variation 0
          • -------- --------
          • Custom script: call RemoveLocation (udg_Tower_Point)
  • Destroy Tower Icon
    • Events
      • Unit - A unit Finishes research
    • Conditions
      • (Researched tech-type) Equal to Change Tower
    • Actions
      • Set VariableSet Tower_PN = (Player number of (Owner of (Triggering unit)))
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Researching unit)) Equal to Player 1 (Red)
        • Then - Actions
          • Destructible - Pick every destructible in P1 All Tier <gen> and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Load (Key (Picked destructible).) of Tower_PN from TowerIcon_Hash.) Not equal to 0
                • Then - Actions
                  • -------- Set the selected towers region to available again: --------
                  • Hashtable - Save False as (Load (Key (Picked destructible).) of Tower_PN from TowerIcon_Hash.) of Tower_PN in TowerIcon_HashUnavailable.
                  • Destructible - Kill (Picked destructible)
                  • Destructible - Remove (Picked destructible)
                  • Set VariableSet Tower_Count[Tower_PN] = (Tower_Count[Tower_PN] - 1)
                • Else - Actions
        • Else - Actions
  • Add Chosen Regions To Hashtable
    • Events
    • Conditions
    • Actions
      • For each (Integer Tower_Loop) from 1 to TowerIcon_RegionsMax, do (Actions)
        • Loop - Actions
          • -------- This saves each of the player's chosen regions (aka rects) to the hashtable: --------
          • Hashtable - Save Handle OfTowerIcon_Regions[Tower_Loop] as Tower_Loop of Tower_PN in TowerIcon_Hash.
          • -------- --------
          • -------- So to get Player 1's first chosen tower region, you would Load 1 (chosen #) of 1 (player #) from Tower_ChosenHashtable --------
          • -------- To get Player 2's first chosen tower region, you would Load 1 (chosen #) of 2 (player #) from Tower_ChosenHashtable --------
  • Add Tower Types To Hashtable
    • Events
    • Conditions
    • Actions
      • For each (Integer Tower_Loop) from 1 to TowerType_Max, do (Actions)
        • Loop - Actions
          • -------- Unit-types can be converted to Integers using custom script, this allows us to store Unit-Types in the hashtable: --------
          • Custom script: set udg_Tower_Id = udg_DestructibleTypes[udg_Tower_Loop]
          • -------- --------
          • -------- This saves each of the tower types to the hashtable under their tier type --------
          • Hashtable - Save Tower_Id as Tower_Loop of TowerType_Tier in TowerType_Hash.
          • -------- --------
          • -------- So to get the first level 1 tower you would Load 1 (tower #) of 1 (level #) from Tower_TypeHashtable --------
          • -------- To get the second level 1 tower you would Load 1 (tower #) of 2 (level #) from Tower_TypeHashtable --------
 

Attachments

  • Custom UI.w3m
    66.5 KB · Views: 1
  • Custom UI2.w3m
    33.3 KB · Views: 4
Status
Not open for further replies.
Top