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

[Trigger] Capture Point Trigger - Help Needed

Status
Not open for further replies.
Level 6
Joined
Aug 12, 2007
Messages
201
I'm trying to make a capture point for my map. It's a circle of power with a region over it, I want any Hero to be able to stand in it and have a timer or a graph or bar or some form of graphic display indicate it's capture status, and have it so if any other Heroes of a different type enter the region, it either starts capturing for them, or if someone is in the region already, it stops their capturing.

Here is what I have so far:

  • Capture Point
    • Events
      • Unit - A unit enters Capture Point 1 <gen>
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is A Hero) Equal to True
          • (Number of units in (Units in Capture Point 1 <gen> matching (((Triggering unit) belongs to an enemy of Player 1 (Red)) Equal to True))) Equal to 0
        • Then - Actions
          • Countdown Timer - Start Capture_Timer as a One-shot timer that will expire in 8.00 seconds
          • Wait 8.00 seconds
          • Unit - Change ownership of Capture Point 0345 <gen> to Player 1 (Red) and Change color
        • Else - Actions
          • Do nothing
But I don't know how to make it pause the timer if someone else walks into the region after it's started or how to make the Timer not stand-alone, like do I need different timer variables for each capture point and everything? Any help would be appreciated.

EDIT: I added a bit but it still doesn't work properly:

  • Capture Point
    • Events
      • Unit - A unit enters Capture Point 1 <gen>
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is A Hero) Equal to True
          • (Number of units in (Units in Capture Point 1 <gen> matching (((Triggering unit) belongs to an enemy of Player 1 (Red)) Equal to True))) Equal to 0
        • Then - Actions
          • Countdown Timer - Start Capture_Timer as a One-shot timer that will expire in 8.00 seconds
          • Wait 8.00 seconds
          • Unit - Change ownership of Capture Point 0345 <gen> to Player 1 (Red) and Change color
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Remaining time for Capture_Timer) Less than or equal to 7.59
              • (Owner of (Triggering unit)) Equal to (Random player from (All enemies of Player 1 (Red)))
            • Then - Actions
              • Countdown Timer - Pause Capture_Timer
            • Else - Actions
              • Do nothing
 
Last edited:
Level 13
Joined
Nov 22, 2006
Messages
1,260
Here's your problem:

  • (Owner of (Triggering unit)) Equal to (Random player from (All enemies of Player 1 (Red)))
This doesn't work how you think it works. It just picks a random player that is an enemy of Player 1, for example if it picks Player 5, the entering unit belonging to any player other than 5 (Player 3, Player 6...) won't be able to pause the timer.

What you need to do is check if the owner of triggering unit is an enemy of player 1 (boolean comparison).
 
  • Countdown Timer - Start Capture_Timer as a One-shot timer that will expire in 8.00 seconds
    • Wait 8.00 seconds
    • Unit - Change ownership of Capture Point 0345 <gen> to Player 1 (Red) and Change color
Why do you use a Timer, when you already have a wait? It's pointless. Timer is used to avoid waits. Also, why do you pause a timer, when you don't have it start before the If/ Then/ Else? You started within the "Then" and in the "Else", you pause it? The proper timer-action should look like this:
  • Capture Point
  • Events
    • Unit - A unit enters Capture Point 1 <gen>
  • Conditions
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • ((Triggering unit) is A Hero) Equal to True
        • (Number of units in (Units in Capture Point 1 <gen> matching (((Triggering unit) belongs to an enemy of Player 1 (Red)) Equal to True))) Equal to 0
      • Then - Actions
        • Countdown Timer - Start Capture_Timer as a One-shot timer that will expire in 8.00 seconds
      • Else - Actions
  • Trigger2
  • Events
    • Time - Capture_Timer expires
  • Conditions
  • Actions
    • Unit - Change ownership of Capture Point 0345 <gen> to Player 1 (Red) and Change color
 
Status
Not open for further replies.
Top