• 🏆 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!

[Trigger] Exp system.

Status
Not open for further replies.
Level 20
Joined
Jul 14, 2011
Messages
3,213
I'd like to know what you think about this experience system for an RPG map.


  • Experience
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Killing unit) is A Hero) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of (Triggering unit)) Greater than or equal to ((Level of (Killing unit)) + 3)
        • Then - Actions
          • Hero - Add ((Level of (Triggering unit)) x 0) experience to (Killing unit), Show level-up graphics
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of (Triggering unit)) Equal to ((Level of (Killing unit)) + 2)
            • Then - Actions
              • Hero - Add ((Level of (Triggering unit)) x 13) experience to (Killing unit), Show level-up graphics
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of (Triggering unit)) Equal to ((Level of (Killing unit)) + 1)
                • Then - Actions
                  • Hero - Add ((Level of (Triggering unit)) x 11) experience to (Killing unit), Show level-up graphics
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of (Triggering unit)) Equal to ((Level of (Killing unit)) - 0)
                    • Then - Actions
                      • Hero - Add ((Level of (Triggering unit)) x 9) experience to (Killing unit), Show level-up graphics
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Level of (Triggering unit)) Equal to ((Level of (Killing unit)) - 1)
                        • Then - Actions
                          • Hero - Add ((Level of (Triggering unit)) x 6) experience to (Killing unit), Show level-up graphics
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Level of (Triggering unit)) Equal to ((Level of (Killing unit)) - 2)
                            • Then - Actions
                              • Hero - Add ((Level of (Triggering unit)) x 3) experience to (Killing unit), Show level-up graphics
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Level of (Triggering unit)) Equal to ((Level of (Killing unit)) - 3)
                                • Then - Actions
                                  • Hero - Add ((Level of (Triggering unit)) x 0) experience to (Killing unit), Show level-up graphics
                                • Else - Actions

