• 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.

How every second the house will yield gold and display it (not the enemy)

Status
Not open for further replies.
Level 5
Joined
May 8, 2020
Messages
87
1710262337479.png


I see some maps have this, I want to ask
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
You can track all of the houses in a Unit Group variable to easily reference them every second:
  • Events
    • Time - Every 1.00 seconds of game time
  • Conditions
  • Actions
    • Unit Group - Pick every unit in House_Group and do (Actions)
      • Loop - Actions
        • Player - Add 100 to (Owner of (Picked unit)) Current gold
        • Floating Text - Create floating text that reads +100 above (Picked unit) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
You would track a house like this:
  • Unit Group - Add (Triggering unit) to House_Group
Of course the Event Response will change depending on the circumstances.
 
Last edited:
Level 12
Joined
May 29, 2008
Messages
149
To hide it from enemy players, you'll need to use the local player utilities to change the value of the text. After creating the floating text, you can say something like if the local player is in a group of Enemies, set the text to empty string. I'm not exactly sure what this would look like in GUI.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
To hide it from enemy players, you'll need to use the local player utilities to change the value of the text. After creating the floating text, you can say something like if the local player is in a group of Enemies, set the text to empty string. I'm not exactly sure what this would look like in GUI.
You can just hide it using the Show/Hide function, it takes a Player Group which allows for individual players (group of 1).
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
House_Group is an empty Unit Group:
  • Unit Group - Pick every unit in House_Group and do (Actions)
That line you mentioned adds units to it.

So whenever a Player builds a house you would add it to the House_Group. Of course if you don't explain how your map works or give any details than I can't really do anything but speculate on what you want.
 
Last edited:
Level 5
Joined
May 8, 2020
Messages
87
House_Group is an empty Unit Group:
  • Unit Group - Pick every unit in House_Group and do (Actions)
That line adds units to it.

So whenever a Player builds a house you would add that to the House_Group. Of course if you don't explain how your map works or give any details at all I can't really do anything but speculate on what you want.
i want when i own 1/4 house of each human/orc/nightelf/undead race then when i have 1 baby dragon
I will have an output every 34 seconds of 200 wood
and continue when I have 1 big dragon that will output every 28 seconds 500 wood.
When my main production house is destroyed, everything will not work until I rebuild one of the 4 houses mentioned above.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,877
Do you build the house? What does own mean exactly? What is a main production house? Remember, you can do just about anything in Warcraft 3.

Anyway, I'll assume you build these Houses with a worker and train/buy the Dragons like a hero or normal unit. If you build the Dragons then you should replace the Event "A unit Enters playable map area" with "A unit Finishes construction".

Create 2 triggers, one with a 34 second periodic interval and one with a 28 second periodic interval. Use these to add the lumber periodically:
  • Events
    • Time - Every 34.00 seconds of game time
  • Conditions
  • Actions
    • Unit Group - Pick every unit in House_Baby_Group and do (Actions)
      • Loop - Actions
        • Player - Add 200 to (Owner of (Picked unit)) Current lumber
        • Floating Text - Create floating text that reads +200 above (Picked unit) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
        • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
        • Floating Text - Change (Last created floating text): Disable permanence
        • Floating Text - Change the lifespan of (Last created floating text) to 4.00 seconds
        • Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
        • Set PlayerGroup = (Player group((Owner of Picked unit)))
        • Floating Text - Hide (Last created floating text) for (All players)
        • Floating Text - Show (Last created floating text) for PlayerGroup
        • Custom script: call DestroyForce( udg_PlayerGroup )
  • Events
    • Time - Every 28.00 seconds of game time
  • Conditions
  • Actions
    • Unit Group - Pick every unit in House_Big_Group and do (Actions)
      • Loop - Actions
        • Player - Add 500 to (Owner of (Picked unit)) Current lumber
        • Floating Text - Create floating text that reads +500 above (Picked unit) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
        • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
        • Floating Text - Change (Last created floating text): Disable permanence
        • Floating Text - Change the lifespan of (Last created floating text) to 4.00 seconds
        • Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
        • Set PlayerGroup = (Player group((Owner of Picked unit)))
        • Floating Text - Hide (Last created floating text) for (All players)
        • Floating Text - Show (Last created floating text) for PlayerGroup
        • Custom script: call DestroyForce( udg_PlayerGroup )
