• 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.

[Solved] Custom xp system with triggers only, GUI

Status
Not open for further replies.
Level 13
Joined
Feb 5, 2018
Messages
567
  • XpSystem
    • Events
      • Unit - A unit owned by Neutral Hostile Dies
    • Conditions
      • (Owner of (Killing unit)) Not equal to Player 2 (Blue)
    • Actions
      • Set VariableSet AoE = 1000.00
      • Set VariableSet Point = (Position of (Triggering unit))
      • Set VariableSet Group = (Units within AoE of Point.)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Owner of (Picked unit)) slot status) Equal to Is playing
            • Then - Actions
              • Set VariableSet StatsPlayerNumber = (Player number of (Owner of (Picked unit)))
              • Set VariableSet HeroUnit[StatsPlayerNumber] = (Picked unit)
              • Set VariableSet CustomXp[StatsPlayerNumber] = (CustomXp[StatsPlayerNumber] + (10.00 x (Real((Level of (Triggering unit))))))
              • Game - Display to (All players) the text: ((String(CustomXp[StatsPlayerNumber])) + ( / + (String(CustomXpRequired[StatsPlayerNumber]))))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • CustomXp[StatsPlayerNumber] Greater than or equal to CustomXpRequired[StatsPlayerNumber]
                • Then - Actions
                  • Game - Display to (All players) the text: ((Name of (Owner of HeroUnit[StatsPlayerNumber])) + ( is now level + (String((Level of HeroUnit[StatsPlayerNumber])))))
                  • Unit - Set Unit: HeroUnit[StatsPlayerNumber]'s Integer Field: Level ('ulev') to Value: ((Level of HeroUnit[StatsPlayerNumber]) + 1)
                  • Set VariableSet CustomXp[StatsPlayerNumber] = (CustomXp[StatsPlayerNumber] - ((Real((Level of HeroUnit[StatsPlayerNumber]))) x 50.00))
                  • Set VariableSet CustomXpRequired[StatsPlayerNumber] = ((Real((Level of HeroUnit[StatsPlayerNumber]))) x 175.00)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of HeroUnit[StatsPlayerNumber]) Equal to |cff0000ffDefender|r (Hero)
                    • Then - Actions
                      • -------- Level up --------
                      • Set VariableSet Agility[StatsPlayerNumber] = (Agility[StatsPlayerNumber] + 1)
                      • Set VariableSet Focus[StatsPlayerNumber] = (Focus[StatsPlayerNumber] + 1)
                      • Set VariableSet Toughness[StatsPlayerNumber] = (Toughness[StatsPlayerNumber] + 2)
                      • -------- --------
                      • Set VariableSet Strength[StatsPlayerNumber] = (Strength[StatsPlayerNumber] + 1)
                      • Set VariableSet Intelligence[StatsPlayerNumber] = (Intelligence[StatsPlayerNumber] + 1)
                      • Set VariableSet Charisma[StatsPlayerNumber] = (Charisma[StatsPlayerNumber] + 1)
                      • Unit - Set Unit: HeroUnit[StatsPlayerNumber]'s Integer Field: Level ('ulev') to Value: Level[StatsPlayerNumber]
                      • -------- Adjust stats --------
                      • Unit - Set Max HP of HeroUnit[StatsPlayerNumber] to (10 + (Toughness[StatsPlayerNumber] x 7))
                      • Unit - Set Armor of HeroUnit[StatsPlayerNumber] to ((Real(Agility[StatsPlayerNumber])) + ((Real(Toughness[StatsPlayerNumber])) / 2.00))
                      • Unit - Set Max Mana of HeroUnit[StatsPlayerNumber] to (Intelligence[StatsPlayerNumber] x (4 + (Focus[StatsPlayerNumber] / 2)))
                      • -------- --------
                      • Unit - Set Base Damage of HeroUnit[StatsPlayerNumber] to (Strength[StatsPlayerNumber] + (Focus[StatsPlayerNumber] / 2)) for weapon index: 0
                      • Unit - Set Unit: HeroUnit[StatsPlayerNumber]'s Real Field: Mana Regeneration ('umpr') to Value: ((Real(Focus[StatsPlayerNumber])) / 10.00)
                      • Unit - Set Unit: HeroUnit[StatsPlayerNumber]'s Real Field: Hit Points Regeneration Rate ('uhpr') to Value: HpReg_Total[StatsPlayerNumber]
                    • Else - Actions
                • Else - Actions
              • Custom script: call RemoveLocation (udg_Point)
            • Else - Actions

I am making a full custom hero and xp system. There are actually no heroes at all the heroes are normal units with no Xpbar. I am trying to make a level up system.

The xprequired to level variable is set on hero select trigger and is initially set to 100.00.

Something is totally off with this trigger tho :D Im adding a screenshot so you can see what happens.

The general idea is unit reaches the xp needed CustomXp and it becomes greater than CustomXpRequired, then the unit gains level and the variables are set to their new values.

All other ideas are also welcome to improve the trigger.
WC3ScrnShot_120920_151504_001.png
 
Level 5
Joined
Oct 16, 2007
Messages
67
I haven't testet it, but is the first line of the AI? You could also display the Owner Name to make sure.
 
Level 13
Joined
Feb 5, 2018
Messages
567
Oh. How did I totally miss that. I'll change the condition a bit and see if it works.

EDIT: Got it working, thanks :)
 
Last edited:
Status
Not open for further replies.
Top