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

[General] Expiration timer to building

Status
Not open for further replies.
Level 5
Joined
Feb 1, 2024
Messages
44
I created a building and use action
  • Unit - Add a 15.00 second Generic expiration timer to (Last created unit)
to make it temporal but nothing happens. Are there any ways to add expiration timer to a building?
 
Level 12
Joined
May 7, 2008
Messages
346
I created a building and use action
  • Unit - Add a 15.00 second Generic expiration timer to (Last created unit)
to make it temporal but nothing happens. Are there any ways to add expiration timer to a building?

Not sure why that doesn't work, but you can always create a trigger with Timer that runs for 15 seconds.

Then create another trigger to check if the Timer expired, and kill / remove your desired building.

Maybe if you show us the full trigger I can see the context a bit further so I can help you out.
 
Level 5
Joined
Feb 1, 2024
Messages
44
Maybe if you show us the full trigger I can see the context a bit further so I can help you out.

Here you go, I wait for 15 seconds but nothing happens. I intend to use Timer but Expiration Timer will be neater.

  • Swap cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Swap
    • Actions
      • Set SwapPoint[0] = (Target point of ability being cast)
      • Set SwapPoint[1] = (Position of (Triggering unit))
      • Unit - Move (Triggering unit) instantly to SwapPoint[0]
      • Unit - Create 1 Ancient Protector for (Owner of (Triggering unit)) at SwapPoint[0] facing (180.00 + (Facing of (Triggering unit))) degrees
      • Unit - Move (Last created unit) instantly to SwapPoint[1]
      • Unit - Add a 15.00 second Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation(udg_SwapPoint[0])
      • Custom script: call RemoveLocation(udg_SwapPoint[1])
 
Level 12
Joined
May 7, 2008
Messages
346
Here you go, I wait for 15 seconds but nothing happens. I intend to use Timer but Expiration Timer will be neater.

  • Swap cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Swap
    • Actions
      • Set SwapPoint[0] = (Target point of ability being cast)
      • Set SwapPoint[1] = (Position of (Triggering unit))
      • Unit - Move (Triggering unit) instantly to SwapPoint[0]
      • Unit - Create 1 Ancient Protector for (Owner of (Triggering unit)) at SwapPoint[0] facing (180.00 + (Facing of (Triggering unit))) degrees
      • Unit - Move (Last created unit) instantly to SwapPoint[1]
      • Unit - Add a 15.00 second Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation(udg_SwapPoint[0])
      • Custom script: call RemoveLocation(udg_SwapPoint[1])

Are you registering Last Created Unit in the trigger where it is created via variable? Try setting a variable for Last Created Unit, i think the problem is just that the unit isn't registered and then last created unit doesn't occur.
 
Level 5
Joined
Feb 1, 2024
Messages
44
Are you registering Last Created Unit in the trigger where it is created via variable? Try setting a variable for Last Created Unit, i think the problem is just that the unit isn't registered and then last created unit doesn't occur.

I also registered it to a variable but nothing happens to the Ancient Protector building. I guess I must use Timer
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
I think it does get the Expiration Timer, it just doesn't display it because Buildings don't display Buffs. You need to go into Gameplay Constants and enable Buildings - Status Display.

Unrelated, why can't you just create the Tower at SwapPoint[1]? I don't understand the need for this:
  • Unit - Move (Last created unit) instantly to SwapPoint[1]
If moving the caster interrupts the spell (moving issues a Stop order), I suggest using SetUnitX/Y:
  • Set Variable Caster = (Triggering unit)
  • Custom script: call SetUnitX( udg_Caster, GetLocationX( udg_SwapPoint[0] )
  • Custom script: call SetUnitY( udg_Caster, GetLocationY( udg_SwapPoint[0] )
This will move the units without any interruptions while also ignoring collision.

But be aware of weird side effects, I noticed these functions acting funny in the more recent patches.
 
Last edited:
Status
Not open for further replies.
Top