• 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.
  • Vote for the theme of Hive's HD Modeling Contest #7! Click here to vote! - Please only vote if you plan on participating❗️

Hero gain exp through another unit.

Status
Not open for further replies.
Level 5
Joined
Jun 21, 2013
Messages
116
I made a hero who posesses units, and I need a way to make hero gain exp when the posessed unit kills a unit that has exp reward.

Basically, when unit X kills an enemy, unit Y gets exp reward.

I sense it's pretty simple and that I just can't find the right trigger.
 
Level 21
Joined
Jul 6, 2014
Messages
6,790
This simple,but this thread should be in the triggers and scripts section,I think
[Trigger=the trigger]
Events
Units - A unit Dies

Conditions
(Killing unit) Equal to Possesed Unit <gen>
Actions
Hero - Add 100 experience to Posseser <gen>
[/trigger]
 
Level 5
Joined
Jun 21, 2013
Messages
116
This simple,but this thread should be in the triggers and scripts section,I think
[Trigger=the trigger]
Events
Units - A unit Dies

Conditions
(Killing unit) Equal to Possesed Unit <gen>
Actions
Hero - Add 100 experience to Posseser <gen>
[/trigger]

I know about that way. I was wondering if there is a way to get the amount that killed unit would normally give instead of fixed amount?
 
Level 12
Joined
Oct 16, 2010
Messages
680
try this.. ( note that unit X must be a hero unit - can aquire exp - too )

  • Events
    • Unit - A unit dies
  • Conditions
    • Condition - (Type of(Killing unit)) equals to - X unit type
  • Actions
    • Custom script: local unit u = GetKillingUnit()
    • Custom script: local int i = GetHeroXP(u)
    • Custom script: call SetHeroXP(udg_YUnitVar, GetHeroXP(udg_YUnitVar)+i , true)
    • Custom script: call SetHeroXP(u,0,false)
sry EDITED

It should work , unless unit dies event occures before xp distribution:/
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
if thats the situation then there is no other way AFAIK
I can only imagine a DDS which is able to change the damage source:p

If his skill can posses non-hero units there is 2 option

1)Moving a dummy hero with possessed unit.

2)When possesed unit kills a unit (or some alliance), calculate the amount of experience that possesed would receive if it was a hero.
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
Yeah there is a formula, you just need to know 4 values from gameplay constants.This is how default exp looks like.

xp bounty for level 1 creep = 25
xp bounty for level X creep = xp bounty for level X-1 creep + 5*X + 5

25,40,60,85..... and so on(+5 addition)

there is also a formula for heroes.
 
Status
Not open for further replies.
Top