Its very clear what it does. Gives experience depending on the Level relation between Killing Unit and Dying Unit. Any unit Over or Under 3 lvls of the Killing Unit will give 0 exp. (lvl 4 unit wont get experience from either lvl1, or lvl 7 units, having a range of 5 (2, 3, 4, 5, 6) creeps to kill.

Its very easy to set the relation between them. Just requires some tests to adjust the Experience gained with hero xp requirement to level up.

If Hero requirement for level starts in lvl 1=500 exp, and exp requirement increases by 700 per lvl (Set in Gameplay Constats) the hero is pushed to advance in the game to harder areas, and would need to kill like 6 more units per level to level up.

In level 2 he would have to kill (Units killed in Level 1 +6)
In level 49 he would have to kill (Units killed in lvl 48 + 6), etc.

I think RPGS like world of warcraft and else works in a similar way. Exp requirement increases exponetially, and killing stronger creeps still requires killing a bit more than previous levels.

If the balance between creeps dificulty, items, gameplay features, and else, is good, this system would work really well... However, i'm just posting to gather opinions and sugestions :) (Only things I would add is: Spread experience among heroes in area around the dying unit, and give exp accordingly to each of those hero's level. I don't know how to do that, I would really appreciate some support in this)

EDIT: Found a way to give exp to each player around dying unit, not depending on killing unit. Requires a bit of math, but works well: Picks every Hero unit around any dying unit, and gives Exp based on The Level Relation each picked unit has with the dying unit, and divides that amount by the number of Heroes in region around the Dying unit.

EXAMPLE: If three players (lvl 6, 7, and 8) are around a lvl 7 dying unit:

Lvl 6) Will take 7 (Creep level) * 11 (Exp Multiplier in relation with hero lvl) / 3 (Number of units in area) = 25,6
Lvl 7) Will take 7 (Creep level) * 09 (Exp Multiplier in relation with hero lvl) / 3 (Number of units in area) = 21
Lvl 8) Will take 7 (Creep level) * 06 (Exp Multiplier in relation with hero lvl) / 3 (Number of units in area) = 14


  • Experience
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Region centered at (Position of (Triggering unit)) with size (600.00, 600.00))) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is A Hero) Equal to True
              • (Level of (Triggering unit)) Greater than or equal to ((Level of (Picked unit)) + 3)
            • Then - Actions
              • Hero - Add ((Level of (Triggering unit)) x (0 / (Number of units in (Units within 700.00 of (Center of (Region centered at (Position of (Triggering unit)) with size (700.00, 700.00))) matching (((Matching unit) is A Hero) Equal to True))))) experience to (Picked unit), Show level-up graphics
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is A Hero) Equal to True
                  • (Level of (Triggering unit)) Equal to ((Level of (Picked unit)) + 2)
                • Then - Actions
                  • Hero - Add ((Level of (Triggering unit)) x (13 / (Number of units in (Units within 700.00 of (Center of (Region centered at (Position of (Triggering unit)) with size (700.00, 700.00))) matching (((Matching unit) is A Hero) Equal to True))))) experience to (Picked unit), Show level-up graphics
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A Hero) Equal to True
                      • (Level of (Triggering unit)) Equal to ((Level of (Picked unit)) + 1)
                    • Then - Actions
                      • Hero - Add ((Level of (Triggering unit)) x (11 / (Number of units in (Units within 700.00 of (Center of (Region centered at (Position of (Triggering unit)) with size (700.00, 700.00))) matching (((Matching unit) is A Hero) Equal to True))))) experience to (Picked unit), Show level-up graphics
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ((Picked unit) is A Hero) Equal to True
                          • (Level of (Triggering unit)) Equal to ((Level of (Picked unit)) - 0)
                        • Then - Actions
                          • Hero - Add ((Level of (Triggering unit)) x (9 / (Number of units in (Units within 700.00 of (Center of (Region centered at (Position of (Triggering unit)) with size (700.00, 700.00))) matching (((Matching unit) is A Hero) Equal to True))))) experience to (Picked unit), Show level-up graphics
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • ((Picked unit) is A Hero) Equal to True
                              • (Level of (Triggering unit)) Equal to ((Level of (Picked unit)) - 1)
                            • Then - Actions
                              • Hero - Add ((Level of (Triggering unit)) x (6 / (Number of units in (Units within 700.00 of (Center of (Region centered at (Position of (Triggering unit)) with size (700.00, 700.00))) matching (((Matching unit) is A Hero) Equal to True))))) experience to (Picked unit), Show level-up graphics
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • ((Picked unit) is A Hero) Equal to True
                                  • (Level of (Triggering unit)) Equal to ((Level of (Picked unit)) - 2)
                                • Then - Actions
                                  • Hero - Add ((Level of (Triggering unit)) x (3 / (Number of units in (Units within 700.00 of (Center of (Region centered at (Position of (Triggering unit)) with size (700.00, 700.00))) matching (((Matching unit) is A Hero) Equal to True))))) experience to (Picked unit), Show level-up graphics
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • ((Picked unit) is A Hero) Equal to True
                                      • (Level of (Triggering unit)) Equal to ((Level of (Picked unit)) - 3)
                                    • Then - Actions
                                      • Hero - Add ((Level of (Triggering unit)) x (0 / (Number of units in (Units within 700.00 of (Center of (Region centered at (Position of (Triggering unit)) with size (700.00, 700.00))) matching (((Matching unit) is A Hero) Equal to True))))) experience to (Picked unit), Show level-up graphics
                                    • Else - Actions


I think that setting this trigger with variables to make it very easy to modify would be a great system.
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,240
Leaks regions, locations, unit groups: http://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/

Don't use a region, use units within range. Circle is better shape than square in this case.

Do the hero type comparison in the unit group filter.

Pick heroes
set count = hero count

Set int = trigger unit lvl - dying unit lvl
If abs(int) < 3 then
if int > 0 then
add trigger unit lvl * (9 + 2 * int) / count
else
add trigger unit lvl * (9 - 3 * int) / count
endif
endif
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
I've been trying to understand this for about two hours...

and I'm still not getting it.

