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

[Trigger] oil drilling trigger

Status
Not open for further replies.
Level 13
Joined
Sep 24, 2007
Messages
1,023
well in my map u have to drill for oil
i was wondering if it could make it so that for u to get oil (gold) it has to be close to another building or unit (oil spot) you would get oil every 30 secs or so any help would be nice
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Not sure if this will work, but I don't really see any reason it shouldn't.

  • Untitled Trigger 005
    • Events
      • Time - Every 30.00 seconds of game time
    • Conditions
    • Actions
      • Set unitGroup = (Units of type Oil_Harvester_Building)
      • For each (Integer A) from 1 to (Number of units in unitGroup), do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in (Random 1 units from unitGroup) and do (Actions)
            • Loop - Actions
              • Unit Group - Remove (Picked unit) from unitGroup
              • Set Point = (Position of (Picked unit))
              • Set unitGroupTwo = (Units within 512.00 of Point matching ((Unit-type of (Matching unit)) Equal to Oil))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in unitGroupTwo) Greater than 0
                • Then - Actions
                  • Player - Add 100 to (Owner of (Picked unit)) Current gold
                • Else - Actions
              • Custom script: call RemoveLocation(udg_Point)
              • Unit Group - Remove all units from unitGroupTwo
      • Unit Group - Remove all units from unitGroup
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
So you get gold when you have an oil platform build close to an oil spot? Perhaps base your platform off the Undeath haunted gold mine, so it can only be build ON an oil patch, then make a trigger that picks every oil platform every 30 seconds and adds 10 gold to the owner of picked unit?

EDIT: ghostwolf, why use an integer loop AND a "pick every unit" loop?
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
In that case...

  • Events
    • Every 30 seconds of game time
  • Actions
    • Set TempUG = all units of type (oil platform)
    • Unit group - pick every unit in (TempUG) and do actions:
      • Set TempUG2 = units within 256 of (picked unit)
      • If: Boolean Comparison - TempUG2 = not empty then
        • Player - Add 100 Gold to owner of picked unit
      • call DestroyGroup(udg_TempUG2)
    • call DestroyGroup(udg_tempUG)
EDIT: with this trigger, if you have e.g. 2 oilplatorms near 1 oilspot, both will gather oil... If you wish to avoid that, do:


  • Events
    • Every 30 seconds of game time
  • Actions
    • Set TempUG = all units of type (oil spot)
    • Unit group - pick every unit in (TempUG) and do actions:
      • For Integer A from 1 to 12 do:
        • Set TempUG2 = units within 256 of (picked unit) owned by Player[Integer A]
        • If: Boolean Comparison - TempUG2 = not empty then
          • Player - Add 100 Gold to owner of picked unit
        • call DestroyGroup(udg_TempUG2)
    • call DestroyGroup(udg_tempUG)
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
I don't think that will work since you are picking multiply units.

Its like we do it in JASS

JASS:
    ...
    call GroupEnumUnitsInRange(g, x, y, 200, null)
    loop
        set u = FirstOfGroup(g)
        exitwhen u == null
        call GroupRemoveUnit(g, u)
        //actions 
    endloop
    call DestroyGroup(g)
 
Status
Not open for further replies.
Top