Then add the Houses to the correct Unit Group when you build them:
  • Events
    • Unit - A unit Finishes construction
  • Conditions
    • (Level of House Classification for (Triggering unit)) Equal to 1
  • Actions
    • Set TempGroup1 = (Units owned by (Owner of (Triggering unit)) matching (Unit-type of (Matching unit) Equal to Big Dragon) and (Matching unit) is Alive Equal to True)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Number of units in TempGroup1 Greater than 0)
      • Then - Actions
        • Unit Group - Add (Triggering unit) to House_Big_Group
      • Else - Actions
        • Set TempGroup2 = (Units owned by (Owner of (Triggering unit)) matching (Unit-type of (Matching unit) Equal to Baby Dragon) and (Matching unit) is Alive Equal to True)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Number of units in TempGroup2 Greater than 0)
          • Then - Actions
            • Unit Group - Add (Triggering unit) to House_Baby_Group
          • Else - Actions
        • Custom script: call DestroyGroup( udg_TempGroup2 )
    • Custom script: call DestroyGroup( udg_TempGroup1 )
Also, move the Houses to the correct Unit Group when a Dragon enters the map or dies:
  • Events
    • Unit - A unit Enters playable map area
    • Unit - A unit Dies
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Baby Dragon
  • Actions
    • Set TempGroup1 = (Units owned by (Owner of (Triggering unit)) matching (Unit-type of (Matching unit) Equal to Big Dragon) and (Matching unit) is Alive Equal to True)
    • Set TempGroup2 = (Units owned by (Owner of (Triggering unit)) matching (Unit-type of (Matching unit) Equal to Baby Dragon) and (Matching unit) is Alive Equal to True)
    • Set TempGroup3 = (Units owned by (Owner of (Triggering unit)) matching (Level of House Classification for (Matching unit) Equal to 1)
    • Set BabyDragonCount = (Number of units in TempGroup1)
    • Set BigDragonCount = (Number of units in TempGroup2)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (BabyDragonCount Equal to 0)
        • (BigDragonCount Equal to 0)
      • Then - Actions
        • Unit Group - Remove all units of TempGroup3 from House_Baby_Group.
      • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (BigDragonCount Equal to 0)
          • Then - Actions
            • Unit Group - Add all units of TempGroup3 to House_Baby_Group.
          • Else - Actions
    • Custom script: call DestroyGroup( udg_TempGroup1 )
    • Custom script: call DestroyGroup( udg_TempGroup2 )
    • Custom script: call DestroyGroup( udg_TempGroup3 )
  • Events
    • Unit - A unit Enters playable map area
    • Unit - A unit Dies
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Big Dragon
  • Actions
    • Set TempGroup1 = (Units owned by (Owner of (Triggering unit)) matching (Unit-type of (Matching unit) Equal to Big Dragon) and (Matching unit) is Alive Equal to True)
    • Set TempGroup2 = (Units owned by (Owner of (Triggering unit)) matching (Level of House Classification for (Matching unit) Equal to 1)
    • Set BigDragonCount = (Number of units in TempGroup2)
    • Unit Group - Remove all units of TempGroup2 from House_Baby_Group.
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (BigDragonCount Greater than 0)
      • Then - Actions
        • Unit Group - Add all units of TempGroup2 to House_Big_Group.
      • Else - Actions
    • Custom script: call DestroyGroup( udg_TempGroup1 )
    • Custom script: call DestroyGroup( udg_TempGroup2 )
When a House dies make sure to remove it from the Unit Groups so it stops generating lumber:
  • Events
    • Unit - A unit Dies
  • Conditions
    • (Level of House Classification for (Triggering unit)) Equal to 1
  • Actions
    • Set TempGroup1 = (Units owned by (Owner of (Triggering unit)) matching (Level of House Classification for (Matching unit) Equal to 1)
    • Unit Group - Remove (Triggering unit) from House_Baby_Group.
    • Unit Group - Remove (Triggering unit) from House_Big_Group.
    • Custom script: call DestroyGroup( udg_TempGroup1 )
House Classification is a hidden ability based on Storm Hammers. Give it to all of your House units in the Object Editor. To hide an ability, set it's Art - Button Positions to 0, -11. (Hold shift while opening a field to enable negative values)

Variables:
TempGroup1 = Unit Group
TempGroup2 = Unit Group
TempGroup3 = Unit Group
House_Baby_Group = Unit Group
House_Big_Group = Unit Group
BabyDragonCount = Integer
BigDragonCount = Integer
PlayerGroup = Player Group

Note that you can optimize these triggers a lot, this is just the lazy way of doing it. I highly recommend using unique variables for everything, I happened to use these "Temp" variables because I was in a rush, but when working with the "A unit Dies" event you should try to use new variables. To clarify, all of these triggers can still share the same variables, just make sure outside triggers do not.
 
Last edited:
Status
Not open for further replies.
Top