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

Any way to save experience, but only from current level?

Status
Not open for further replies.
Level 8
Joined
Jul 17, 2004
Messages
283
From what I can see, you can only store ALL the experience a hero has inside a variable.

What I'm trying to do is...
Say I have a hero that is level 3, and the hero has 3/4 of its purple experience bar filled. Is there any way to only save THAT experience? Not the total amount that has been accumulated each level.
 
Level 15
Joined
Aug 7, 2013
Messages
1,338
From what I can see, you can only store ALL the experience a hero has inside a variable.

What I'm trying to do is...
Say I have a hero that is level 3, and the hero has 3/4 of its purple experience bar filled. Is there any way to only save THAT experience? Not the total amount that has been accumulated each level.

There might be a native that gives you the current exp of the hero until their next level, but I really don't know.

Otherwise what you could due (pretty brute force) is just keep track of all the experience the hero gains inside a variable, and reset this variable to 0 when a hero levels up. So you would need to monitor every time a hero gains exp and add it to this variable.
 
Here you go.

Press the esc key to check the next level experience in-game.
Store each value of exp into the right array index to how many levels you want.


  • Check level
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Hero - Set Paladin 0000 <gen> Hero-level to ((Hero level of Paladin 0000 <gen>) + 1), Hide level-up graphics


  • Store exp per lvl
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Experience[0] = 0
      • Set Experience[1] = 200
      • Set Experience[2] = 500
      • Set Experience[3] = 900
      • Set Experience[4] = 1400


  • Store Current lvl Exp
    • Events
    • Conditions
    • Actions
      • Set i = ((Hero experience of Paladin 0000 <gen>) - Experience[((Hero level of Paladin 0000 <gen>) - 1)])
 

Attachments

  • exp help.w3m
    16.3 KB · Views: 35
Level 13
Joined
Mar 24, 2013
Messages
1,105
Trigger all XP gain.

Or

Look at your gameplay constants to get the XP ratios and what not.
Then when a unit dies, check to see if a hero is in range and keep track in a variable the XP this hero got.

i.e. someUnit dies, someHero was there?, if yes then since we know someUnit gives 200 xp, set someHeroExpInt to someHeroExpInt +200.
 
Level 8
Joined
Jul 17, 2004
Messages
283
Here you go.

Press the esc key to check the next level experience in-game.
Store each value of exp into the right array index to how many levels you want.


  • Check level
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Hero - Set Paladin 0000 <gen> Hero-level to ((Hero level of Paladin 0000 <gen>) + 1), Hide level-up graphics


  • Store exp per lvl
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Experience[0] = 0
      • Set Experience[1] = 200
      • Set Experience[2] = 500
      • Set Experience[3] = 900
      • Set Experience[4] = 1400


  • Store Current lvl Exp
    • Events
    • Conditions
    • Actions
      • Set i = ((Hero experience of Paladin 0000 <gen>) - Experience[((Hero level of Paladin 0000 <gen>) - 1)])

Thank you!

And thanks everyone who helped. +Rep
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
  • Events
    • Map initialization
  • Conditions
  • Actions
    • Unit - Create 1 Paladin for Player 1 (Red) at (Center of (Playable map area)) facing 0.00 degrees
    • Set maxLevel = 1
    • Custom script: loop
    • Custom script: exitwhen (GetHeroLevel(GetLastCreatedUnit()) < udg_maxLevel)
    • Set expLimits[maxLevel] = (Hero experience of (Last created unit))
    • Set maxLevel = (maxLevel + 1)
    • Hero - Set (Last created unit) Hero-level to maxLevel, Hide level-up graphics
    • Custom script: endloop
    • Unit - Remove (Last created unit) from the game
    • Set maxLevel = (maxLevel - 1)
  • Events
    • Player - Player 1 (Rot) skips a cinematic sequence
  • Conditions
  • Actions
    • For each (Integer A) from 1 to maxLevel, do (Actions)
      • Loop - Actions
        • Game - Display to (All players) the text: ((String((Integer A))) + ( --> + (String(expLimits[(Integer A)]))))
 
Status
Not open for further replies.
Top