This is the best I did is:

  • Experience System
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is in (Units owned by Neutral Hostile)) Equal to True
    • Actions
      • Set UnitsInRangeForExp = (Units within 700.00 of (Position of (Triggering unit)) matching (((Matching unit) is A Hero) Equal to True))
      • Set HeroLVL = (Level of (Picked unit))
      • Set CreepLVL = (Level of (Triggering unit))
      • Set HeroCreepLvlDif = (CreepLVL - HeroLVL)
      • Unit Group - Pick every unit in UnitsInRangeForExp and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Abs(HeroCreepLvlDif)) Greater than 3
            • Then - Actions
              • Hero - Add 0 experience to (Picked unit), Show level-up graphics
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • CreepLVL Equal to (HeroLVL + 3)
                • Then - Actions
                  • Hero - Add ((Level of (Triggering unit)) x (14 / (Number of units in UnitsInRangeForExp))) experience to (Picked unit), Show level-up graphics
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • CreepLVL Equal to (HeroLVL + 2)
                    • Then - Actions
                      • Hero - Add ((Level of (Triggering unit)) x (12 / (Number of units in UnitsInRangeForExp))) experience to (Picked unit), Show level-up graphics
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • CreepLVL Equal to (HeroLVL + 1)
                        • Then - Actions
                          • Hero - Add ((Level of (Triggering unit)) x (10 / (Number of units in UnitsInRangeForExp))) experience to (Picked unit), Show level-up graphics
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • CreepLVL Equal to (HeroLVL + 0)
                            • Then - Actions
                              • Hero - Add ((Level of (Triggering unit)) x (8 / (Number of units in UnitsInRangeForExp))) experience to (Picked unit), Show level-up graphics
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • CreepLVL Equal to (HeroLVL - 1)
                                • Then - Actions
                                  • Hero - Add ((Level of (Triggering unit)) x (6 / (Number of units in UnitsInRangeForExp))) experience to (Picked unit), Show level-up graphics
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • CreepLVL Equal to (HeroLVL - 2)
                                    • Then - Actions
                                      • Hero - Add ((Level of (Triggering unit)) x (4 / (Number of units in UnitsInRangeForExp))) experience to (Picked unit), Show level-up graphics
                                    • Else - Actions
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • CreepLVL Equal to (HeroLVL - 3)
                                        • Then - Actions
                                          • Hero - Add ((Level of (Triggering unit)) x (2 / (Number of units in UnitsInRangeForExp))) experience to (Picked unit), Show level-up graphics
                                        • Else - Actions
      • Custom script: set bj_wantDestroyGroup = true

Sorry. I'm sure there must be a way to make a Generic gradual scale for exp distibution between HeroLVL+/-3 or something... (I'm not good at Maths in English)
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Here. Didn't test it though.

  • Experience System
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is in (Units owned by Neutral Hostile)) Equal to True
    • Actions
      • Set HeroLVL = (Level of (Killing unit))
      • Set CreepLVL = (Level of (Triggering unit))
      • Set HeroCreepLvlDif = (HeroLVL - CreepLVL)
      • Set exp = (Hero experience of (Triggering unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Abs(HeroCreepLvlDif)) Less than 3
        • Then - Actions
          • Set point = (Position of (Triggering unit))
          • Set UnitsInRangeForExp = (Units within 700.00 of point matching (((Matching unit) is A Hero) Equal to True))
          • Set int = (Number of units in UnitsInRangeForExp)
          • Unit Group - Pick every unit in UnitsInRangeForExp and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • HeroCreepLvlDif Greater than 0
                • Then - Actions
                  • Hero - Add ((Level of (Triggering unit)) x ((9 + (2 x HeroCreepLvlDif)) / int)) experience to (Picked unit), Show level-up graphics
                • Else - Actions
                  • Hero - Add ((Level of (Triggering unit)) x ((9 - (3 x HeroCreepLvlDif)) / int)) experience to (Picked unit), Show level-up graphics
          • Custom script: call RemoveLocation(udg_point)
        • Else - Actions
      • Game - Display to Player Group - Player 1 (Red) the text: (Exp gain: + (String(((Hero experience of (Triggering unit)) - exp))))
Link

The exp variable is for testing purposes, so is the message display.

EDIT: Filter out dead and enemy/neutral heroes in the unit group pick and add
  • Custom script: call DestroyGroup(udg_UnitsInRangeForExp)
after the other custom script.
 
Last edited:
Level 20
Joined
Jul 14, 2011
Messages
3,213
- HeroLVL variable of triggering unit (The dying unit)? I have to place the hero there (I don't know how to include each player hero). All the others seems fine.


No action is applied, since it's not Greater than 0. If: HeroCreepLvlDif Shouldn't be 'Greater or Equal'?
10 x (9 + (2 x 0) / 1) =
10 x (9 + ( 0 ) / 1) =
10 x (9 + 0) / 1) =
10 x (9/1) =
10 x (9) =
90


ELSE Action is Applied
8 x (9 + (2 x -2) / 1) =
8 x (9 + ( -4 ) / 1) =
8 x (9-4) / 1) =
8 x (5/1) =
8 x (5) =
40


