• 🏆 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!

Custom Gold Mine(Rich Gold Mine)

Status
Not open for further replies.
Level 1
Joined
Oct 30, 2016
Messages
3
Hello friends, so I want to create a custom gold mine, which workers will mine 25 gold per trip from it, while keeping the 10 gold per trip standard mine, similar to Starcraft's rich mineral patches and I need some help.

So I copied the mine into another unit. And I also copied the abilities Havest(Gold and Lumber) and Gold mine ability into new custom ones, changing the custom Harvest to 25 gold per trip. Now my question is how do I make the custom mine and workers harvesting at the custom use the custom harvest and gold mine abilities at 25 gold per trip, while keeping the standard gold mine at 10 gold, as it seems they overlap and they harvest 10 + 25 gold?
 
Level 39
Joined
Feb 27, 2007
Messages
5,010
I think workers break if you remove and re-add their harvesting abilities, but it could be worth trying to remove the +10 one and add the +25 one. If that works you'll have to decide on some logic for when to replace the ability. I would check when a worker gets near a mine and replace the ability then. If they get near a regular mine, remove the new and re-add the old.
it seems they overlap and they harvest 10 + 25 gold?
They successfully harvest 35g from the mine every trip? If that's the case then just change it to 15 bonus gold so 15+10=25.
 
Level 1
Joined
Oct 30, 2016
Messages
3
I think workers break if you remove and re-add their harvesting abilities, but it could be worth trying to remove the +10 one and add the +25 one. If that works you'll have to decide on some logic for when to replace the ability. I would check when a worker gets near a mine and replace the ability then. If they get near a regular mine, remove the new and re-add the old.

They successfully harvest 35g from the mine every trip? If that's the case then just change it to 15 bonus gold so 15+10=25.

Wait how would I check if he is near a "Rich Gold Mine" and a regular one? And they are farming 10 + 25 on both types of mines that's the problem.
 
Level 39
Joined
Feb 27, 2007
Messages
5,010
Daffa's solution sounds way better than triggering it. Rudimentary but something like this would work:
  • Events
    • Time - Elapsed Game-time is 0.50 seconds
    • --------- too many things at map init can crash the map init thread ---------
  • Conditions
  • Actions
    • -------- create 2 ability variables RegHarvest & RichHarvest, replace the xxxxes with the rawcodes for your 2 harvesting abilities --------
    • Custom script: set udg_RegHarvest = 'xxxx'
    • Custom script: set udg_RichHarvest = 'xxxx'
    • Custom script: set bj_wantDestroyGroup = true
    • --------- there might be a "pick all units of type X" action too I don't remember --------
    • Unit Group - Pick every unit in (playable map area) matching (Unit-type of (Matching Unit) equal to Rich Gold Mine)) and do (Actions)
    • Loop - Actions
      • Trigger - Add to OtherTrigger1 <gen> the action (A unit comes within XX range of (Picked Unit))
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in (playable map area) matching (Unit-type of (Matching Unit) equal to Gold Mine)) and do (Actions)
    • Loop - Actions
      • Trigger - Add to OtherTrigger2 <gen> the action (A unit comes within XX range of (Picked Unit))
  • -------- other trigger 1 --------
  • Events
  • Conditions
    • ((Triggering Unit) is a worker) equal to true)
  • Actions
    • Set TempU = Triggering Unit
    • If (All conditions are true) then do (then actions) else do (else actions)
      • If - Conditions
        • (Level of RegHarvest) for TempU greater than 1
      • Then - Actions
        • Unit - Remove RegHarvest from TempU
        • Unit - Add RichHarvest to TempU
  • -------- other trigger 2 --------
  • Events
  • Conditions
    • ((Triggering Unit) is a worker) equal to true)
  • Actions
    • Set TempU = Triggering Unit
    • If (All conditions are true) then do (then actions) else do (else actions)
      • If - Conditions
        • (Level of Richarvest) for TempU greater than 1
      • Then - Actions
        • Unit - Remove RichHarvest from TempU
        • Unit - Add RegHarvest to TempU
There are ways to break this trigger but it would probably be pretty good. I would pick a range for the mines that is JUST bigger than the radius at which workers disappear inside it so they only trigger it right before starting to harvest.
 
Status
Not open for further replies.
Top