• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

How to double resources workers harvest?

Status
Not open for further replies.
Level 6
Joined
Mar 19, 2015
Messages
60
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:
Level 6
Joined
May 20, 2014
Messages
228
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.
 
Level 6
Joined
Mar 19, 2015
Messages
60
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.

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).
 
Level 6
Joined
May 20, 2014
Messages
228
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.
 
Level 6
Joined
Mar 19, 2015
Messages
60
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.

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?
 
Level 25
Joined
May 11, 2007
Messages
4,651
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.
 
Level 6
Joined
Mar 19, 2015
Messages
60
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.

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?
 
Level 12
Joined
Mar 24, 2011
Messages
1,082
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.
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:
Level 6
Joined
May 20, 2014
Messages
228
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.
 

Attachments

  • (2)SecretValley.w3x
    218.4 KB · Views: 225
Level 12
Joined
Mar 24, 2011
Messages
1,082
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.
 
Level 12
Joined
May 20, 2009
Messages
822
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.
 
Level 25
Joined
May 11, 2007
Messages
4,651
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.
 
Level 12
Joined
May 20, 2009
Messages
822
@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.)
 
Level 16
Joined
May 2, 2011
Messages
1,345
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.
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)
 
Level 8
Joined
May 21, 2019
Messages
435
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.
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
 
Status
Not open for further replies.
Top