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

how can i make a endless gold mine?

Status
Not open for further replies.
Level 9
Joined
Apr 23, 2011
Messages
460
I'll make a trigger real quick for you


EDIT: This should work. Checked it, working fine for me. You can set the 1M to whatever you want to as long as you're not setting it to a number <= the number you're extracting per harvest


  • Endless Goldmine
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Gold Mine
            • Then - Actions
              • Neutral Building - Set (Picked unit) to 1000000 gold
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Picked unit)) Equal to Entangled Gold Mine
                • Then - Actions
                  • Neutral Building - Set (Picked unit) to 1000000 gold
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of (Picked unit)) Equal to Haunted Gold Mine
                    • Then - Actions
                      • Neutral Building - Set (Picked unit) to 1000000 gold
                    • Else - Actions
 
Level 2
Joined
Jun 4, 2011
Messages
27
TY!!!!!!!!!

I'll make a trigger real quick for you


EDIT: This should work. Checked it, working fine for me. You can set the 1M to whatever you want to as long as you're not setting it to a number <= the number you're extracting per harvest


  • Endless Goldmine
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Gold Mine
            • Then - Actions
              • Neutral Building - Set (Picked unit) to 1000000 gold
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Picked unit)) Equal to Entangled Gold Mine
                • Then - Actions
                  • Neutral Building - Set (Picked unit) to 1000000 gold
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of (Picked unit)) Equal to Haunted Gold Mine
                    • Then - Actions
                      • Neutral Building - Set (Picked unit) to 1000000 gold
                    • Else - Actions
Thanks a lot khamarr3524
thumbsup1.gif
 
Level 10
Joined
Apr 25, 2009
Messages
296
The current Endless Gold Mine is looping too quickly and is relatively inefficient. A simplified and more efficient version would be this:

  • Untitled Trigger 002
    • Events
      • Time - Every 30.00 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Entangled Gold Mine) or (((Unit-type of (Matching unit)) Equal to Haunted Gold Mine) or ((Unit-type of (Matching unit)) Equal to Gold Mine)))) and do (Actions)
        • Loop - Actions
          • Neutral Building - Set (Picked unit) to 100000 gold
A .10 loop is useless because its extremely unlikely that one would go through 100,000 gold that fast, and could potentially generate lagg. Using multiple condition blocks to determine the unit type with the same outcome can be simplified to what was shown above.
 
Level 2
Joined
Jun 4, 2011
Messages
27
thanks Archangel678, but i thinks .10 is for testing.

anyway, can some1 give me that in jass? for just copy & peaste?
or demo map? or just tell me where is "Neutral Building - Set (Picked unit) to 100000 gold"
 
Level 10
Joined
Apr 25, 2009
Messages
296
thanks Archangel678, but i thinks .10 is for testing.

anyway, can some1 give me that in jass? for just copy & peaste?
or demo map? or just tell me where is "Neutral Building - Set (Picked unit) to 100000 gold"
Sure, I can make it in jass. Just give me a second...

JASS:
function EndlessGold takes nothing returns boolean
    local unit f
    local group g = CreateGroup()
    local integer id
    call GroupEnumUnitsInRange(g, 0,0, 300000, null)
    loop
        set f = FirstOfGroup(g)
        exitwhen f == null
        set id = GetUnitTypeId(f)
        if id == 'ugol' or id == 'egol' or id == 'ngol' then
            call SetResourceAmount( f, 100000 )
        endif
        call GroupRemoveUnit(g,f)
    endloop
    call DestroyGroup(g)
    set g = null
    set f = null
    return false
endfunction

function InitTrig_EndlessGold takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterTimerEvent(t, 1, true)
    call TriggerAddCondition(t, Condition(function EndlessGold))
    set t = null
endfunction

Should work.
 
Status
Not open for further replies.
Top