• 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] Controlling Number of Items Spawned

Status
Not open for further replies.
Level 1
Joined
Aug 15, 2007
Messages
2
In a map that I'm working on, there will be certain locations in which powerups constantly spawn. However, I want to limit the number that will exist in one of these areas at once so they don't form giant item deposits. What I'm trying now is this (sorry if it looks stupid, I'm assuming i just stick it between trigger tags)

  • Ley Line Drops0
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ItemCount0 Less than 3
        • Then - Actions
          • Item - Create ItemType at (Random point in Region 000 <gen>)
          • Set ItemCount0 = (ItemCount0 + 1)
        • Else - Actions
          • Do nothing
and

  • Ley Line DropDecrease0
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Item being manipulated) is in Region 000 <gen>) Equal to True
          • Or - Any (Conditions) are true
            • Conditions
              • (Item-type of (Item being manipulated)) Equal to |c000000FFSoul Dew|r
              • (Item-type of (Item being manipulated)) Equal to |c00FF0000Power Dew|r
        • Then - Actions
          • Set ItemCount0 = (ItemCount0 - 1)
        • Else - Actions
          • Do nothing
Where Region000 is the region the items are spawning in, ItemType is an item variable randomly determined, and ItemCount is an integer variable defaulting to 0. The first part works fine, no more than the allotted number of items will spawn, but the second half is useless. After collecting the spawned items, no more will reappear, indicating that the ItemCount variable is not decreasing, or I did something else stupid and failed to notice. Any advice?
 
Level 4
Joined
Jul 12, 2007
Messages
116
You should replace this condition

  • ((Item being manipulated) is in Region 000 <gen>) Equal to True


whit this.

  • ((Hero manipulating item) is in Region 000) Equal to True

You know when a hero acquires an item, its no longer in the region its in the inventory of the unit.
 
Status
Not open for further replies.
Top