THEN Action is applied
10 x (9 + (2 x 2) / 1) =
10 x (9 + ( 4 ) / 1) =
10 x (9+4) / 1) =
10 x (13/1) =
10 x (13) =
130


Also...
  • Custom script: set bj_wantDestroyGroup = true
? right after the
  • Custom script: call RemoveLocation(udg_point)
Works like that, right? It still confuses me a lot. I don't know if it follows the same formulas i've made. I don't know why's there a 9 in the formule, I guess that it's because the "9" was the value of Experience rate if Hero and Creep lvl where the same in my first trigger, Ireduced it to 8 in the second one. Changing the 9 for the 8 wouldn't change anything else... right? and the formula would still work the same way. I've been seeing it for hours...

EDIT: Now i know that it follows the formula i've made first. Also, i found why the 9 is there xD (I'll change it to 8 later) and why there's a -3 in the "Else" formula (i'll change it to -2 later). What i'm not sure of is the "Greater than 0". I think it should be "Greater or Equal"
 
Last edited:
Level 20
Joined
Jul 14, 2011
Messages
3,213
Maker, the system is nearly done, but there are some issues...

Both Triggering Unit?
  • Set HeroLVL = (Level of (Triggering unit))
  • Set CreepLVL = (Level of (Triggering unit)
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
No... it's supposed to give exp to every unit in reange, depending on that unit lvl, not the killing unit level... =/
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Yeah, there was a small error in the trigger.

Its very clear what it does. Gives experience depending on the Level relation between Killing Unit and Dying Unit. Any unit Over or Under 3 lvls of the Killing Unit will give 0 exp.

No... it's supposed to give exp to every unit in reange, depending on that unit lvl, not the killing unit level... =/

Have you changed your mind on how it should work? Please explain the mechanics once again to avoid confusion.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Maybe i'm just confused. I've been about 8 hours in the PC trying to figure out this system and the spawn system... it's really frustrating... I have been about to cry several times, so far...

The system should work the same as the trigger in the first post, only some values changed. Experience amount should be based on the difference between Creep and Hero level. If Creep is Over or Under 4 levels of the Hero, no exp is given. Inside that range exp should be given accordingly between 2x and 14x, this way.

  • If the Hero is lvl 5:
  • Creep lvl 1 should give 0.
  • Creep lvl 2 should give 2x2
  • Creep lvl 3 should give 3x4
  • Creep lvl 4 should give 4x6
  • Creep lvl 5 should give 5x8 <- This may be the base value, since it's the same lvl than the hero, or, what's the same, the difference between hero lvl and creep lvl is equal to 0.
  • Creep lvl 6 should give 6x10
  • Creep lvl 7 should give 7x12
  • Creep lvl 8 should give 8x14
  • Creep lvl 9 should give 0.
That way, there's a Experience Range based on 3 lvls under, and 3 lvls over the. Anything outside that range gives 0 experience.

  • ---
  • Creep lvl = Hero level: Level of dying unit x 8 / Number of heroes in 800 AoE
  • Creep 1 lvl > Hero level: Level of dying unit x 10 / Number of heroes in 800 AoE
  • Creep 2 lvl > Hero level: Level of dying unit x 12 / Number of heroes in 800 AoE
  • Creep 3 lvl > Hero level: Level of dying unit x 14 / Number of heroes in 800 AoE
  • Creep 4 lvl > Hero level: 0 exp.
  • Hero lvl = Creep lvl: Level of dying unit x 8 / Number of heroes in 800 AoE
  • Hero 1 lvl > Creep level: Level of dying unit x 6 / Number of heroes in 800 AoE
  • Hero 2 lvl > Creep level: Level of dying unit x 4 / Number of heroes in 800 AoE
  • Hero 3 lvl > Creep level: Level of dying unit x 2 / Number of heroes in 800 AoE
  • Hero 4 lvl > Creep level: 0 exp.
When I see this, it seems that the system you (Maker) made should work properly, but experience values has little variations, and I can't understand why. Example:


- 4 Units in range.
- Lvl of units: 1
- Lvl of creep: 4

Lvl of Creep (4) x (8 + (2x(Creep lvl (4) MINUS Hero Lvl (1)) / 4)
4 x 8 + 2x(4-1) / 4
4 x 8 + 2x(3) / 4
4 x 8 + 6 / 4
4 x 14 / 4
4 x 3,5
= 14 <- Every unit should receive 14 experience. Somehow, they receive 12.

If i remove the (,5) value, making it only "4 x 3") then it's = 12.... I guess Warcraft removes these values?
12 = CORRECT VALUE


- 4 Units in range.
- Lvl of units: 1
- Lvl of creep: 3

Lvl of Creep (3) x (8 + (2x(Creep lvl (3) MINUS Hero Lvl (1)) / 4)
3 x 8 + 2x(3-1) / 4
3 x 8 + 2x(2) / 4
3 x 8 + 4 / 4
3 x 12 / 4
3 x 3
3 x 3
= 9...
CORRECT VALUE

At this point, I'm thinking about giving gold bounty the same way, based on Creep-Hero lvl difference and Number of Units in range.

Also... making these examples, I've found the system works exactly as I want to =/ It's even more frustrating to know that, lol. I feel so *Trolled by myself*.

This is the trigger I have so far, though I haven't tested killing lower lvl creeps. I don't know if it has leaks or something
EDIT: I tested with four Lvl5 heroes killing one Lvl4 creep. The creep gives 8 exp to each hero.


- 4 Units in range.
- Lvl of units: 5
- Lvl of creep: 4

Lvl of Creep (4) x (8 - (2x(Creep lvl (4) MINUS Hero Lvl (5)) / 4)
4 x 8 - 2x(4-5) / 4
4 x 8 - 2x(-1) / 4
4 x 8 - -2 / 4
4 x 8 + 2 / 4
4 x 10 / 4
4 x 2,5
4 x 2
= 8
CORRECT VALUE

  • Experience System
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is in (Units owned by Neutral Hostile)) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Abs(((Level of (Triggering unit)) - (Level of (Picked unit))))) Less than or equal to 4
        • Then - Actions
          • Set point = (Position of (Triggering unit))
          • Set UnitsInRangeForExp = (Units within 800.00 of point matching (((Matching unit) is A Hero) Equal to True))
          • Set int = (Number of units in UnitsInRangeForExp)
          • Unit Group - Pick every unit in UnitsInRangeForExp and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Level of (Triggering unit)) - (Level of (Picked unit))) Greater than or equal to 0
                • Then - Actions
                  • Hero - Add ((Level of (Triggering unit)) x ((8 + (2 x ((Level of (Triggering unit)) - (Level of (Picked unit))))) / int)) experience to (Picked unit), Show level-up graphics
                • Else - Actions
                  • Hero - Add ((Level of (Triggering unit)) x ((8 - (2 x ((Level of (Triggering unit)) - (Level of (Picked unit))))) / int)) experience to (Picked unit), Show level-up graphics
          • Custom script: call RemoveLocation(udg_point)
          • Custom script: call DestroyGroup(udg_UnitsInRangeForExp)
        • Else - Actions
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,240
  • Experience System
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is in (Units owned by Neutral Hostile)) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Abs(((Level of (Triggering unit)) - (Level of (Picked unit))))) Less than or equal to 4 // Level of picked unit = 0 since there's no picke unit at this point
        • Then - Actions
          • Set point = (Position of (Triggering unit))
          • Set UnitsInRangeForExp = (Units within 800.00 of point matching (((Matching unit) is A Hero) Equal to True)) // filter out dead heroes an non allied heroes
          • Set int = (Number of units in UnitsInRangeForExp)
          • Unit Group - Pick every unit in UnitsInRangeForExp and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Level of (Triggering unit)) - (Level of (Picked unit))) Greater than or equal to 0
                • Then - Actions
                  • Hero - Add ((Level of (Triggering unit)) x ((8 + (2 x ((Level of (Triggering unit)) - (Level of (Picked unit))))) / int)) experience to (Picked unit), Show level-up graphics
                • Else - Actions
                  • Hero - Add ((Level of (Triggering unit)) x ((8 - (2 x ((Level of (Triggering unit)) - (Level of (Picked unit))))) / int)) experience to (Picked unit), Show level-up graphics
          • Custom script: call RemoveLocation(udg_point)
          • Custom script: call DestroyGroup(udg_UnitsInRangeForExp)
        • Else - Actions
