Show us what you have tried. Also tell us what is going wrong with yours.
Imo it seems like a LOT of exp is given but maybe because the party and killing unit xp are given at the same time, not sure. This worked for me.
- Party Exp
- Events
- Unit - A unit Dies
- Conditions
- ((Dying unit) is A structure) Equal to False
- Actions
- Set TempUnit = (Triggering unit)
- Set TempUnit2 = (Killing unit)
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- ((TempUnit is A Hero) Equal to True) and ((TempUnit2 is A Hero) Equal to True)
- Then - Actions
- Set Exp_ValueParty = (Exp_ValueParty x (Hero level of TempUnit))
- Set TempPoint = (Position of TempUnit2)
- Unit Group - Pick every unit in (Units within Exp_Area of TempPoint) and do (Actions)
- Loop - Actions
- Set TempUnit3 = (Picked unit)
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (TempUnit3 belongs to an ally of (Owner of TempUnit2)) Equal to True
- (TempUnit3 is A Hero) Equal to True
- (TempUnit3 is alive) Equal to True
- Then - Actions
- Set Exp_PickedPoint = (Position of TempUnit3)
- Hero - Add Exp_ValueParty experience to TempUnit3, Hide level-up graphics
- Floating Text - Create floating text that reads (+ + ((String(Exp_GainByLevelHero)) + party exp)) at Exp_PickedPoint with Z offset 100.00, using font size 9.00, color (0.00%, 100.00%, 0.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 3.00 seconds
- Floating Text - Set the velocity of (Last created floating text) to 70.00 towards 90.00 degrees
- Floating Text - Change the fading age of (Last created floating text) to 1.25 seconds
- Custom script: call RemoveLocation(udg_Exp_PickedPoint)
- Custom script: set udg_Exp_PickedPoint = null
- Else - Actions
- Custom script: call RemoveLocation(udg_TempPoint)
- Else - Actions
Hmm seems I made a few mistakes, this one is probably not that efficient since I pick the same group twice but I'm exhausted, someone can help you from here.
The initial Ifs seems kind of pointless to me, we should be checking every time a unit dies if we need to give XP to a nearby hero, not just when a hero gets the last hit. Maybe you want to give more XP if the hero gets the last hit, if that is the case you will need to add an IF back in. However I don't think its needed as you seem to want 100 as the base amount (which is a lot early btw)
Btw use Level of unit (it works for heroes and units)
- Party Exp
- Events
- Unit - A unit Dies
- Conditions
- ((Dying unit) is A structure) Equal to False
- Actions
- Set TempUnit = (Triggering unit)
- Set TempUnit2 = (Killing unit)
- Set Exp_ValueParty = (100 x (Level of TempUnit))
- Set TempPoint = (Position of TempUnit2)
- Set TempGroup = (Units within Exp_Area of TempPoint)
- Set TempInteger = 0
- Unit Group - Pick every unit in TempGroup and do (Actions)
- Loop - Actions
- Set TempUnit3 = (Picked unit)
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (TempUnit3 belongs to an ally of (Owner of TempUnit2)) Equal to True
- (TempUnit3 is A Hero) Equal to True
- (TempUnit3 is alive) Equal to True
- Then - Actions
- Set TempInteger = (TempInteger + 1)
- Else - Actions
- Set TempInt = (Exp_ValueParty / TempInteger)
- Unit Group - Pick every unit in TempGroup and do (Actions)
- Loop - Actions
- Set TempUnit3 = (Picked unit)
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (TempUnit3 belongs to an ally of (Owner of TempUnit2)) Equal to True
- (TempUnit3 is A Hero) Equal to True
- (TempUnit3 is alive) Equal to True
- Then - Actions
- Set Exp_PickedPoint = (Position of TempUnit3)
- Hero - Add TempInt experience to TempUnit3, Hide level-up graphics
- Floating Text - Create floating text that reads (+ + ((String(TempInt)) + party exp)) at Exp_PickedPoint with Z offset 100.00, using font size 9.00, color (0.00%, 100.00%, 0.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 3.00 seconds
- Floating Text - Set the velocity of (Last created floating text) to 70.00 towards 90.00 degrees
- Floating Text - Change the fading age of (Last created floating text) to 1.25 seconds
- Custom script: call RemoveLocation(udg_Exp_PickedPoint)
- Custom script: set udg_Exp_PickedPoint = null
- Else - Actions
- Custom script: call DestroyGroup(udg_TempGroup)
- Custom script: call RemoveLocation(udg_TempPoint)
I'm not really following what you're saying...
My last post works for if a regular unit (non-hero) OR a hero dies.
The trigger gets the total XP (to be given) based on the Dying units level * the 100 constant you had chosen.
If there are 2 hero units in range, when a level 5 unit (hero or non-hero) dies it will split the 500xp between these 2 units giving 250 each.
I think if you want to give extra XP for getting the last hit you should just do that separately, but I think you're going to want to make it minimal, and not do some multiple. i.e. Map Initialization set LastHitXp[1] = 15 LastHitXp[2] = 23
And then just check the level of the unit when it dies and give it the flat amount based on your predefined values.
yeap i'm stupid, because i didn't see a part in the conditions that tempunit is a hero or not, which means it works for both.you mean to say that the trigger you created is for hero and non-hero units already? if so, then i'm so stupid and wasted 5 hours trying to make a same trigger for non-hero units.