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

Problem with triggering unit condition.

Status
Not open for further replies.
Level 6
Joined
Jan 29, 2010
Messages
213
Hi, all I have some problem with triggering unit codition, I need to count Players:
used conditions
Revive1 - unit-type
players - integer
Calculates how much players are users, and playing (brown = creeps).

INISTALIZATION

  • Inistaliztion
    • Events
      • Time - Elapsed game time is 0.10 seconds
    • Conditions
    • Actions
      • Set players = 0
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Picked player) Not equal to Player 12 (Brown)
              • ((Picked player) controller) Equal to User
              • ((Picked player) slot status) Equal to Is playing
            • Then - Actions
              • Set players = (players + (Player number of (Picked player)))
            • Else - Actions
Hero revive+defeat. Every player hero slain will be removed from players(integer), If players equal to 0 the game will end.
(Revive(unit-type) sets dead hero to revive on end wave)

HERO REVIVE

  • Hero revive
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Triggering unit)) Equal to Player 1 (Red)
            • Then - Actions
              • Set Revive1 = (Triggering unit)
              • Set players = (players - 1)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Triggering unit)) Equal to Player 2 (Blue)
            • Then - Actions
              • Set Revive2 = (Triggering unit)
              • Set players = (players - 1)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Triggering unit)) Equal to Player 3 (Teal)
            • Then - Actions
              • Set Revive3 = (Triggering unit)
              • Set players = (players - 1)
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • players Equal to 0
        • Then - Actions
          • Countdown Timer - Create a timer window for Timer1 with title Game ends in...
          • Countdown Timer - Show (Last created timer window)
          • Countdown Timer - Start Timer1 as a One-shot timer that will expire in 60.00 seconds
          • Wait 60.00 seconds
          • Countdown Timer - Destroy (Last created timer window)
          • Countdown Timer - Hide (Last created timer window)
          • Game - Defeat Player 1 (Red) with the message: Defeat!
          • Game - Defeat Player 2 (Blue) with the message: Defeat!
          • Game - Defeat Player 3 (Teal) with the message: Defeat!
        • Else - Actions
End wave (next level switcher), revives all dead heroes, heoes witch weren't killed, will equal to no unit, so it wouldn't add +1 to players.
END WAVE

  • End Wave
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
      • (Number of living Kobold units owned by Player 12 (Brown)) Equal to 0
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Revive1 Equal to (Triggering unit)
        • Then - Actions
          • Set players = (players + 1)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Revive2 Equal to (Triggering unit)
        • Then - Actions
          • Set players = (players + 1)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Revive3 Equal to (Triggering unit)
        • Then - Actions
          • Set players = (players + 1)
        • Else - Actions
When I test map alone, players=1, before the end wave starts, than players=4, when they have to equal to 1.

+rep to those who'll help
 
Level 15
Joined
Oct 16, 2010
Messages
941
  • Set players = (players + (Player number of (Picked player)))
Don't you mean:

  • Set player = (players + 1)
______________________________________________

  • Countdown Timer - Start Timer1 as a One-shot timer that will expire in 60.00 seconds
  • Wait 60.00 seconds
These two won't be exactly equivalent in terms of time. What you should do is create another trigger with an event that triggers when that specific timer ends, then run through the rest of the code.

______________________________________________

  • Revive1 Equal to (Triggering unit)
You're referring to a triggering unit that doesn't exist here.
______________________________________________

When I get home tonight I can make you a system to do exactly what you want (if no ones helped you by then).
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
You are missing the first condition here, is that on purpose?


HERO REVIVE

  • Hero revive
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Triggering unit)) Equal to Player 1 (Red)
            • Then - Actions
              • Set Revive1 = (Triggering unit)
              • Set players = (players - 1)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Triggering unit)) Equal to Player 2 (Blue)
            • Then - Actions
              • Set Revive2 = (Triggering unit)
              • Set players = (players - 1)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Triggering unit)) Equal to Player 3 (Teal)
            • Then - Actions
              • Set Revive3 = (Triggering unit)
              • Set players = (players - 1)
            • Else - Actions
