• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Respawn countdown and tower placing

Status
Not open for further replies.
Level 8
Joined
Jul 14, 2010
Messages
235
Hello. I got two triggers Im currently working with. A simple countdown timer window that pops up when a hero dies, and only for the owner of the dying hero. I got the heroes to respawn after 30sec, but the timer window messes up when a hero from another player dies, because the timer variable gets filled eached time a hero dies. But I just don't know where to start... :p
  • Revive Heroes
    • Events
      • Unit - A unit Dies
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • ((Dying unit) is A Hero) Equal to True
          • Or - Any (Conditions) are true
            • Conditions
              • (Owner of (Dying unit)) Equal to Player 1 (Red)
              • (Owner of (Dying unit)) Equal to Player 2 (Blue)
              • (Owner of (Dying unit)) Equal to Player 3 (Teal)
              • (Owner of (Dying unit)) Equal to Player 4 (Purple)
    • Actions
      • Countdown Timer - Start HeroRespawn as a One-shot timer that will expire in 30.00 seconds
      • Countdown Timer - Create a timer window for (Last started timer) with title Respawn in:
      • Countdown Timer - Show (Last created timer window) for (Owner of (Dying unit))
      • Wait 30.00 seconds
      • Countdown Timer - Destroy (Last created timer window)
      • Hero - Instantly revive (Dying unit) at (Center of Region 001 <gen>), Show revival graphics
Also, I would like for the TD part of my map, to make towers unbuildable near other towers, so you can't wall off. Is this possible somehow with triggers? Thanks!
 
Level 13
Joined
Mar 24, 2010
Messages
950
Set that window to a variable and create another trigger that when that timer ends it does the rest of the trigger below, you shouldnt use a 30 sec wait for something like this.
(make sure its an array 1-12 so its MPI)
 
Level 5
Joined
Jan 4, 2007
Messages
103
This?:

  • Revive Heroes
    • Events
      • Unit - A unit Dies
    • Conditions
      • And - All (Conditions) are true
    • Conditions
      • ((Dying unit) is A Hero) Equal to True
      • Or - Any (Conditions) are true
        • Conditions
          • (Owner of (Dying unit)) Equal to Player 1 (Red)
          • (Owner of (Dying unit)) Equal to Player 2 (Blue)
          • (Owner of (Dying unit)) Equal to Player 3 (Teal)
          • (Owner of (Dying unit)) Equal to Player 4 (Purple)
    • Actions
    • Countdown Timer - Start HeroRespawn[Player Number of (Owner of Dying Unit)] as a One-shot timer that will expire in 30.00 seconds
    • Countdown Timer - Create a timer window for (Last started timer) with title Respawn in:
    • Set TimerWindow[Player Number of (Owner of Dying Unit)] = Last Created timer window
    • Countdown Timer - Show (TimerWindow[Player Number of (Owner of Dying Unit)]) for (Owner of (Dying unit))
    • Wait 30.00 seconds
    • Countdown Timer - Destroy (TimerWindow[Player Number of (Owner of Dying Unit)])
    • Hero - Instantly revive (Dying unit) at (Center of Region 001 <gen>), Show revival graphics
Just create a TimerWindow variable and add an array to it. Also add an array on your timer variable.

Also, I would like for the TD part of my map, to make towers unbuildable near other towers, so you can't wall off. Is this possible somehow with triggers? Thanks!

In object editor, Pathing - AI Placement Radius? Tho think it won't do much. If it doesn't work, increase the collision size to how much you want and then in a trigger, when you create the building, turn it's collision off. Or just turn it's collision off when you create the building. Or make a trigger when you start creating a building, to check if there are any buildings nearby and move it instantly to a point where there are no buildings ect. Anyway, maybe more will help with this. Hope it helps:)
 
Level 8
Joined
Jul 14, 2010
Messages
235
Thanks. I made the array and Im pretty sure its working now. Only thing is to hide the window first for all players, and then show it to the Owner of the Dying Unit:
  • Revive Heroes Init
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is A Hero) Equal to True
      • Or - Any (Conditions) are true
        • Conditions
          • (Owner of (Dying unit)) Equal to Player 1 (Red)
          • (Owner of (Dying unit)) Equal to Player 2 (Blue)
          • (Owner of (Dying unit)) Equal to Player 3 (Teal)
          • (Owner of (Dying unit)) Equal to Player 4 (Purple)
    • Actions
      • Countdown Timer - Start HeroRespawn[(Player number of (Owner of (Dying unit)))] as a One-shot timer that will expire in 30.00 seconds
      • Countdown Timer - Create a timer window for (Last started timer) with title Respawn in:
      • Set RespawnTimerWindow[(Player number of (Owner of (Dying unit)))] = (Last created timer window)
      • Countdown Timer - Hide (Last created timer window) <-------------------------------------------------------------------------------------------------------------
      • Countdown Timer - Show RespawnTimerWindow[(Player number of (Owner of (Dying unit)))] for (Owner of (Dying unit))
      • Wait 30.00 seconds
      • Countdown Timer - Destroy RespawnTimerWindow[(Player number of (Owner of (Dying unit)))]
      • Hero - Instantly revive (Dying unit) at (Center of Region 001 <gen>), Show revival graphics
As for the tower thing :p I had 200 Collision on the towers, but things could still be built beside them. So I have to do something in the triggers. Maybe changing the Pathing Texture instead, if its possible. AI Placement Radius didnt work either, its prolly something only the AI uses. Thanks for the help this far!
 
