• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Adding 50% experience to a unit everytime

Status
Not open for further replies.
Level 27
Joined
Sep 24, 2006
Messages
4,979
How to add 50% experience to a unit everytime when a certain event occurs, i guess you will have to use somekind of calculation.

Because at first, the experience goes from 0-200 and then 100 is the half of that, but when you reach level 2 the maximum becomes a whole new number and the 200 is already filled and on top of that the experience has been doubled or something and the half of that will not be 100 anymore.

Get the problem?

I tried something, but it didn't work.

Im not good at math, help plz!
 
Level 5
Joined
Nov 7, 2007
Messages
134
You mean you want to add 50% of the maximum experience to a unit when a certain event is triggered? Well, I'm not sure if there's a way to calculate what the maximum experience is for each level, but if you got the time you can always test play your map, level your hero to the maximum level and write down what the maximum experience is for each level.
 
Level 17
Joined
Nov 18, 2008
Messages
1,538
You mean you want to add 50% of the maximum experience to a unit when a certain event is triggered? Well, I'm not sure if there's a way to calculate what the maximum experience is for each level, but if you got the time you can always test play your map, level your hero to the maximum level and write down what the maximum experience is for each level.

couldnt u just make 1 hero for each level? and just look at them.
 
Level 9
Joined
Apr 3, 2008
Messages
700

Note 1: All variables are integers.
Note 2: Use local varibles
Note 3: You can use arrays.

________________________________________________
set i = hero exp.
set a = hero level

set hero exp = 0
set hero level = a
set b = unit exp

set hero level = a+1
set c = hero exp

set hero exp = i + (c-b)/2
________________________________________________
 
Level 8
Joined
Dec 8, 2007
Messages
312
That's easy. You need 200 exp to level up and +100 for every next.
  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Hero - Add (50 + (50 x (Hero level of Mountain King 0216 <gen>))) experience to Mountain King 0216 <gen>, Show level-up graphics
 
Level 27
Joined
Sep 24, 2006
Messages
4,979
The required Xp for level is this:
( (L+2)*(L+1)/2-1 )*100
if you want to change anything about it, go to gameplay constants and change "Hero XP Required - ****** factor".

Hero - Add ((((Hero level of (Killing unit)) + 2) x ((Hero level of (Killing unit)) + 1)) / ((2 - 1) x 100)) experience to (Killing unit), Show level-up graphics

is that what you mean?

EDIT: Nothing happend =/

That's easy. You need 200 exp to level up and +100 for every next.
  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Hero - Add (50 + (50 x (Hero level of Mountain King 0216 <gen>))) experience to Mountain King 0216 <gen>, Show level-up graphics

I'll try that.

EDIT: Lol, dispite it being very simple it seems to work! i killed 6 units and with each unit i killed exactly 50% of the experience bar was filled! thanks! ^^
 
Level 9
Joined
Aug 1, 2008
Messages
453
Heres the trigger would be alot easier than the above solutions
  • Actions
    • Set Hero_that_needs_XP = (Triggering unit)
    • Set Hero_XP = (Hero experience of Hero_that_needs_XP)
    • Hero - Set Hero_that_needs_XP experience to (Hero_XP + (Hero_XP / 2)), Hide level-up graphics
What this does is it adds 50% of the heros current xp to the current xp so if your had a hero with 200 xp it would add 100 xp also replace the setting the variable with what ever your triggering event is. And this will work without changing the Game play constants and in any situation.

+rep if helped
 
Last edited:
Level 9
Joined
Apr 3, 2008
Messages
700
Man.
It will work, but you've missunderstood the question of the topic :D
Read the first postof the topic.
And if you'll do the system like you posted in your map, you don't need variables.
And, why your trigger leak?
 
Status
Not open for further replies.
Top