• 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] Level balance trigger functions wrong

Status
Not open for further replies.
Level 22
Joined
Feb 3, 2009
Messages
3,292
Hello, I tried making a trigger where when ever any hero gets a level, all heroes by that player would become equal to the level of the highest hero level that player controls.
For some reason however it just sets one hero to level 1 and the others are fine.

  • Gain Level
    • Events
      • Unit - A unit Gains a level
    • Conditions
    • Actions
      • Set TempGroup = (Units owned by (Owner of (Triggering unit)) matching ((((Matching unit) is A Hero) Equal to True) and (((Matching unit) is alive) Equal to True)))
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of (Picked unit)) Greater than or equal to TempInt
            • Then - Actions
              • Set TempInt = (Level of (Picked unit))
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TempInt Not equal to 0
        • Then - Actions
          • Unit Group - Pick every unit in TempGroup and do (Actions)
            • Loop - Actions
              • Hero - Set (Picked unit) Hero-level to TempInt, Show level-up graphics
        • Else - Actions
      • Game - Display to (All players) for 30.00 seconds the text: (String(TempInt))
      • Set TempInt = 0
      • Custom script: call DestroyGroup(udg_TempGroup)
 
Level 3
Joined
Jan 1, 2012
Messages
50
i don't understand.
why a loop in a loop ?

if i've understand, a player has all his heroes at same lvl, so when a heros lvl-up he has the highest lvl.
so, you must to set for every others heroes the same lvl.
it's very simple.

1) set group = ....
2) set lvl_up = lvl of triggering unit
3) unit group loop :
set picked unit hero_lvl to lvl_up
4) destroy your group

you have done 1) and 4) nicely, you must make 2) and 3) now :)
 
Status
Not open for further replies.
Top