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

Help with trigger

Status
Not open for further replies.
Level 6
Joined
Jul 2, 2013
Messages
153
Ok I want to do this thing, event, every 120 seconds of game time, add X spell to X unit and make him cast it, but if every player types -block in 3.5 seconds, spell is not cast. The hard part is to detect when 1 player types -block to remove him from the players that can type -block. So if 1 player types -block 4 times it won't work. It will require 4 players. That's what I need. Any ideas? I prefer GUI.
 
Level 11
Joined
Jan 23, 2015
Messages
788
  • Block Count
    • Events
      • Player - Player 1 (Red) types a chat message containing -block as An exact match
      • Player - Player 2 (Blue) types a chat message containing -block as An exact match
      • Player - Player 3 (Teal) types a chat message containing -block as An exact match
      • Player - Player 4 (Purple) types a chat message containing -block as An exact match
    • Conditions
    • Actions
      • Set BlockIndex = (Player number of (Triggering player))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Blocked[BlockIndex] Equal to False
        • Then - Actions
          • Set Blocked[BlockIndex] = True
        • Else - Actions
  • Block Ability
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Blocked[1] Equal to True
          • Blocked[2] Equal to True
          • Blocked[3] Equal to True
          • Blocked[4] Equal to True
        • Then - Actions
          • Unit - Order CastingUnit to Stop
          • Unit - Remove Tranquility from CastingUnit
          • Set Blocked[1] = False
          • Set Blocked[2] = False
          • Set Blocked[3] = False
          • Set Blocked[4] = False
        • Else - Actions
You also need to make a variable for the unit you are going to give the ability to, so you will keep track of him and remove the ability once it's blocked.
 
Level 6
Joined
Jul 2, 2013
Messages
153
What type of variable is BlockIndex, and What if there are 9 players, can u change the trigger a little bit so it fits if there are 9 players and if 4 of them type -block, spell is blocked. Thanks
 
Level 11
Joined
Jan 23, 2015
Messages
788
BlockIndex is an integer variable, you will only need this trigger:

[hidden="Trigger 1]
  • Block Count
    • Events
      • Player - Player 1 (Red) types a chat message containing -block as An exact match
      • Player - Player 2 (Blue) types a chat message containing -block as An exact match
      • Player - Player 3 (Teal) types a chat message containing -block as An exact match
      • Player - Player 4 (Purple) types a chat message containing -block as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -block as An exact match
      • Player - Player 6 (Orange) types a chat message containing -block as An exact match
      • Player - Player 7 (Green) types a chat message containing -block as An exact match
      • Player - Player 8 (Pink) types a chat message containing -block as An exact match
      • Player - Player 9 (Gray) types a chat message containing -block as An exact match
    • Conditions
    • Actions
      • Set BlockIndex = (Player number of (Triggering player))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Blocked[BlockIndex] Equal to False
        • Then - Actions
          • Set Blocked[BlockIndex] = True
          • Set BlockCount = (BlockCount + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • BlockCount Equal to 4
            • Then - Actions
              • Unit - Order CastingUnit to Stop
              • Unit - Remove Tranquility from CastingUnit
              • Set Blocked[1] = False
              • Set Blocked[2] = False
              • Set Blocked[3] = False
              • Set Blocked[4] = False
              • Set Blocked[5] = False
              • Set Blocked[6] = False
              • Set Blocked[7] = False
              • Set Blocked[8] = False
              • Set Blocked[9] = False
              • Set BlockCount = 0
            • Else - Actions
        • Else - Actions
[/hidden]
 
Status
Not open for further replies.
Top