You should also set the (Owner of (Triggering unit)) IF/THEN/ELSE inside each other, like this:


  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • Then - Actions
    • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • Then - Actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
            • Then - Actions
            • Else - Actions


The condition creates a unit group -> leak. Make this the first action:
  • Custom script: set bj_wantDestroyGroup = true
Add a IF/THEN/ELSE in the actions, the number of living kobolds as the condition there.
END WAVE

  • End Wave
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
      • (Number of living Kobold units owned by Player 12 (Brown)) Equal to 0
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Revive1 Equal to (Triggering unit)
        • Then - Actions
          • Set players = (players + 1)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Revive2 Equal to (Triggering unit)
        • Then - Actions
          • Set players = (players + 1)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Revive3 Equal to (Triggering unit)
        • Then - Actions
          • Set players = (players + 1)
        • Else - Actions
 
Level 6
Joined
Jan 29, 2010
Messages
213
  • Set players = (players + (Player number of (Picked player)))
Don't you mean:

  • Set player = (players + 1)
(Player nuber of(Picked players)) may be +(1-12) (if 3players in game than it will add +3 to players)

+1 only adds 1

____________________________

  • Countdown Timer - Start Timer1 as a One-shot timer that will expire in 60.00 seconds
  • Wait 60.00 seconds
These two won't be exactly equivalent in terms of time. What you should do is create another trigger with an event that triggers when that specific timer ends, then run through the rest of the code.

It doesn't matter if lvl start 1sec. earlier or later.

____________________________

Revive1 Equal to (Triggering unit)

You're referring to a triggering unit that doesn't exist here.

You'r saying that this one don't add triggering unit to Revive1? :(
Hero Revive

  • Hero revive
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
          • (Owner of (Triggering unit)) Equal to Player 1 (Red)
            • Then - Actions
          • Set Revive1 = (Triggering unit)
          • Set players = (players - 1)
            • Else - Actions
        • Else - Actions
____________________________

When I get home tonight I can make you a system to do exactly what you want (if no ones helped you by then).

I may attach you my map If you wan't, or don't have time to play with new triggers. (thenk's for you'r help :))
 
Level 15
Joined
Oct 16, 2010
Messages
941
You'r saying that this one don't add triggering unit to Revive1? :(

I was reffering to the last trigger (end-wave)

(if 3players in game than it will add +3 to players)

A player number is assigned to each player, player 1 has a player number of 1 and player 12 has a player number of 12. So if player 3, 4, and 6 are currently being used by human players, then the value of you'r players variable will be:

players = 3 + 4 + 6
players = 13
 
Level 6
Joined
Jan 29, 2010
Messages
213
A player number is assigned to each player, player 1 has a player number of 1 and player 12 has a player number of 12. So if player 3, 4, and 6 are currently being used by human players, then the value of you'r players variable will be:

players = 3 + 4 + 6
players = 13

So to get it working I have to do it like that?:
Inistalization
  • Inistaliztion
    • Events
      • Time - Elapsed game time is 0.10 seconds
    • Conditions
    • Actions
      • Set players = 0
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 1 (Red) controller) Equal to User
          • (Player 1 (Red) slot status) Equal to Is playing
        • Then - Action
          • Set players = (players + 1)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 2 (Blue) controller) Equal to User
          • (Player 2 (Blue) slot status) Equal to Is playing
        • Then - Actions
          • Set players = (players + 1)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 3 (Teal) controller) Equal to User
          • (Player 3 (Teal) slot status) Equal to Is playing
        • Then - Actions
          • Set players = (players + 1)
        • Else - Actions
 
Level 6
Joined
Jan 29, 2010
Messages
213
Raven0 thenks for helping the condition (players) are working very well now! I give you +rep for spend some time helping me. :)

Edited: It isn't working as well as I tought :(
 
Last edited:
Status
Not open for further replies.
Top