Also with integers 9/4 = 2, 11/4 = 2 for example. One could convert to reals and then the final number back to an integer.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
If that condition (Abs(level of Trig...) will always be "Level of triggerin unit - 0" then, why is it there? xD It just bugs me everything :p How can I solve that?

  • Set UnitsInRangeForExp = (Units within 800.00 of point matching ((((Matching unit) is A Hero) Equal to True) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an ally of (Owner of (Matching unit))) Equal to True))))
Is this right then?
 
Last edited by a moderator:
Level 37
Joined
Mar 6, 2006
Messages
9,240
If that condition (Abs(level of Trig...) will always be "Level of triggerin unit - 0" then, why is it there? xD It just bugs me everything :p How can I solve that?

It should never be that. You have it wrong ;) It should be abs(herolvl - creeplvl).

  • Set UnitsInRangeForExp = (Units within 800.00 of point matching ((((Matching unit) is A Hero) Equal to True)...
Is this right then?

belongs to an ally of killing unit
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
1)But: This is one of the questions i've had since I was born, and I've had so much trouble figuring it out...

Creep lvl = Triggering unit Level
Hero lvl = ¿? What ¿?... <- What unit should be placed here?

-------------------------------------------------

2) Should match = Is a Hero / Is Alive / Belongs to an Ally of Killing Unit? Any other Match to add?
 
