• 🏆 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] Need help with text message spell!

Status
Not open for further replies.
Level 4
Joined
Jun 22, 2009
Messages
63
Im making a robot game and i made an ability called Install Selfdestruct.
It's supposed to stop the timer when the targeted unit writes ://remove virus
but i can't find the right event!

  • Selfdestruct off
    • Events
      • Player - Player 1 (Red) types a chat message containing ://remove virus as An exact match
    • Conditions
    • Actions
      • Countdown Timer - Pause Selfdestruct
+rep!
 
Level 4
Joined
Jun 22, 2009
Messages
63
TARGETED Unit

It should work like this: Player 1 uses this ability on player 2(targeted player)
and when player 2(targeted player) writes the message the countdown stops
 
  • Eve
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Hashtable - Create a hashtable
    • Set Hashtable = Last created hashtable
  • Trigger
  • Events
    • Unit - A unit starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to X
  • Actions
    • If (All conditions are true) then do (Actions) else do (Actions)
      • If - Conditions
        • ((Key(timer)) is stored as an Integer of (Key(Owner of (Target unit of ability being cast))) in Hashtable) Equal to False
      • Then - Actions
        • Hashtable - Save 20 as (Key(timer)) of (Key(Owner of (Target unit of ability being cast))) in Hashtable
        • Player Group - Add (Owner of (Target unit of ability being cast)) to (Temp_Group)
        • Trigger - Turn on (Trigger 2 <gen>)
      • Else - Actions
  • Trigger2
  • Events
    • Time - Every 1.00 seconds of game-time
  • Conditions
  • Actions
    • If (All conditions are true) then do (Actions) else do (Actions)
      • If - Conditions
        • (Number of players in Temp_Group) Greater than 0
      • Then - Actions
        • Player Group - Pick every player in (Temp_Group) and do (Actions)
          • Loop - Actions
            • Set Timer = (Load (Key(timer)) of (Key(Picked player)) from Hashtable)
            • Hashtable - Save (Timer - 1) as (Key(timer)) of (Key(Picked player)) in Hashtable
        • Else - Actions
          • Trigger - Turn off (This trigger)
  • Tru
  • Events
    • Player - Player 1 (Red) types a chat message containing ://remove virus as An exact match
    • Player - Player 2 (Blue) types a chat message containing ://remove virus as An exact match
    • Player - Player 3 (Teal) types a chat message containing ://remove virus as An exact match
    • Player - Player 4 (Purple) types a chat message containing ://remove virus as An exact match
    • ...
    • Player - Player 12 (Brown) types a chat message containing ://remove virus as An exact match
  • Conditions
    • ((Triggering Player) is in (Temp_Group)) Equal to True
  • Actions
    • Player Group - Remove (Triggering Player) from (Temp_Group)
    • Hashtable - Clear all child hashtables of child (Key(Triggering Player)) in Hashtable
Temp_Group is a Player Group variable.
Timer is an Integer Variable

You unfortunately need hashtables to do that. If you don't want hashtables, use a preset value, like this:
  • Trigger1
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • For each (Integer A) from 1 to 12, do (Actions)
      • Loop - Actions
        • Set Timer[Player Number of Player(IntegerA)] = 20
and with the same way as above, add the (Owner of (Target unit of ability being cast)) to a Player Group and substract -1 every second.
That "20" value is the timer's maximum value.
 
Status
Not open for further replies.
Top