System GUI Custom Hero Experience System

Sneakster

Active Member
Reaction score
24
GUI Custom Hero Experience System
herosavesystempic.jpg
What is it?
This system can be used to add experience to a killing hero and all heroes around that hero based on the creep's level, health...whatever you want! This system will work GREAT for maps that have parties of heroes working together towards a common goal.

Prerequisites?
For this system you will need:
(Optional) Read this tutorial on Gameplay Constant Hero Experience and customize your exp to gain a new level. You will need this to determine how much exp you want to give to a hero for a certain level creep they kill. http://www.thehelper.net/forums/showthread.php?t=68382

Also, for any creeps or enemies you are using, set their exp values to 0.


Variables!
For this system, you will need: (Of course, you can change the names)
  • CreepXP - Integer
  • Killer - Point
  • XPGroup - Unit Group
  • NumberOfPlayers - Integer (Must be preset to the number of players playing in your map if you are directly following the form of this system.)


The system in code form:
Trigger:
  • Creep Exp
    • Events
      • Unit - A unit owned by Neutral Hostile Dies
      • Unit - A unit owned by Player 12 (Brown) Dies
      • Unit - A unit owned by Player 11 (Dark Green) Dies
    • Conditions
      • (Level of (Dying unit)) Less than or equal to 6
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of (Killing unit)) Less than or equal to 6
        • Then - Actions
          • Set CreepXP = 0
          • Set Killer = (Position of (Killing unit))
          • Set XPGroup = (Units within 800.00 of Killer matching (((((Matching unit) is A Hero) Equal to True) and ((Level of (Picked unit)) Less than or equal to 6)) and ((Matching unit) Not equal to (Killing unit))))
          • Set CreepXP = ((Integer((Real((Level of (Dying unit)))))) x 2)
          • Set CreepXP = (CreepXP + NumberOfPlayers)
          • Hero - Add CreepXP experience to (Killing unit), Hide level-up graphics
          • Player - Add CreepXP to (Owner of (Killing unit)) Current gold
          • Floating Text - Create floating text that reads ((|c00540081 + (+ + (String(CreepXP)))) + XP|r) above (Killing unit) with Z offset 0.00, using font size 8.50, color (75.00%, 0.00%, 75.00%), and 0.00% transparency
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
          • Set CreepXP = ((Integer((Real((Level of (Dying unit)))))) x 1)
          • Unit Group - Pick every unit in XPGroup and do (Actions)
            • Loop - Actions
              • Set CreepXP = ((Integer((Real((Level of (Dying unit)))))) x 1)
              • Set CreepXP = (CreepXP + NumberOfPlayers)
              • Hero - Add CreepXP experience to (Picked unit), Hide level-up graphics
              • Player - Add CreepXP to (Owner of (Picked unit)) Current gold
              • Floating Text - Create floating text that reads ((|c00540081 + (+ + (String(CreepXP)))) + XP|r) above (Picked unit) with Z offset 0.00, using font size 8.50, color (75.00%, 0.00%, 75.00%), and 0.00% transparency
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
          • Custom script: call DestroyGroup (udg_XPGroup)
          • Custom script: call RemoveLocation (udg_Killer)
        • Else - Actions


This code may look long and tedious (maybe not to experienced mappers), but experienced or not, I am going to break it down and explain it.

The Events
Trigger:
  • Events
    • Unit - A unit owned by Neutral Hostile Dies
    • Unit - A unit owned by Player 12 (Brown) Dies
    • Unit - A unit owned by Player 11 (Dark Green) Dies

These events start the trigger when a unit owned by enemy players die. Because this system is used in my own ORPG, the players Brown and Dark Green are enemies in addition to Neutral hostile.

You can add whatever player's units you want here. If you want heroes to only gain Exp from Player 2 (Blue)'s units, then add Player 2 (Blue) in the events.
Conditions
Trigger:
  • Conditions
    • (Level of (Dying unit)) Less than or equal to 6

You do not have to use conditions for this system at all! The only reason why I have the condition here is because I had different Experience Systems for different unit group levels.

In other words, if the dying unit from the enemy player is less than or equal to Level 6, it would run this Exp system. You can delete this condition or customize it for your map!

The Actions (Variables)
Trigger:
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Level of (Killing unit)) Less than or equal to 6
      • Then - Actions
        • Set CreepXP = 0
        • Set Killer = (Position of (Killing unit))
        • Set XPGroup = (Units within 800.00 of Killer matching (((((Matching unit) is A Hero) Equal to True) and ((Level of (Picked unit)) Less than or equal to 6)) and ((Matching unit) Not equal to (Killing unit))))
        • Set CreepXP = ((Integer((Real((Level of (Dying unit)))))) x 2)
        • Set CreepXP = (CreepXP + NumberOfPlayers)

The Condition - Killing unit less than or equal to 6 is there because my ORPG had Hero level restrictions for certain creeps. Instead of putting in an If/Then/Else action, simply just add all of the actions by themselves.

The CreepXP variable sets the amount of experience our heroes are going to receive. To start, we will leave it at 0, and add to it as the trigger collects data from the dying unit.

The Killer variable sets the position of the hero that killed the enemy's unit. This is only set to remove memory leaks later.

