1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Travel to distant realms and encounter scenes unknown to the common folk. The Greatest of Adventures is upon us with the 8th Cinematic Contest. Join in on a fun ride.
    Dismiss Notice
  4. The 18th Icon Contest is ON! Choose any ingame unit and give him/her Hero abilities. Good luck to all.
    Dismiss Notice
  5. The Secrets of Warcraft 3 have revealed interesting works. The RESULTS for Abelhawk's Mini-Mapping Contest #15 have come out!
    Dismiss Notice
  6. Contestants are to create a scene set in the Stone Age. Come and see what you can come up with. We wish you the best of luck!
    Dismiss Notice
  7. Colour outside the lines! Techtree Contest #13 is a go. The contest is optionally paired.
    Dismiss Notice
  8. Night Rider gained several songs for his journey. The poll for the 12th Music Contest has started. Check it out!
    Dismiss Notice
  9. Greetings cerebrates, our Swarm needs new spawners that will have numerous children. Join the HIVE's 31st Modeling Contest - Spawners and Spawned! The contest is optionally paired.
    Dismiss Notice
  10. 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.

How to double resources workers harvest?

Discussion in 'Triggers & Scripts' started by Bogdanov89, Mar 20, 2015.

  1. Bogdanov89

    Bogdanov89

    Joined:
    Mar 19, 2015
    Messages:
    21
    Resources:
    0
    Resources:
    0
    I want to edit one of blizzard's regular TFT maps to give ONLY player 1 (me) double the gold/wood from the worker gatherings.

    It also needs to not be tied to any specific unit or race, so that i can gain double harvested resources regardless of what race/units i am using.

    Similar to how Insane AI gets +20 gold instead of the +10 that his worker actually harvests.

    However i am really bad with triggers/scripts, so i need one of you wizards to please help me out :)

    Basically i want to have the same "cheat" as the Insane AIs where they get double the resources compared to what their workers harvest.

    Thank you for helping me out :grin:
     
    Last edited: Mar 20, 2015
  2. Alright

    Alright

    Joined:
    May 20, 2014
    Messages:
    230
    Resources:
    0
    Resources:
    0
    There's not really a trigger, it's all done in object editor. Look for an ability named 'Harvest (Gold and Lumber)', and in the fields:

    Data - Gold Capacity
    Data - Lumber Capacity

    Simply increase these to something like 20 if you want both gold and lumber to give 20. Of course, keep in mind that it will affect all units with this ability so you might have to make a custom ability and make it only affect the race you want to do, or how ever you want to do with it.
     
  3. Bogdanov89

    Bogdanov89

    Joined:
    Mar 19, 2015
    Messages:
    21
    Resources:
    0
    Resources:
    0
    Thank you for replying!

    However i need it to affect only player 1 (regardless of race/units), instead of modifying something that can affect multiple players or is tied to a race.

    I was hoping that there was a way to give 10g every time my gold increases by 10g (a worker drops off one gold payload, 7g or 4g with income tax).
    Or anything similar that could mimic the effect of resource gain being doubled (especially if there are multiple gold mine expansions).
     
  4. Alright

    Alright

    Joined:
    May 20, 2014
    Messages:
    230
    Resources:
    0
    Resources:
    0
    You could make a custom research based on Improved Lumber Harvesting, and increasing Lumber harvest bonus by 10 and also adding Gold harvest bonus as well. Then simply add this to map initialization in triggers:

    • Player - Set the current research level of <your new research> to 1 for Player 1 (Red)


    This will basically set the current level of the research you have for that player. Just make sure you add the research to workers in unit object editor, too.
     
  5. Bogdanov89

    Bogdanov89

    Joined:
    Mar 19, 2015
    Messages:
    21
    Resources:
    0
    Resources:
    0
    Great idea!

    I will definitely try this - but would it not increase the time workers need to "hit" trees to get that full payload?

    Insane AI gets 20 wood while the worker took the time to harvest only 10.
    This way my workers would need to get whole 20 wood to deposit 20 wood?

    Would it increase the amount of time needed for workers to fill their gold payload from the mine?
     
  6. LordDz

    LordDz

    Joined:
    May 11, 2007
    Messages:
    4,308
    Resources:
    0
    Resources:
    0
    In the ability harvest gold and lumber you have these fields:
    Data - Damage to tree.
    Data - Gold Capacity.
    Data - Tree Capacity.

    Change the damage to tree to the amount of wood the worker gets per hit on the tree.
    Set the gold capacity to the amount of gold per trip to the gold mine.
    Set the tree capacity to the amount of wood the worker can carry.

    So if you want faster woodcutting, set the damage to tree to a higher level.
    The Goblin shredder has 10 damage for example. A tree has 50 health.
     
  7. Bogdanov89

    Bogdanov89

    Joined:
    Mar 19, 2015
    Messages:
    21
    Resources:
    0
    Resources:
    0
    Thank you for replying!

    Those options do sound great, but i would need them to only affect Player 1 (me).

    Is it possible to limit those to just affect Player 1?

    Or can the same effect be achieved in some other way, so that only Player 1 is affected?
     
  8. nedio95

    nedio95

    Joined:
    Mar 24, 2011
    Messages:
    1,055
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Umm, all your suggestions do not give double gold/wood, they just make workers harvest faster. The player will gain resources twice as fast but will exhaust resources with doubled speed.

    I would suggest the following :
    We have event "Player property becomes X"
    So you store players current gold and then check with the new gold value, you add the difference.
    Trigger:
    With this you MUST have another thing, this line:
    • Set LastGold = (Player 1 (Red) Current gold)

    Either in "Map Initialization" or on event "Game Time = 0.01" because the default value of LastGold would be 0 and players normaly do not start with 0 gold

    • Double Gold
      • Events
        • Player - Player 1 (Red)'s Current gold becomes Greater than or equal to 0.00
      • Conditions
      • Actions
        • Trigger - Turn off (This trigger)
        • Set CurrentGold = (Player 1 (Red) Current gold)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • CurrentGold Greater than LastGold
          • Then - Actions
            • Set GiveGold = (CurrentGold - LastGold)
            • Player - Add GiveGold to Player 1 (Red) Current gold
          • Else - Actions
        • Set LastGold = (Player 1 (Red) Current gold)
        • Trigger - Turn on (This trigger)

    Variables:
    GiveGold - Integer
    LastGold - Integer
    Currentgold - Integer


    If you are not afraid of switching to JASS, you can make it so it takes a variable in the event so it becomes shorter.

    You do the same for lumber.
    This trigger basically doubles ALL gold gained.

    A drawback is that the floating text, the yellow +X gold and the green +Y Lumber will show the original value. So if you gain +20 gold, the miner mines 10 and the trigger doubles that to 20, it will show up +10 gold in the floating text.
     
    Last edited: Mar 20, 2015
  9. Demonchill

    Demonchill

    Joined:
    Mar 21, 2015
    Messages:
    1
    Resources:
    0
    Resources:
    0
    nedio95 can you upload a map with the trigger, i just can't seem to get it working.
     
  10. Alright

    Alright

    Joined:
    May 20, 2014
    Messages:
    230
    Resources:
    0
    Resources:
    0
    I modified this melee map with the triggers posted by nedio95, gave it a try, and indeed it doubles all gold/lumber gain, scaling to any upkeep and such (being a gui noob, this is pretty awesome for something so simple). The only minor inconvenience is that it doubles the sell cost of all items when pawned to shops, thought that may not matter at all... or does it?

    Anyway, here's the map. There's a folder that you can copy paste the triggers in it, just make sure to tick pasting unknown variables in preferences on.
     

    Attached Files:

  11. nedio95

    nedio95

    Joined:
    Mar 24, 2011
    Messages:
    1,055
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Ah, The item thingy would be abusable if the item refund rate (the % of the price of the item you get when you sell it) is higher than 50% as the player can get infinite gold from it :(
    Buy item, sell it, buy again, sell again, buy, sell, etc. etc.
    I will try to think of/make a workaround that... ofc, if the effect is undesired.
     
  12. aple

    aple

    Joined:
    May 20, 2009
    Messages:
    807
    Resources:
    2
    Maps:
    1
    Tutorials:
    1
    Resources:
    2
    I just thought of a way to do this, but you have to sacrifice the original food resource and make a scripted one.

    Upkeep can actually make something return MORE Gold/Lumber. So all you do is set up the Upkeep the way you want, and make a dummy unit that costs food and all other units do not cost food. When what you want to give the extra Gold/Lumber is built,place this dummy unit for the player.

    Basically, make Upkeep go off when 1 food is achieved. When it is, the Upkeep "Tax" will increase the Gold/Lumber returned without actually harvesting more.

    Then all you need is a scripted food system which is not at all hard to do or come by. If you're making a big map, there's no reason not to do so anyway. It's a horribly limited system. In pretty much everything I'm doing ATM, I plan on replacing it at some point with a triggered system.
     
  13. LordDz

    LordDz

    Joined:
    May 11, 2007
    Messages:
    4,308
    Resources:
    0
    Resources:
    0
    This is a solution otherwise, it works by creating custom harvesting abilites that are 2 times faster, that are given to Player1's workers when they are trained.
    • Finishing training a worker
      • Events
        • Unit - A unit Finishes training a unit
      • Conditions
        • (Owner of (Triggering unit)) Equal to Player 1 (Red)
      • Actions
        • -------- Peasants, Peons --------
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Or - Any (Conditions) are true
              • Conditions
                • (Unit-type of (Trained unit)) Equal to Peasant
                • (Unit-type of (Trained unit)) Equal to Peon
          • Then - Actions
            • Unit - Remove Harvest (Gold and Lumber) from (Trained unit)
            • Unit - Add harvest (Gold and Lumber x2) to (Trained unit)
          • Else - Actions
        • -------- Undead --------
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of (Trained unit)) Equal to Acolyte
          • Then - Actions
            • Unit - Remove Gather (Acolyte Gold) from (Trained unit)
            • Unit - Add Gather (Acolyte Gold x2 speed) to (Trained unit)
          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of (Trained unit)) Equal to Ghoul
          • Then - Actions
            • Unit - Remove Harvest (Ghouls Lumber) from (Trained unit)
            • Unit - Add Harvest (Ghouls lumber, x2) to (Trained unit)
          • Else - Actions
        • -------- Wisps --------
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of (Trained unit)) Equal to Wisp
          • Then - Actions
            • Unit - Remove Gather (Wisp Gold and Lumber) from (Trained unit)
            • Unit - Add Gather (Wisp Gold and Lumber x2) to (Trained unit)
          • Else - Actions

    Solves the item sell problem and upkeep.

    A different way would be to use "a unit enters playable map area" instead of trained unit, to make sure the starting units get the abilities too.
     
  14. aple

    aple

    Joined:
    May 20, 2009
    Messages:
    807
    Resources:
    2
    Maps:
    1
    Tutorials:
    1
    Resources:
    2
    @LordDz You're still missing the point. He doesn't want the workers to HARVEST more (I think), he wants them to RETURN more. Which means still 10 gold is taken from the Gold Mine, but the Worker returns 20.

    I believe my method so far is the best option as the floating text will be displayed properly, it doesn't harvest more, and all you have to do is find a custom food system or make one, which neither will be hard at all. (Searching here on Hive, I already see 2 just from searching "food" under spells.)
     
  15. KILLCIDE

    KILLCIDE

    Administrator

    Joined:
    Jul 22, 2015
    Messages:
    3,494
    Resources:
    20
    Models:
    2
    Icons:
    10
    Spells:
    7
    Tutorials:
    1
    Resources:
    20
    Re-opened by request.
     
  16. map designer

    map designer

    Joined:
    May 2, 2011
    Messages:
    896
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Hello

    There is an easy work-around for this.

    add condition the following condition

    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • GiveGold Less than or equal to 10
      • Then - Actions
        • Player - Add GiveGold to Player 1 (Red) Current gold
      • Else - Actions



    This would prevent item sell-abuse because most items are more expensive than 20, so their sell price will be more than 10. on the other hand, peasants and peons only gather 10 gold, which we will then double.

    when Items are sold, this trigger will not fire (except for cheap items that are sold for 10 gold, which most maps dont have)
     
  17. Cespie

    Cespie

    Joined:
    May 21, 2019
    Messages:
    262
    Resources:
    0
    Resources:
    0
    You could just set the item resell value to half of its current value in the gameplay constants, and then make a trigger that grants the double gold if the upgrade is not researched whenever an item is sold. :)

    This would display a misleading resell value on items, but this whole suggestion is sort of based on ignoring those values anyway. :D