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

Help with a system i can't implement

Status
Not open for further replies.
Level 2
Joined
Sep 2, 2013
Messages
17
Guys, i'm really trying to research, but i'm not a good programer and a can't figure out how to to a system i need for my map.
I need that every 5 seconds, the trigger recognizes all units buildings containing a certain ability in a region, and give a certain amount of gold to the owners of the buildings, depending on the number of them (Something like 10 x number os structures)
Can you help me out? I swear i tried very hard D:
 
I do not understand what you mean with reorganizing buildings, but giving certain amount of gold should not be that hard. I show one way how you could do that:

  • Trigger
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer i) from 1 to 12, do (Actions)
        • Loop - Actions
          • Set Counter[i] = 0
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (YourRegion) and do (Actions)
        • Loop - Actions
          • Set u = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (u is a Building) == True
              • (Level of (YourAbility) for u) > 0
            • Then - Actions
              • Set i = (Player number of (Owner of u))
              • Set Counter[i] = (Counter[i] + 1)
            • Else - Actions
      • For each (Integer i) from 1 to 12, do (Actions)
        • Loop - Actions
          • Player - Add (Counter[i] x 10) to (Player(i)) Gold
Variables:
u :unit
i :integer
Counter :integer[array]

Ask, if you don't understand something.
 
Level 12
Joined
Oct 16, 2010
Messages
680
track income for players in array (IncomeArray[])

  • Events
    • Time - Every x sec of game time
  • Conditions
  • Actions
    • For each (IntegerVariable) to 12, do (Actions)
      • Loop - Actions
        • Player - Give IncomeArray[IntegerVariable]xSome Gold to Player(IntegerVariable]

  • Events
    • Unit - A unit Finishes construction
  • Conditions
    • Condition - Type of Constructed Structure equals to YourStructure
  • Actions
    • Set TempInt = Player number of(Owner of (Triggering Unit))
    • Set IncomeArray[TempInt] = IncomeArray[TempInt] + 1
 
Status
Not open for further replies.
Top