The XPGroup variable selects all units around the killing Hero that are Heroes and are also less than or equal to level 6, just like are killing Hero. Again, you can take the level conditions off for your map.
Because all of my Heroes had a sight radius of 800, I made that the area the system selected as people to also receive experience.

The last two variable settings set the CreepXP variable to the basis of what kind of things I want my hero to gain experience from. So, my version of this will give heroes exp based on the level of the dying unit and the number of players playing the game.

You can of course create your own additions to how the heroes will gain exp; such as the average level of all the heroes around the killing Hero or something of the sort.

Actions (For the killing Hero!)
Trigger:
  • Hero - Add CreepXP experience to (Killing unit), Hide level-up graphics
    • Player - Add CreepXP to (Owner of (Killing unit)) Current gold
    • Floating Text - Create floating text that reads ((|c00540081 + (+ + (String(CreepXP)))) + XP|r) above (Killing unit) with Z offset 0.00, using font size 8.50, color (75.00%, 0.00%, 75.00%), and 0.00% transparency
    • Floating Text - Change (Last created floating text): Disable permanence
    • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds


This part adds the experience (CreepXP) to whoever killed the hero. It then displays the amount of experience that Hero received and adds the amount of exp gained to his/her gold. For my ORPG, however much experience you had was also how much gold you had. Yet again, you can always remove this part for your map.

Actions (Assisting Heroes!)
Trigger:
  • Set CreepXP = ((Integer((Real((Level of (Dying unit)))))) x 1)
    • Unit Group - Pick every unit in XPGroup and do (Actions)
      • Loop - Actions
        • Set CreepXP = ((Integer((Real((Level of (Dying unit)))))) x 1)
        • Set CreepXP = (CreepXP + NumberOfPlayers)
        • Hero - Add CreepXP experience to (Picked unit), Hide level-up graphics
        • Player - Add CreepXP to (Owner of (Picked unit)) Current gold
        • Floating Text - Create floating text that reads ((|c00540081 + (+ + (String(CreepXP)))) + XP|r) above (Picked unit) with Z offset 0.00, using font size 8.50, color (75.00%, 0.00%, 75.00%), and 0.00% transparency
        • Floating Text - Change (Last created floating text): Disable permanence
        • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
    • Custom script: call DestroyGroup (udg_XPGroup)
    • Custom script: call RemoveLocation (udg_Killer)


This part simply takes exactly what was done to the killing hero, except it lessens the amount of exp everyone in the group XPGroup will receive. They will receive half the amount of exp that the killing hero received. It then displays the amount of exp they earned above their heads.

The final actions just clean up some leaks.

Conclusion
You can take whatever you want from this system, that's why it's here. Of course, all of the variables and everything in the system can be customized. I guess you can think of the version I have presented and explained to you as sort of a template for one you might try to implement into your map. Anyways, thank you for reading and good luck with your map!

Update from input (already)! Check out this post by simonake to clean up some more GUI: http://www.thehelper.net/forums/showpost.php?p=1034142&postcount=6

-Sneakster
 

simonake

New Member
Reaction score
72
Trigger:
  • Set CreepXP = ((Integer((Real((Level of (Dying unit)))))) x 1)


You should use<
Trigger:
  • Custom Script: set bj_wantDestroyGroup = TRUE


It saves time and place in the var manager. :)

Otherwise it seems useful!
 

Sneakster

Active Member
Reaction score
24
Thanks for the input! I'll make sure to post your comment in a link in the system in-case they want to use it. Thanks!
 

Sneakster

Active Member
Reaction score
24
You should add a test map, looks cool though

Yes indeed! I will be sure to add one within the next two days for those of you who like to copy and paste. (Much easier than re-writing GUI!)

I would add my ORPG but I think that would be considered advertising my map and this thread is not for that.
 

simonake

New Member
Reaction score
72
I did a typo!
What i wanted to say is this!

Trigger:
  • Set XPGroup = (Units within 800.00 of Killer matching (((((Matching unit) is A Hero) Equal to True) and ((Level of (Picked unit)) Less than or equal to 6)) and ((Matching unit) Not equal to (Killing unit))))


Could be remapled with

Trigger:
  • Actions
    • Custom Script: set bj_wantDestroyGroup = TRUE
    • Unit Group - Pick every (Units within 800.00 of Killer matching (((((Matching unit) is A Hero) Equal to True) and ((Level of (Picked unit)) Less than or equal to 6)) and ((Matching unit) Not equal to (Killing unit))))


the group won't leak :) It will save you place, time and energy :)

:D forgive me.. (I use to abuse of the smileys :) I know...)
 

BlackRose

Forum User
Reaction score
239
How exactly will that make it more better? ... and TRUE can be replaced with true. Does having too many variables really matter?
 

simonake

New Member
Reaction score
72
Sometimes, yeah alot.

If your game is made only of Gui, the Var manager will contain too much Vars.
 
Reaction score
341
This is one of the better GUI systems, and it comes with a mini-tutorial on how to use it.

For this, you deserve +rep :thup:
 

Sneakster

Active Member
Reaction score
24
This is one of the better GUI systems, and it comes with a mini-tutorial on how to use it.

For this, you deserve +rep :thup:

Thanks a ton! I'm proud that you consider my GUI system on of the better systems because this is my first system that I created entirely on my own. I hope more and more people will use this for their own maps. Oh, and a demo map is not too far away either! I've just been really busy lately...
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top