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

Income system help

Status
Not open for further replies.
Level 3
Joined
May 24, 2012
Messages
57
I am trying to create a building that every 8 seconds after being built gives you +10/+15/+20 (after upgrades) of a custom resource using a multiboard but i dont want them to give that value all at the same time. Instead i want them to give that value every 8 seconds from the time each building is finished being built. I am very new to triggers and have never used JASS or anything else. Please need help as i have no idea of how to even start this trigger... I have thought about maybe using an ability to determine the time each building gives their income but i dont know how to do that either, and no forum post i've read has really hit this one on the spot.
 
Level 11
Joined
Aug 6, 2009
Messages
697
Here it is

Initialization
  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set IncHash = (Last created hashtable)
ADDFARM
  • Farm Add
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to City
    • Actions
      • Set Farm = (Constructed structure)
      • Custom script: set udg_ID2 = GetHandleId (udg_Farm)
      • Unit Group - Add Farm to FarmGroup
      • Set FarmTimer = 8.00
      • Hashtable - Save FarmTimer as 0 of ID2 in IncHash
      • Hashtable - Save Handle OfFarm as 1 of ID2 in IncHash
LOOP
  • Farm Loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in FarmGroup and do (Actions)
        • Loop - Actions
          • Custom script: set udg_ID2 = GetHandleId(GetEnumUnit())
          • Set FarmTimer = (Load 0 of ID2 from IncHash)
          • Set Farm = (Load 1 of ID2 in IncHash)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • FarmTimer Greater than 0.00
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is dead) Equal to True
                • Then - Actions
                  • Unit Group - Remove (Picked unit) from FarmGroup
                  • Hashtable - Clear all child hashtables of child ID2 in IncHash
                • Else - Actions
              • Hashtable - Save (FarmTimer - 1.00) as 0 of ID2 in IncHash
            • Else - Actions
              • Player - Add 10 to (Owner of Farm) Current gold
              • Hashtable - Save (FarmTimer + 8.00) as 0 of ID2 in IncHash
If you have any questions just ask.
 
Level 3
Joined
May 24, 2012
Messages
57
i mean i did not try it. I mean to try it on another map other than the one i wanted this for. I decided to go with a different resource gathering system than this style for my current project.
 
Level 11
Joined
Aug 6, 2009
Messages
697
i mean i did not try it. I mean to try it on another map other than the one i wanted this for. I decided to go with a different resource gathering system than this style for my current project.

Awesome, this made me waste my time. Why even ask someone to take there time for you and waste it when you aren't even going to take the time to replicate/ask for the map?
 
Level 3
Joined
May 24, 2012
Messages
57
You didnt waste your time, i just havent tested it out yet. My reasoning for that is because after i finish my current project i have another project in mind that this will be SUPER useful for and i am very thankful you took the time to make this trigger.
 
Status
Not open for further replies.
Top