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

Will This Work ?

Status
Not open for further replies.
Level 11
Joined
Nov 13, 2010
Messages
211
trying to make a trigger so a text show when you kill the other teams hero

  • Untitled Trigger 001
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Killing unit)) controller) Equal to (==) User
          • ((Killing unit) is A Hero) Equal to (==) True
          • ((Owner of (Killing unit)) slot status) Equal to (==) Is playing
          • ((Owner of (Dying unit)) controller) Equal to (==) User
          • ((Dying unit) is A Hero) Equal to (==) True
          • ((Owner of (Dying unit)) slot status) Equal to (==) Is playing
        • Then - Actions
          • Game - Display to (All players) the text: ((Name of (Owner of (Killing unit))) + ( Has Slain + (Name of (Owner of (Dying unit)))))
        • Else - Actions
 
Level 30
Joined
Nov 29, 2012
Messages
6,637
It would work but I would suggest setting those Killing Unit and Dying Unit into variables before this trigger either in a Map Init trigger or the trgger before that because they were used twice and above, it's for efficiency I guess. Anything used twice should be stored in variable as said by DIMF if I understand it correctly.

That should work overall.
 
Level 11
Joined
Nov 13, 2010
Messages
211
i have this
  • when heros dies
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Dying unit)) is an ally of Player 11 (Dark Green)) Equal to (==) True
          • ((Owner of (Dying unit)) controller) Equal to (==) User
          • ((Dying unit) is A Hero) Equal to (==) True
          • ((Owner of (Dying unit)) slot status) Equal to (==) Is playing
        • Then - Actions
          • Game - Display to (All players) the text: ((Name of (Owner of (Dying unit))) + has benn slain and will respawn in 20 seconds!)
          • Wait 20.00 game-time seconds
          • Hero - Instantly revive (Dying unit) at (Center of hero right <gen>), Hide revival graphics
          • Camera - Pan camera for (Owner of (Dying unit)) to (Center of hero right <gen>) over 2.00 seconds
        • Else - Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Dying unit)) is an ally of Player 12 (Brown)) Equal to (==) True
          • ((Owner of (Dying unit)) controller) Equal to (==) User
          • ((Dying unit) is A Hero) Equal to (==) True
          • ((Owner of (Dying unit)) slot status) Equal to (==) Is playing
        • Then - Actions
          • Game - Display to (All players) the text: ((Name of (Owner of (Dying unit))) + has benn slain and will respawn in 20 seconds!)
          • Wait 20.00 game-time seconds
          • Hero - Instantly revive (Dying unit) at (Center of hero left <gen>), Hide revival graphics
          • Camera - Pan camera for (Owner of (Dying unit)) to (Center of hero left <gen>) over 2.00 seconds
        • Else - Actions
so i was thinking of just set in there and i think it will work fine

so it becomes
  • when heros dies
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Dying unit)) is an ally of Player 11 (Dark Green)) Equal to (==) True
          • ((Owner of (Dying unit)) controller) Equal to (==) User
          • ((Dying unit) is A Hero) Equal to (==) True
          • ((Owner of (Dying unit)) slot status) Equal to (==) Is playing
        • Then - Actions
          • Game - Display to (All players) the text: ((Name of (Owner of (Dying unit))) + has benn slain and will respawn in 20 seconds!)
          • Wait 20.00 game-time seconds
          • Hero - Instantly revive (Dying unit) at (Center of hero right <gen>), Hide revival graphics
          • Camera - Pan camera for (Owner of (Dying unit)) to (Center of hero right <gen>) over 2.00 seconds
        • Else - Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Dying unit)) is an ally of Player 12 (Brown)) Equal to (==) True
          • ((Owner of (Dying unit)) controller) Equal to (==) User
          • ((Dying unit) is A Hero) Equal to (==) True
          • ((Owner of (Dying unit)) slot status) Equal to (==) Is playing
        • Then - Actions
          • Game - Display to (All players) the text: ((Name of (Owner of (Dying unit))) + has benn slain and will respawn in 20 seconds!)
          • Wait 20.00 game-time seconds
          • Hero - Instantly revive (Dying unit) at (Center of hero left <gen>), Hide revival graphics
          • Camera - Pan camera for (Owner of (Dying unit)) to (Center of hero left <gen>) over 2.00 seconds
        • Else - Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Killing unit)) controller) Equal to (==) User
          • ((Killing unit) is A Hero) Equal to (==) True
          • ((Owner of (Killing unit)) slot status) Equal to (==) Is playing
          • ((Owner of (Dying unit)) controller) Equal to (==) User
          • ((Dying unit) is A Hero) Equal to (==) True
          • ((Owner of (Dying unit)) slot status) Equal to (==) Is playing
        • Then - Actions
          • Game - Display to (All players) the text: ((Name of (Owner of (Killing unit))) + ( Has Slain + (Name of (Owner of (Dying unit)))))
        • Else - Actions
 
Level 17
Joined
Mar 21, 2011
Messages
1,597
well it would work, but its very unefficient. as hell_master said, store the killing and triggering unit into a variable at the beginning of the trigger.
you also dont need to do it 3 times and in your trigger, the death message would appear 2 times

  • Trigger
    • Events
      • Unit - A unit dies
    • Conditions
    • Actions
      • Set DyingUnit = (Triggering unit)
      • Set DyingUnitPlayer = (Owner of DyingUnit)
      • Set KillingUnit = (Killing unit)
      • Set KillingUnitPlayer = (Owner of KillingUnit)
      • Game - Display to (All players) the text: ((Name of KillingUnitPlayer) + (has killed + (Name of DyingUnitPlayer)))
      • Wait 20.00 game-time seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Conditions
          • (DyingUnit belongs to an ally of Spieler 11 (Darkgreen)) equal to True
        • 'THEN'-Actions
          • Set Integer = 0
        • 'ELSE'-Actions
          • Set Integer = 1
      • Hero - Instantly revive DyingUnit at Loc[Integer], show revival graphics
      • Camera - Pan camera for DyingUnitPlayer to Loc[Integer] over 0.00 seconds
just initialize the Loc[0] and Loc[1] in an initialization trigger

i didnt put in all the conditions, i think you can do it yourself, just put everything in an IF-THEN-ELSE and check through your conditions.
you also use waits, that means if you wanna play it multiplayer, it wont work correct.
 
Level 5
Joined
Oct 2, 2013
Messages
95
You should use timer arrays for the respawns, setting them to 20 whenever a unit dies. Then, make a trigger that revives the dead hero once the timer`s remaining time is == zero.

If you want those ˜kill˜ texts to look better, you can set all player colors in a string array with their colored hex code, and place those before the player names in the string. When the text shows up, the player`s name will appear with its respective color.
 
Level 11
Joined
Nov 13, 2010
Messages
211
You should use timer arrays for the respawns, setting them to 20 whenever a unit dies. Then, make a trigger that revives the dead hero once the timer`s remaining time is == zero.

If you want those ˜kill˜ texts to look better, you can set all player colors in a string array with their colored hex code, and place those before the player names in the string. When the text shows up, the player`s name will appear with its respective color.


that colored player names sound oka can you show me with a trigger
 
Status
Not open for further replies.
Top