• 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] Remove if there is more than one item in region

Status
Not open for further replies.
Level 30
Joined
Feb 18, 2014
Messages
3,623
If the item is invulnerable, then you simply need to check when it is acquired and respawn it. If not then you need to register an event that checks when said item is destroyed/dead using the native native TriggerRegisterDeathEvent takes trigger whichTrigger, widget whichWidget returns event. Although it may not be a good idea to spam this native since you cannot remove events which may cause performance issues.
  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Item - Create Crown of Kings +5 at (Center of ItemSpawnPoint <gen>)
      • Set Item = (Last created item)
      • -------- --------
      • Custom script: call TriggerRegisterDeathEvent(gg_trg_Item_Dies, udg_Item)
  • Item Dies
    • Events
    • Conditions
    • Actions
      • Countdown Timer - Start ItemRespawnTimer as a One-shot timer that will expire in 5.00 seconds
      • Countdown Timer - Create a timer window for ItemRespawnTimer with title Respawn
      • Set ItemRespawnWindow = (Last created timer window)
      • Countdown Timer - Show ItemRespawnWindow
  • Item Acquired
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item being manipulated) Equal to Item
    • Actions
      • Countdown Timer - Start ItemRespawnTimer as a One-shot timer that will expire in 5.00 seconds
      • Countdown Timer - Create a timer window for ItemRespawnTimer with title Respawn
      • Set ItemRespawnWindow = (Last created timer window)
      • Countdown Timer - Show ItemRespawnWindow
  • Item Respawn
    • Events
      • Time - ItemRespawnTimer expires
    • Conditions
    • Actions
      • Countdown Timer - Destroy ItemRespawnWindow
      • Item - Create Crown of Kings +5 at (Center of ItemSpawnPoint <gen>)
      • Set Item = (Last created item)
      • -------- --------
      • Custom script: call TriggerRegisterDeathEvent(gg_trg_Item_Dies, udg_Item)
There is another workaround but this one will ignore the wait:
 
Level 6
Joined
Sep 6, 2022
Messages
49
If the item is invulnerable, then you simply need to check when it is acquired and respawn it. If not then you need to register an event that checks when said item is destroyed/dead using the native native TriggerRegisterDeathEvent takes trigger whichTrigger, widget whichWidget returns event. Although it may not be a good idea to spam this native since you cannot remove events which may cause performance issues.
  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Item - Create Crown of Kings +5 at (Center of ItemSpawnPoint <gen>)
      • Set Item = (Last created item)
      • -------- --------
      • Custom script: call TriggerRegisterDeathEvent(gg_trg_Item_Dies, udg_Item)
  • Item Dies
    • Events
    • Conditions
    • Actions
      • Countdown Timer - Start ItemRespawnTimer as a One-shot timer that will expire in 5.00 seconds
      • Countdown Timer - Create a timer window for ItemRespawnTimer with title Respawn
      • Set ItemRespawnWindow = (Last created timer window)
      • Countdown Timer - Show ItemRespawnWindow
  • Item Acquired
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item being manipulated) Equal to Item
    • Actions
      • Countdown Timer - Start ItemRespawnTimer as a One-shot timer that will expire in 5.00 seconds
      • Countdown Timer - Create a timer window for ItemRespawnTimer with title Respawn
      • Set ItemRespawnWindow = (Last created timer window)
      • Countdown Timer - Show ItemRespawnWindow
  • Item Respawn
    • Events
      • Time - ItemRespawnTimer expires
    • Conditions
    • Actions
      • Countdown Timer - Destroy ItemRespawnWindow
      • Item - Create Crown of Kings +5 at (Center of ItemSpawnPoint <gen>)
      • Set Item = (Last created item)
      • -------- --------
      • Custom script: call TriggerRegisterDeathEvent(gg_trg_Item_Dies, udg_Item)
There is another workaround but this one will ignore the wait:
Hello, So I might've been a bit unclear. When I meant that the item would be removed I meant that it was picked up. Apologies for being unclear.
 
Status
Not open for further replies.
Top