Level 5
Joined
Jan 4, 2007
Messages
103
Hm... you could try changing the terain type near the tower so no more could be built but don't know if it'll work because it will probably move your first building also. Here:

  • Events
    • Unit - A unit enters (Your Region 2)
  • Conditions
    • ((Entering unit) is A structure) Equal to True
  • Actions
    • Set BuildingPoint1 = (Position of (Entering unit))
    • Environment - Change terrain type at BuildingPoint1 to Dalaran - Black Marble using variation -1 in an area of size 3 and shape Square
    • Custom script: call RemoveLocation (udg_BuildingPoint1)
If that doesn't work, try to change the terain type only around the building and not on the point of the first building ect. or try this move trigger:


  • Events
    • Unit - A unit enters (Your Region 2)
  • Conditions
    • ((Entering unit) is A structure) Equal to True
  • Actions
    • Set BuildingPoint1 = (Position of (Entering unit))
    • Set BuildingGroup1 = (Units in (Region centered at BuildingPoint1 with size (300.00, 300.00)) matching (((Matching unit) is A structure) Equal to True))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Number of units in BuildingGroup1) Equal to 1
      • Then - Actions
        • Unit Group - Pick every unit in BuildingGroup1 and do (Actions)
          • Loop - Actions
            • Set BuildingPoint2 = (Position of (Picked unit))
            • Unit Group - Remove (Picked unit) from BuildingGroup1
        • Set BuildingPoint3 = (BuildingPoint2 offset by 200.00 towards (Angle from BuildingPoint2 to BuildingPoint1) degrees)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Your Region 1) contains BuildingPoint3) Not equal to True
          • Then - Actions
            • Unit - Move (Entering unit) instantly to BuildingPoint3
          • Else - Actions
            • Set BuildingPoint4 = (Random point in (Your Region 2))
            • Unit - Move (Entering unit) instantly to BuildingPoint4
            • Custom script: call RemoveLocation (udg_BuildingPoint4)
        • Custom script: call RemoveLocation (udg_BuildingPoint2)
        • Custom script: call RemoveLocation (udg_BuildingPoint3)
      • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Number of units in BuildingGroup1) Greater than or equal to 2
          • Then - Actions
            • Unit Group - Pick every unit in BuildingGroup1 and do (Actions)
              • Loop - Actions
                • Set BuildingNumber1 = (BuildingNumber1 + 1)
                • Set BuildingNumber2 = (BuildingNumber2 + 1)
                • Set BuildingPoint1A[BuildingNumber1] = (Position of (Picked unit))
                • Unit Group - Remove (Picked unit) from BuildingGroup1
            • For each (Integer A) from 1 to BuildingNumber1, do (Actions)
              • Loop - Actions
                • Set BuildingNumber2 = (BuildingNumber2 + 1)
                • Set DistanceP1[(Integer A)] = (Distance between BuildingPoint1 and BuildingPoint1A[(Integer A)])
                • For each (Integer B) from (BuildingNumber2 - (BuildingNumber1 - 2)) to BuildingNumber1, do (Actions)
                  • Loop - Actions
                    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • DistanceP1[(Integer A)] Less than (Distance between BuildingPoint1 and BuildingPoint1A[(Integer B)])
                      • Then - Actions
                        • Set BuildingPoint2 = (BuildingPoint1A[(Integer A)] offset by 200.00 towards (Angle from BuildingPoint1A[(Integer A)] to BuildingPoint1) degrees)
                        • Custom script: call RemoveLocation (udg_BuildingPoint1A[bj_forLoopBIndex])
                      • Else - Actions
                        • Set BuildingPoint2 = (BuildingPoint1A[(Integer A)] offset by 200.00 towards (Angle from BuildingPoint1A[(Integer B)] to BuildingPoint1) degrees)
                        • Custom script: call RemoveLocation (udg_BuildingPoint1A[bj_forLoopBIndex])
                • Custom script: call RemoveLocation (udg_BuildingPoint1A[bj_forLoopAIndex])
            • Wait 0.10 seconds
            • Set BuildingNumber1 = 0
            • Set BuildingNumber2 = 0
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • ((Your Region 1) contains BuildingPoint2) Not equal to True
              • Then - Actions
                • Unit - Move (Entering unit) instantly to BuildingPoint2
              • Else - Actions
                • Set BuildingPoint3 = (Random point in (Your Region 2))
                • Unit - Move (Entering unit) instantly to BuildingPoint3
                • Custom script: call RemoveLocation (udg_BuildingPoint3)
            • Custom script: call RemoveLocation (udg_BuildingPoint2)
          • Else - Actions
            • Do nothing
    • Wait 0.20 seconds
    • Custom script: call RemoveLocation (udg_BuildingPoint1)


Hope it helps:)
 
Last edited:
Level 5
Joined
Jan 4, 2007
Messages
103
wow, is it possible to copy triggers from hiveworkshop.com to my map? :p
Or do I have to make all of that?

Hm...if you said it sooner I would have posted the map where I made it:), could make it again if you didn't make it already, but haven't tested it so:)

Also made a mistake in the last post, change the: For each Integer B from (BuildingNumber2 - (BuildingNumber2 - 2)) to BuildingNumber1 to (BuildingNumber2 - (BuildingNumber1 - 2)) to BuildingNumber1. Will edit the last post, sec.
 
Status
Not open for further replies.
Top