Last edited:
Level 20
Joined
Jul 14, 2011
Messages
3,213
So... this is it?
  • Experience System
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is in (Units owned by Neutral Hostile)) Equal to True
    • Actions
      • Set HeroLVL = (Level of (Killing unit))
      • Set CreepLVL = (Level of (Triggering unit))
      • Set HeroCreepLvlDif = (CreepLVL - HeroLVL)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Abs(HeroCreepLvlDif)) Less than or equal to 4
        • Then - Actions
          • Set point = (Position of (Triggering unit))
          • Set UnitsInRangeForExp = (Units within 800.00 of point matching ((((Matching unit) is A Hero) Equal to True) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an ally of (Owner of (Killing unit))) Equal to True))))
          • Set int = (Number of units in UnitsInRangeForExp)
          • Unit Group - Pick every unit in UnitsInRangeForExp and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Level of (Triggering unit)) - (Level of (Picked unit))) Greater than or equal to 0
                • Then - Actions
                  • Hero - Add (CreepLVL x ((8 + (2 x (CreepLVL - (Level of (Picked unit))))) / int)) experience to (Picked unit), Show level-up graphics
                • Else - Actions
                  • Hero - Add (CreepLVL x ((8 - (2 x (CreepLVL - (Level of (Picked unit))))) / int)) experience to (Picked unit), Show level-up graphics
          • Custom script: call RemoveLocation(udg_point)
          • Custom script: call DestroyGroup(udg_UnitsInRangeForExp)
        • Else - Actions
Edit: Found a problem.

If 'Killing Unit' is Over or Under 4 lvls from 'Triggering Unit' the Trigger will not 'Trigger'... So, if there are 4 lvl20 heros, and 1lvl 5 hero, killing a lvl 20 creep, and the lvl5 gets the kill, the others will get no exp =/
 
Last edited by a moderator:
Level 37
Joined
Mar 6, 2006
Messages
9,240
So it should not work like you originally stated.

