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

[Trigger] Generic EXP Trigger

Status
Not open for further replies.
Level 7
Joined
Dec 26, 2010
Messages
401
Took me a long time of toying with it trying to get it to convert a real to integer until I came across the current set up, I was wondering if this was an efficient way of creating a generic EXP trigger to be used in hero maps in which they want the exp to be triggered and displayed via floating text?

  • Exp
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Dying unit)) Equal to Neutral Hostile
    • Actions
      • Custom script: set bj_wantDestroyGroup=true
      • Unit Group - Pick every unit in (Units within 1000.00 of (Position of (Dying unit)) matching (((Owner of (Matching unit)) is an enemy of (Owner of (Dying unit))) Equal to True)) and do (Actions)
        • Loop - Actions
          • Set Expgain = (((Real((Level of (Dying unit)))) / (Real((Hero level of (Picked unit))))) x ((((Real((Level of (Dying unit)))) - 1.00) x 3.00) + (Random real number between 1.00 and 11.00)))
          • Hero - Add (Integer(Expgain)) experience to (Picked unit), Show level-up graphics
          • Floating Text - Create floating text that reads ((String(Expgain)) + |caf7f3ac9xp|r) above (Picked unit) with Z offset 0.00, using font size 10.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 3.00 seconds
          • Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
Right now the set up is basically this formula;
(Level of Unit/Hero Level)*(((Level of Unit - 1)*3)+(Random Number 1 to 11))
Or This is the other way I tried writing it out;
(((Level of Unit - 1)*3)+(Random Number 1 to 11))/(Level of Hero/Level of Unit)
Which both return the same value.
 
Last edited:
Well it's relatively efficient (though change dying unit to triggering unit and you may want to put that in a variable too) and put picked unit in another variable

Though while it works, it doesn't account for multiple allies being around and certainly activates "uneccessarily" would be more efficient to activate upon a unit killing another, when the killing unit is a hero, and then find other nearby heros and split the exp
 
Level 7
Joined
Dec 26, 2010
Messages
401
So trigger it based off more of a 'specific' unit event, when a hero kills an enemy, take the exp and divide it only amongst allied heroes instead of all units owned by the players excluding level differences which I can use to adjust the actual experience gain per individual hero?
 
Level 7
Joined
Dec 26, 2010
Messages
401
Here is what I've got if I understood you correctly Tank-Commander;

  • Exp
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
      • ((Killing unit) is A Hero) Equal to True
    • Actions
      • Custom script: set bj_wantDestroyGroup=true
      • Unit Group - Pick every unit in (Units within 1000.00 of (Position of (Triggering unit)) matching (((Owner of (Matching unit)) is an enemy of (Owner of (Triggering unit))) Equal to True)) and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to UnitGroup
          • Set Expgain = ((((Real((Level of (Triggering unit)))) / (Real((Hero level of (Picked unit))))) x ((((Real((Level of (Triggering unit)))) - 1.00) x 3.00) + (Random real number between 1.00 and 11.00))) / (Real((Number of units in UnitGroup))))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Hero level of (Picked unit)) Less than 150
            • Then - Actions
              • Hero - Add (Integer(Expgain)) experience to (Picked unit), Show level-up graphics
              • Floating Text - Create floating text that reads ((String(Expgain)) + |caf7f3ac9xp|r) above (Picked unit) with Z offset 0.00, using font size 10.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 3.00 seconds
              • Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
            • Else - Actions
              • Do nothing
      • Unit Group - Remove all units from UnitGroup
Not sure if that's leakless.


Edit: Changed it so that only units below max level will recieve experience, but it will still divide by the number of heroes in the area, so max level heroes will sap experience. (Note the 150 is just the level I set for testing purposes.)
 
Last edited:
Level 9
Joined
Jun 7, 2008
Messages
440
If you want to make it customizable, You may want to remove the condition:
  • Conditions
    • (Owner of( Triggering Unit)) equal to nuetral hostile
Otherwise, this will only fire when a nuetral hero kills a unit.

Secondly, as Tank-Commander said, units cannot gain experience. You might want to add a conditional check for hero's (though I guess it really doesn't matter). Doing this also allows you to check if the unit is max level, and remove them from the group so as not to sap any exp (if thats the intended purpose)

Thirdly, the "Do Nothing" is not needed under the Else function.

Lastly, if the group is destroyed, you do not have to clear all units from it.
 
Level 7
Joined
Dec 26, 2010
Messages
401
If you want to make it customizable, You may want to remove the condition:
  • Conditions
    • (Owner of( Triggering Unit)) equal to nuetral hostile
This will only fire when a nuetral hero kills a unit.

Secondly, as Tank-Commander said, units cannot gain experience. You might want to add a conditional check for hero's (though I guess it really doesn't matter). You can also check if the unit is max level, and remove them from the group so as not to sap any exp (if thats the intended purpose)

Thirdly, the "Do Nothing" is not needed under the Else function.

Lastly, if the group is destroyed, you do not have to clear all units from it.

Actually it's when a neutral hostile unit dies by a hero, then all player units are selected (which is an RPG case is usually only a hero unit anyhow, but I am still trying to get to where I can add a condition to pick only hero units)

The exp sap is intended, but can be easily changed so it's not included (as you said)


Edit:

Don't need the unit group variable, and I meant condition on the unit group picking rather than the trigger run

The only problem I'm having with pick units in range matching condition is that it won't allow me to use an and statement to do multiple conditions.
 
Level 9
Joined
Jun 7, 2008
Messages
440
Actually it's when a neutral hostile unit dies by a hero, then all player units are selected (which is an RPG case is usually only a hero unit anyhow, but I am still trying to get to where I can add a condition to pick only hero units)

ok. If this is an rpg style game, the only enemy would be nuetral hostile ( I am assuming). If this is the case, the condtion that you use:
  • Conditions
    • (Owner of( Triggering Unit)) equal to nuetral hostile
should do the same thing as your matching condition. The hero check is a boolean condition. Otherwise, this will work:
  • Actions
    • Unit Group - Pick every unit in (Units within 1000.00 of (Position of (Triggering unit)) matching ((((Matching unit) is A Hero) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of (Killing unit))) Equal to True))) and do (Actions)
    • Loop - Actions


Try that.
 
Last edited:
Status
Not open for further replies.
Top