• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[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