In that case, set HeroLvl = Lvl of picked unit, do it in the unit group loop. Also do the Abs(LvlDif) in the unit group loop for each unit. If the Abs(LvlDif) is true, do the >= 0 check.

If you have troubles getting it to work, post the trigger in a map file.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Did as you said... I don't fell like "having trouble" doing it, that's why I post it here and not in a Map File :p

  • Experience System
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is in (Units owned by Neutral Hostile)) Equal to True
      • (Unit-type of (Triggering unit)) Not equal to Floating Energy
    • Actions
      • Set point = (Position of (Triggering unit))
      • Set CreepLVL = (Level of (Triggering unit))
      • Set HeroCreepLvlDif = (CreepLVL - HeroLVL)
      • Set int = (Number of units in UnitsInRangeForExp)
      • Set UnitsInRangeForExp = (Units within 800.00 of point matching ((((Matching unit) is A Hero) Equal to True) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an ally of (Owner of (Killing unit))) Equal to True))))
      • Unit Group - Pick every unit in UnitsInRangeForExp and do (Actions)
        • Loop - Actions
          • Set HeroLVL = (Level of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Abs(HeroCreepLvlDif)) Less than or equal to 4
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Level of (Triggering unit)) - (Level of (Picked unit))) Greater than or equal to 0
                • Then - Actions
                  • Hero - Add (CreepLVL x ((8 + (2 x HeroCreepLvlDif)) / int)) experience to (Picked unit), Show level-up graphics
                • Else - Actions
                  • Hero - Add (CreepLVL x ((8 - (2 x HeroCreepLvlDif)) / int)) experience to (Picked unit), Show level-up graphics
            • Else - Actions
      • Custom script: call RemoveLocation(udg_point)
      • Custom script: call DestroyGroup(udg_UnitsInRangeForExp)
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
I wanted to display in a message the amount of exp given, but this doesn't work. Sometimes it displays, sometime it says: "Exp: ", and sometimes "Exp: 0"... and sometimes a number (I've only seen 8 and 6 xD) though the unit gets the experience. I want to display to see clearly if the amount of exp gained is correct.


  • Experience System
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) belongs to an enemy of (Owner of (Killing unit))) Equal to True
    • Actions
      • Set point = (Position of (Triggering unit))
      • Set CreepLVL = (Level of (Triggering unit))
      • Set UnitsInRangeForExp = (Units within 800.00 of point matching ((((Matching unit) is A Hero) Equal to True) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an ally of (Owner of (Killing unit))) Equal to True))))
      • Unit Group - Pick every unit in UnitsInRangeForExp and do (Actions)
        • Loop - Actions
          • Set HeroLVL = (Level of (Picked unit))
          • Set HeroCreepLvlDif = (CreepLVL - HeroLVL)
          • Set int = (Number of units in UnitsInRangeForExp)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Abs(HeroCreepLvlDif)) Less than or equal to 4
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Level of (Triggering unit)) - (Level of (Picked unit))) Greater than or equal to 0
                • Then - Actions
                  • Hero - Add (CreepLVL x ((8 + (2 x HeroCreepLvlDif)) / int)) experience to (Picked unit), Show level-up graphics
                  • Floating Text - Create floating text that reads (Exp: + (|cffff700 + ((String((CreepLVL x ((8 + (2 x HeroCreepLvlDif)) / int)))) + |r))) above (Picked unit) with Z offset 0.00, using font size 9.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                  • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                  • Floating Text - Change (Last created floating text): Disable permanence
                  • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
                  • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
                • Else - Actions
                  • Hero - Add (CreepLVL x ((8 - (2 x HeroCreepLvlDif)) / int)) experience to (Picked unit), Show level-up graphics
                  • Floating Text - Create floating text that reads (Exp: + (|cffff700 + ((String((CreepLVL x ((8 - (2 x HeroCreepLvlDif)) / int)))) + |r))) above (Picked unit) with Z offset 0.00, using font size 9.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                  • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                  • Floating Text - Change (Last created floating text): Disable permanence
                  • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
                  • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
            • Else - Actions
      • Custom script: call RemoveLocation(udg_point)
      • Custom script: call DestroyGroup(udg_UnitsInRangeForExp)
 
Status
Not open for further replies.
Top