- Joined
- Apr 19, 2011
- Messages
- 1,331
Today, i'll learn you how to create your own Custom XP System and make it work properly. Note that I won't push the coding/triggering part so much as it's simple triggering.
You said Custom XP System ? What the f*** is that ?
A Custom XP System, or Custom Experience System (but, Experience is long to write...), is a system, different of Warcraft 3's basic XP system, that manages the XP gain of heroes.
Why would i need a Custom XP System if i already have Warcraft's XP System ?
Having a Custom XP System has some advantages :
But what does it do exactly ?
A XP System, as i said previously, manages the XP gains of Heroes. It generally gives XP to all Heroes, which are enemies of the dying unit/hero ofc, within a certain area.
Usually (and mostly), the XP gained by Heroes depends of how many hereoes there are near the dying unit/hero, the level of the dying unit/hero and also if it's an unit or an hero which died.
Of course, it can be a bit more elaborated, to gain less XP if the unit is "denied" as in DotA or such things.
Now, we will see how to create one and how to make it work in a map, that means "disabling" the Warcraft's basic XP System so that it doesn't interferes with the new one and also creating the system itself.
I - Preparation :
In this Part, we will touch to the constants, yes i know, you will have to lose 1 hour searching specific lines in the constant and you'll be very happy.
As we can't remove the Warcraft's basic XP System, we should find a way to "disable" or "neutralize" it. Don't worry it's kinda easy. Just open the Constants (for beginners : in the Tool Bar, Advanced and then Constants)
Search for the lines called "Exp Hero Gained". The simpliest way is that you set them all to 0.
Be sure that you don't change the lines "Exp Hero Required" too.
After that, it should be ok. If you really want it, you can set some other lines to 0 such as "Range Gain Hero Experience Maximum" (i know, my traductions are really precise), but it shouldn't be needed.
Note that disabling Experience Gain for Heroes using trigger won't work as it will also disable Experience Gain that you'll give to the Heroes with triggers (so the Custom XP System won't work).
II - Creation :
Now, let's tell you how to create the Custom XP System.
Someday, Blizzard created that action :
The boolean is to show the level-up graphics. So, in most of case you will set it to True.
And that's what we will be using to make the hero gain XP.
The System itself is really simple, as it can be that :
In fact, it's really a piece of cake. Really, why would we need a tutorial for that ?
Yes, kinda but that's a really simplified version. Here the heroes will gain 50 experience every time a nearby enemy unit dies, even if it's an hero or some really big unit. And so you can't use that in your map.
But before continuing, i would recommend you to use two triggers instead of only one. One for the configuration and one for the system itself. So that it will be easy to modify it later.
As i said before, a good Custom XP System should at least give XP depending of Level of dying unit/hero, if it's either an Unit or a Hero and finally of how much Hero are gaining XP from this death.
So, it should look a bit more like this :
Of course, it depends of the complexity of the Custom XP System you want.
As example, here is the one i'm using in my AoS which also includes XP Reduction if the unit has been denied and gives also XP to another hero which is bound to the main hero :
It's me or things are suddenly a bit more complicated ?
I would say just a bit.
There are no real limits of a Custom XP System as you might add any parameters you want to configure the system. But of course, it should give something understandable at end so that players understand how they gain xp and how much they gain in each case.
If you want you can add parameters such as distance, for example if you're next to the killed unit you gain many experience and if you're far of it, you gain less, but it's up to you.
At end, the XP Gain will always be an Algorithm depending of variables. And your Algorithm should be thinked in function of the map, it's general gameplay and such. Same goes for the Variables used in this Algorithm.
So, i think that's all. And i'm too lazy to give a Test Map, so, for other lazy guys, you have to follow this tutorial in order to have a Custom XP System
You said Custom XP System ? What the f*** is that ?
A Custom XP System, or Custom Experience System (but, Experience is long to write...), is a system, different of Warcraft 3's basic XP system, that manages the XP gain of heroes.
Why would i need a Custom XP System if i already have Warcraft's XP System ?
Having a Custom XP System has some advantages :
- You need to make it yourself, so it's always a good way to practice and learn new things
- It offers easier and better configuration and managing of the XP gains. You won't need to touch to the Constants and such everytime you want to change a little thing.
- The Warcraft 3's basic XP system works kinda strange (that's only my opinion) and so you'll have a XP System that will do what you want.
But what does it do exactly ?
A XP System, as i said previously, manages the XP gains of Heroes. It generally gives XP to all Heroes, which are enemies of the dying unit/hero ofc, within a certain area.
Usually (and mostly), the XP gained by Heroes depends of how many hereoes there are near the dying unit/hero, the level of the dying unit/hero and also if it's an unit or an hero which died.
Of course, it can be a bit more elaborated, to gain less XP if the unit is "denied" as in DotA or such things.
Now, we will see how to create one and how to make it work in a map, that means "disabling" the Warcraft's basic XP System so that it doesn't interferes with the new one and also creating the system itself.
I - Preparation :
In this Part, we will touch to the constants, yes i know, you will have to lose 1 hour searching specific lines in the constant and you'll be very happy.
As we can't remove the Warcraft's basic XP System, we should find a way to "disable" or "neutralize" it. Don't worry it's kinda easy. Just open the Constants (for beginners : in the Tool Bar, Advanced and then Constants)
Search for the lines called "Exp Hero Gained". The simpliest way is that you set them all to 0.
Be sure that you don't change the lines "Exp Hero Required" too.
After that, it should be ok. If you really want it, you can set some other lines to 0 such as "Range Gain Hero Experience Maximum" (i know, my traductions are really precise), but it shouldn't be needed.
Note that disabling Experience Gain for Heroes using trigger won't work as it will also disable Experience Gain that you'll give to the Heroes with triggers (so the Custom XP System won't work).
II - Creation :
Now, let's tell you how to create the Custom XP System.
Someday, Blizzard created that action :
- Hero - Add <Integer> experience to <Unit>, Show level-up graphics
JASS:
call AddHeroXP( integer, unit, boolean )
And that's what we will be using to make the hero gain XP.
The System itself is really simple, as it can be that :
-
XP System
-
Events
- Unit - A unit Dies
- Conditions
-
Actions
- Set TempPoint = (Position of (Triggering unit))
- Set TempGroup = (Units within 1000.00 of TempPoint matching ((((Matching unit) is a Hero) Egal to TRUE) and (((Matching unit) belongs to an enemy of (Triggering player)) Egal to TRUE))
-
Unit Group - Pick every unit in TempGroup and do (Actions)
-
Loop - Actions
- Hero - Add 50 experience to (Picked unit), Show level-up graphics
-
Loop - Actions
- Custom script : call DestroyGroup(udg_TempGroup)
- Custom script : call RemoveLocation(udg_TempPoint)
-
Events
In fact, it's really a piece of cake. Really, why would we need a tutorial for that ?
Yes, kinda but that's a really simplified version. Here the heroes will gain 50 experience every time a nearby enemy unit dies, even if it's an hero or some really big unit. And so you can't use that in your map.
But before continuing, i would recommend you to use two triggers instead of only one. One for the configuration and one for the system itself. So that it will be easy to modify it later.
As i said before, a good Custom XP System should at least give XP depending of Level of dying unit/hero, if it's either an Unit or a Hero and finally of how much Hero are gaining XP from this death.
So, it should look a bit more like this :
-
XP System Init
-
Events
- Map initialization
- Conditions
-
Actions
- Set XPS_BaseXPU = 30
- Set XPS_BaseXPH = 200
- Set XPS_IncrXPU = 10
- Set XPS_IncrXPH = 50
-
For each (Integer A) from 1 to 25, do (Actions)
-
Boucle - Actions
- Set XPS_XPH[(Integer A)] = ((XPS_IncrXPH x (Integer A)) + XPS_BaseXPH)
- Set XPS_XPU[(Integer A)] = ((XPS_IncrXPU x (Integer A)) + XPS_BaseXPU)
-
Boucle - Actions
- Set XPS_XPArea = 1000.00
- Set XPS_XPGainPH[1] = 100
- Set XPS_XPGainPH[2] = 85
- Set XPS_XPGainPH[3] = 72
- Set XPS_XPGainPH[4] = 61
- Set XPS_XPGainPH[5] = 52
-
Events
-
XP System
-
Events
- Unit - A unit Dies
-
Conditions
- ((Triggering unit) is A Building ) Equal to FALSE
-
Actions
- Set TempPoint = (Position of (Triggering unit))
- Set TempGroup = (Units within XPS_XPArea of TempPoint matching (((((Matching unit) is A Hero) Equal to TRUE) and (((Matching unit) belongs to an enemy of (Triggering player)) Equal to TRUE)) and ((Owner of (Matching unit)) Different of Neutral Passive)))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ((Triggering unit) is A Hero) Equal to TRUE
-
Then - Actions
- Set TempInt = (XPS_XPH[(Hero level of (Triggering unit))] x (XPS_XPGainPH[(Number of units in TempGroup)] / 100))
-
Else - Actions
- Set TempInt = (XPS_XPU[(Level of (Triggering unit))] x (XPS_XPGainPH[(Number of units in TempGroup)] / 100))
-
If - Conditions
-
Unit Group - Pick every unit in TempGroup and do (Actions)
-
Loop - Actions
- Hero - Add TempInt experience to (Picked unit), Show level-up graphics
-
Loop - Actions
- Custom script: call DestroyGroup(udg_TempGroup)
- Custom script: call RemoveLocation(udg_TempPoint)
-
Events
Of course, it depends of the complexity of the Custom XP System you want.
As example, here is the one i'm using in my AoS which also includes XP Reduction if the unit has been denied and gives also XP to another hero which is bound to the main hero :
-
XP System Init
-
Events
- Map initialization
- Conditions
-
Actions
- Set XPS_BaseXPU = 30
- Set XPS_BaseXPH = 200
- Set XPS_IncrXPU = 10
- Set XPS_IncrXPH = 50
-
For each (Integer A) from 1 to 25, do (Actions)
-
Loop - Actions
- Set XPS_XPH[(Integer A)] = ((XPS_IncrXPH x (Integer A)) + XPS_BaseXPH)
- Set XPS_XPU[(Integer A)] = ((XPS_IncrXPU x (Integer A)) + XPS_BaseXPU)
-
Loop - Actions
- Set XPS_XPArea = 1000.00
- Set XPS_XPGainPH[1] = 100
- Set XPS_XPGainPH[2] = 85
- Set XPS_XPGainPH[3] = 72
- Set XPS_XPGainPH[4] = 61
- Set XPS_XPGainPH[5] = 52
- Set XPS_XPGainDenyPerc = 80
-
Events
-
XP System
-
Events
- Unit - A unit Dies
-
Conditions
- ((Triggering unit) is A Building) Equal to FALSE
-
Actions
- Set TempPoint = (Position of (Triggering unit))
- Set TempGroup = (Units within XPS_XPArea of TempPoint matching (((((Matching unit) is A Hero) Equal to True) and (((Matching unit) belongs to an enemy of (Triggering player)) Equal to TRUE)) and ((Owner of (Matching unit)) Different of Neutral Passive)))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ((Triggering unit) is A Hero) Equal to TRUE
-
Then - Action
- Set TempInt = (XPS_XPH[(Hero level of (Triggering unit))] x (XPS_XPGainPH[(Number of units in TempGroup)] / 100))
-
Else - Actions
- Set TempInt = (XPS_XPU[(Level of (Triggering unit))] x (XPS_XPGainPH[(Number of units in TempGroup)] / 100))
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ((Killing unit) belongs to an ally of (Triggering player)) Equal to TRUE
-
Then - Actions
- Set TempInt = ((TempInt x XPS_XPGainDenyPerc) / 100)
- Else - Actions
-
If - Conditions
-
Unit Group - Pick every unit in TempGroup and do (Actions)
-
Loop - Actions
- Hero - Add TempInt experience to (Picked unit), Show level-up graphics
- Hero - Add TempInt experience to Dummy_Hero[(Player number of (Owner of (Picked unit)))], Show level-up graphics
-
Loop - Actions
- Custom script: call DestroyGroup(udg_TempGroup)
- Custom script: call RemoveLocation(udg_TempPoint)
-
Events
It's me or things are suddenly a bit more complicated ?
I would say just a bit.
There are no real limits of a Custom XP System as you might add any parameters you want to configure the system. But of course, it should give something understandable at end so that players understand how they gain xp and how much they gain in each case.
If you want you can add parameters such as distance, for example if you're next to the killed unit you gain many experience and if you're far of it, you gain less, but it's up to you.
At end, the XP Gain will always be an Algorithm depending of variables. And your Algorithm should be thinked in function of the map, it's general gameplay and such. Same goes for the Variables used in this Algorithm.
So, i think that's all. And i'm too lazy to give a Test Map, so, for other lazy guys, you have to follow this tutorial in order to have a Custom XP System
Last edited: