• 🏆 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!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!

[Trigger] Problem with Gold income trigger

Status
Not open for further replies.
Level 2
Joined
Aug 4, 2010
Messages
23
Hello i have a trigger that adds gold by amount of maxium mana of building that has abillity called: "Gold Income" to player.
Everything is fine except one. Gold is increased immediately when worker being construction.

Is there a way to add condition that will check if building is already constructed?

Sorry for mistakes in this trigger i manually translated it to english.
  • Income
    • Events
      • time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • players group - Pick every player in playerGroup and do (Actions)
        • Loop - Actions
          • Set tempUnitGroup = (Units owned by (Picked player) matching (((Matching unit) is Building) equal YES))
          • units group - Pick every unit in tempUnitGroup and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Gold Income for (Picked unit)) larger than 0
                  • ((Picked unit) is alive) equal YES
                • Then - Actions
                  • Set TempInt = (Integer((Maximum mana of (Picked unit))))
                  • Set TempLoc = (Position of (Picked unit))
                  • Player - Add TempInt to (Picked player) Actual gold amount
                  • Text - Create floating text that reads (+ + (String(TempInt))) at TempLoc with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 0.00%), and 30.00% transparency
                  • Floating Text - Change (Last created floating text): turn off permanence
                  • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
                  • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
                  • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                  • Custom script: call RemoveLocation(udg_TempLoc)
                • Else - Actions
          • Custom script: call DestroyGroup(udg_tempUnitGroup)
 
Last edited:
Level 4
Joined
Jul 14, 2012
Messages
100
Use the event:

  • Unit - A unit Finishes construction
Then add the built structure to a unit group. Then every second, check if each unit in the group is still alive (and remove it if it isn't) and add the gold amount to the owning player.

Or better yet, upon construction add the unit to the unit group, and upon unit death, remove it from the unit group.
 
Status
Not open for further replies.
Top