• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Hero respawn system - using leaderboard issue

Status
Not open for further replies.
Level 4
Joined
May 23, 2010
Messages
83
I tryed making the respawn system that takes the nearest greveyard to be respawned (that works properly) and showup a leaderboard like a countdowntimer (it works too). The problem is when a 2 heroes are dead, when the first hero dies the leaderboard for the second hero owner is destroyed too. can someone help me? the triggers are there:

  • Hero Respawn
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Player Group - Pick every player in player_playingplayers and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering unit) Equal to (Load (Key hero) of (Key (Picked player)) in hero_hashtable)
            • Then - Actions
              • Set hero_respawndistance = (Distance between (Center of region_greveyards[1]) and (Position of (Triggering unit)))
              • For each (Integer generalintegers[1]) from 1 to region_totalgreveyards, do (Actions)
                • Loop - Actions
                  • Set hero_temprespawndistance = (Distance between (Center of region_greveyards[generalintegers[1]]) and (Position of (Triggering unit)))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • hero_temprespawndistance Less than or equal to hero_respawndistance
                    • Then - Actions
                      • Set hero_respawndistance = hero_temprespawndistance
                      • Hashtable - Save Handle Of(Center of region_greveyards[generalintegers[1]]) as (Key respawnloc) of (Key (Triggering unit)) in respawn_table
                    • Else - Actions
              • Set hero_revivaltemploc = (Load (Key respawnloc) of (Key (Triggering unit)) in respawn_table)
              • Leaderboard - Create a leaderboard for (Player group((Owner of (Triggering unit)))) titled Hero respawns in 30...
              • Unit - Kill (Load (Key backpack) of (Key (Picked player)) in hero_hashtable)
              • Camera - Pan camera for (Picked player) to hero_revivaltemploc over 3.00 seconds
              • Camera - Set (Picked player)'s camera Distance to target to 1800.00 over 0.00 seconds
              • Visibility - Create an initially Enabled visibility modifier for (Picked player) emitting Visibility from hero_revivaltemploc to a radius of 400.00
              • Special Effect - Create a special effect at hero_revivaltemploc using Abilities\Spells\Orc\Reincarnation\ReincarnationTarget.mdl
              • Unit Group - Add (Triggering unit) to hero_respawngroup
              • Set hero_respawnremaintime = 30.00
              • Hashtable - Save hero_respawnremaintime as (Key respawnremaintime) of (Key (Triggering unit)) in respawn_table
              • Hashtable - Save Handle Of(Last created leaderboard) as (Key respawnleaderboard) of (Key (Triggering unit)) in respawn_table
              • Hashtable - Save Handle Of(Last created special effect) as (Key respawneffect) of (Key (Triggering unit)) in respawn_table
              • Hashtable - Save Handle Of(Last created visibility modifier) as (Key modifier) of (Key (Triggering unit)) in respawn_table
              • Set hero_respawndistance = 0.00
              • Set hero_temprespawndistance = 0.00
              • Trigger - Turn on Hero Respawn Periodic <gen>
            • Else - Actions
  • Hero Respawn Periodic
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in hero_respawngroup and do (Actions)
        • Loop - Actions
          • Set hero_respawnremaintime = (Load (Key respawnremaintime) of (Key (Picked unit)) from respawn_table)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • hero_respawnremaintime Greater than 0.00
            • Then - Actions
              • Set hero_respawnremaintime = (hero_respawnremaintime - 1.00)
              • Hashtable - Save hero_respawnremaintime as (Key respawnremaintime) of (Key (Picked unit)) in respawn_table
              • Leaderboard - Change the title of (Load (Key respawnleaderboard) of (Key (Picked unit)) in hero_hashtable) to (Hero respawns in + ((String((Integer(hero_respawnremaintime)))) + seconds.))
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • hero_respawnremaintime Equal to 0.00
                • Then - Actions
                  • Leaderboard - Destroy (Load (Key respawnleaderboard) of (Key (Picked unit)) in hero_hashtable)
                • Else - Actions
              • Hero - Instantly revive (Picked unit) at (Load (Key respawnloc) of (Key (Picked unit)) in respawn_table), Show revival graphics
              • Hero - Instantly revive (Load (Key backpack) of (Key (Owner of (Picked unit))) in hero_hashtable) at (Load (Key respawnloc) of (Key (Picked unit)) in respawn_table), Show revival graphics
              • Camera - Lock camera target for (Owner of (Picked unit)) to (Picked unit), offset by (0.00, 0.00) using The unit's rotation
              • Camera - Set (Owner of (Picked unit))'s camera Distance to target to 1800.00 over 0.00 seconds
              • Special Effect - Destroy (Load (Key respawneffect) of (Key (Picked unit)) in respawn_table)
              • Visibility - Destroy (Load (Key modifier) of (Key (Picked unit)) in respawn_table)
              • Selection - Select (Picked unit) for (Owner of (Picked unit))
              • Unit Group - Remove (Picked unit) from hero_respawngroup
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in respawn_table
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in hero_respawngroup) Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
that's all folks! just a little help won't kill anyone :)
 
Notice something:
  • Hashtable - Save Handle Of(Last created leaderboard) as (Key respawnleaderboard) of (Key (Triggering unit)) in respawn_table
  • Leaderboard - Destroy (Load (Key respawnleaderboard) of (Key (Picked unit)) in hero_hashtable)
The saving part happens into the respawn_table hash, when the loading occurs from the hero_hashtable. This will lead to the destruction of the main leaderboard.
 
Status
Not open for further replies.
Top