• 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] Leaderboard help/revive/integers/players

Status
Not open for further replies.
Level 2
Joined
Jun 24, 2008
Messages
15
So I'm trying to make a leaderboard for my map, and it manages the lives of each player.
I tried a few things several times, but I can't manage to get them to work.

Here's the triggers:
  • Leaderboard
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Leaderboard - Create a leaderboard for (All players controlled by a User player) titled |cff0000FF Maze of ...
      • Set Leaderboard = (Last created leaderboard)
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Leaderboard - Add PlayerVar[(Integer A)] to Leaderboard with label (Name of PlayerVar[(Integer A)]) and value Lives[(Integer A)]
  • Lives
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Dying unit) Equal to DemonHunterVar
        • Then - Actions
          • For each (Integer A) from 1 to 10, do (Actions)
            • Loop - Actions
              • Set Lives[(Integer A)] = (IntegerVar - 1)
              • Set IntegerVar = Lives[(Integer A)]
              • Leaderboard - Change the value for PlayerVar[(Integer A)] in Leaderboard to (Lives[(Integer A)] - 1)
              • Game - Display to (All players) for 3.00 seconds the text: ((Name of PlayerVar[(Integer A)]) + ( has died and has + ((String(Lives[(Integer A)])) + lives left.)))
        • Else - Actions
  • Set PlayerVar[(Integer A)] = (Player((Integer A)))
It's for a maze, and my Demon Hunters are locusted units.
  • Unit - Create 1 Demon Hunter for PlayerVar[(Integer A)] at TempPointVar[1] facing RealVar[(Integer A)] degrees
  • Set HeroArrayVar[(Integer A)] = (Last created unit)
  • Set DemonHunterGroupVar = (Units owned by PlayerVar[(Integer A)])
That's for DemonHunterGroupVar.

Anyways, what the leaderboard is SUPPOSED to do, is show each player that IS in the game, as a user, not a computer or empty slot, and keep track of their lives. But I can't get it to update :sad:
So, when I die and revive, it doesn't change the lives in the leaderboard, even though I have the trigger to change the values when I die.

My revive trigger:
  • Revive
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Wait 1.00 seconds
          • Hero - Instantly revive (Dying unit) at RevivePointVar, Hide revival graphics
          • Selection - Select (Dying unit) for (Owner of (Dying unit))
I haven't mapped in a while, and this is my first attempt at making a leaderboard. So I come running to you all for help :) any ideas on what I need to do?
 
Level 15
Joined
Mar 31, 2009
Messages
1,397
I don't think this trigger is correct

  • Lives
  • Events
  • Unit - A unit Dies
  • Conditions
  • Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • (Dying unit) Equal to DemonHunterVar
  • Then - Actions
  • For each (Integer A) from 1 to 10, do (Actions)
  • Loop - Actions
  • Set Lives[(Integer A)] = (IntegerVar - 1)
  • Set IntegerVar = Lives[(Integer A)]
  • Leaderboard - Change the value for PlayerVar[(Integer A)] in Leaderboard to (Lives[(Integer A)] - 1)
  • Game - Display to (All players) for 3.00 seconds the text: ((Name of PlayerVar[(Integer A)]) + ( has died and has + ((String(Lives[(Integer A)])) + lives left.)))
  • Else - Actions
With this, if one person dies, then it makes the game think everyone is dead

Remove the Integer A and replace those things and might work.
 
Level 3
Joined
Jul 13, 2008
Messages
38
Ok lets knock these off as i see problems.
1.) set leader board time to 2 seconds. I dont think .01 will work.
2.) Diying units board:
  • Event
    • Unit - A Unit dies
  • Conditions
    • (Dying unit) Equal to DemonHunterVar
  • Action
    • Set Lives[(Player number of (Owner of (Triggering unit)))] = (Lives[(Player number of (Triggering player))] - 1)
    • Game - Display to (All players) for 3.00 seconds the text: ((Name of PlayerVar[(Player number of (Owner of (Triggering unit)))]) + ( has died and has + ((String(Lives[(Player number of (Owner of (Triggering unit)))])) + lives left.)))
    • Leaderboard - Change the value for PlayerVar[(Player number of (Owner of (Triggering unit)))] in Leaderboard to (Lives[(Player number of (Owner of (Triggering unit)))])
    • Leaderboard - Show (Leaderboard)
    • Hero - Instantly revive (Dying unit) at RevivePointVar, Hide revival graphics
    • Selection - Select (Dying unit) for (Owner of (Dying unit))
3.) As for your Reviving system it will nto work becouse you have a wait
function in it. Number one rule to map making is avoid wait functions as
much as possable ane NEVER add them to a Loop action. so just remove
that wait function and deal with the instant respawn lol. You can look for a
snipet that revievs heros for the set time you wish them to be dead for but it
would have to be in JASS so that it cna handle more then one dead hero at a
time.


I think that covers it all. If you need more help just message me and i can just script this all for ya i enjoy GUI xD
 
Status
Not open for further replies.
Top