• 🏆 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!

[Trigger] Remove if there is more than one item in region

Status
Not open for further replies.
Level 28
Joined
Feb 18, 2014
Messages
3,580
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
48
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