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

Hero exp on a kill from another unit with triggers?

Status
Not open for further replies.
Level 18
Joined
Mar 13, 2009
Messages
1,411
I might just have to change a little trigger, but in my map I got a spell which makes the hero create a trap. This trap will attack nearby units, which triggers an ability making the trap fire an Shadow Bolt-like spell and killing the trap.
Now when a hero is close to the trap he placed and another enemy hero walks on the trap and gets killed, the trap's hero won't get exp.
Why does the hero not get exp from other killing units and how to fix this?
I really need to fix this, since my map is a hero based map. :cry:

Thanks for help and I will give rep.

Ps: Isn't there a trigger or a constant that enables/disables exp when other units kill a hero?


In short: unit kills won't give my hero exp.
 
Level 3
Joined
Apr 13, 2009
Messages
49
I think exp is given in a certain range so when the hero that placed the trap doesn't get any xp

-Edit-

This trigger will give him 200 xp even if he's miles away

  • Untitled Trigger 002
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Owner of (Dying unit)) is an enemy of (Owner of (Killing unit))) Equal to True
    • Actions
      • Hero - Add 200 experience to (Killing unit), Show level-up graphics
 
Level 18
Joined
Mar 13, 2009
Messages
1,411
Yes, that would be one option, but this trap is just one of a lot of spells with the problem.
It would probably go wrong when having to edit all spells with the problem, since I am not quite sure which ones actually got it. :(
 
Level 3
Joined
Apr 13, 2009
Messages
49
Just put as 2nd condition

  • (Ability being cast) Equal to Your spell
and copy that trigger for each spell you think is bugged, so you can leave the spells then.

Tbh I don't think the spell is bugged but just the hero to far
 
Level 18
Joined
Mar 13, 2009
Messages
1,411
Actually I thought of something easier, since exp would have to be spread over the map anyway. I don't know if this trigger would work:

  • Hero Experience
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is A Hero) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Dying unit) belongs to an enemy of Player 12 (Brown)) Equal to True
        • Then - Actions
          • Set TempGroup = (Units in (Playable map area) matching ((((Matching unit) is A Hero) Equal to True) and (((Matching unit) belongs to an ally of Player 11 (Dark Green)) Equal to True)))
          • Unit Group - Pick every unit in TempGroup and do (Actions)
            • Loop - Actions
              • Hero - Add (600 / (Number of units in TempGroup)) experience to (Triggering unit), Show level-up graphics
          • Custom script: call DestroyGroup (udg_TempGroup)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Dying unit) belongs to an enemy of Player 11 (Dark Green)) Equal to True
            • Then - Actions
              • Set TempGroup = (Units in (Playable map area) matching ((((Matching unit) is A Hero) Equal to True) and (((Matching unit) belongs to an ally of Player 12 (Brown)) Equal to True)))
              • Unit Group - Pick every unit in TempGroup and do (Actions)
                • Loop - Actions
                  • Hero - Add (600 / (Number of units in TempGroup)) experience to (Triggering unit), Show level-up graphics
              • Custom script: call DestroyGroup (udg_TempGroup)
            • Else - Actions
 
Level 18
Joined
Mar 13, 2009
Messages
1,411
Ok, I had to fix a few little things in the trigger.
Now it's this:
  • Hero Experience
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is A Hero) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Dying unit) belongs to an enemy of Player 11 (Dark Green)) Equal to True
        • Then - Actions
          • Set TempGroup = (Units in (Playable map area) matching ((((Matching unit) is A Hero) Equal to True) and (((Matching unit) belongs to an ally of Player 11 (Dark Green)) Equal to True)))
          • Unit Group - Pick every unit in TempGroup and do (Actions)
            • Loop - Actions
              • Hero - Add ((100 x (Hero level of (Dying unit))) / (Number of units in TempGroup)) experience to (Picked unit), Show level-up graphics
          • Custom script: call DestroyGroup (udg_TempGroup)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Dying unit) belongs to an enemy of Player 12 (Brown)) Equal to True
            • Then - Actions
              • Set TempGroup = (Units in (Playable map area) matching ((((Matching unit) is A Hero) Equal to True) and (((Matching unit) belongs to an ally of Player 12 (Brown)) Equal to True)))
              • Unit Group - Pick every unit in TempGroup and do (Actions)
                • Loop - Actions
                  • Hero - Add ((100 x (Hero level of (Dying unit))) / (Number of units in TempGroup)) experience to (Picked unit), Show level-up graphics
              • Custom script: call DestroyGroup (udg_TempGroup)
            • Else - Actions
I made a little mistake with picking the wrong group and giving exp to the triggering unit :slp:
I also made it level based.


Added: For as far as I can see when testing this trigger works perfectly fine. :D
 
Status
Not open for further replies.
Top