# Custom Gold Mine(Rich Gold Mine)

Status
Not open for further replies.

Level 1
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?

#### Pyrogasm

Level 41
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
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.

#### Pyrogasm

Level 41
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.

Level 1
Thank you very much for the help.

Status
Not open for further replies.

Replies
3
Views
1K
Replies
1
Views
1K
Replies
2
Views
1K
Replies
2
Views
1K
Replies
3
Views
3K