• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Quick Hero Question

Status
Not open for further replies.
Level 2
Joined
Feb 18, 2008
Messages
21
I'm trying to create a heroic footman to replace the standard footman. I had done this in a map a few years ago, but my work sadly has been lost. I'm specifically wanting the new heroic unit to behave exactly like the old one but I'm currently running into an issue where when it dies, the 'hero death' animation plays leaving no corpse and making the unit revivable from the Altar.

I am trying to get him to die just like a standard unit, ie. leave a corpse and not be revivable from an Altar. I -had- this working in my old version but now I can't seem to figure out how to do it. I would have thought that setting Combat Death Type to Can raise, does decay would be the setting to set but apparently not, and I can't find a hero setting for a specific unit saying that it cannot be revived.

At the moment I'm going it with a hacky trigger (see below), which has its own drawbacks, specifically: The dead unit corpse is not the actual unit, just a corpse of that unit type, so any individual unit data, ie. xp, is lost if a paladin revives them. Also if I use Unit - A unit Becomes revivable trigger event, The 'hero death' animation still plays, or if I use Unit - Dies, no death animation plays at all.

So my question is: Is there a way to do this without using triggers, or if triggers are necessary, is there a way to do this with a nicer trigger than the one I am currently using?

(Edit: Also...not really sure if this thread should be here or in the trigger section... I would really like to be able to do it without triggers, but I will take either option)

  • HeroDeath
    • Events
      • Unit - A unit Becomes revivable
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Not equal to Paladin
          • (Unit-type of (Triggering unit)) Not equal to Archmage
          • (Unit-type of (Triggering unit)) Not equal to Mountain King
          • (Unit-type of (Triggering unit)) Not equal to Blood Mage
          • (Unit-type of (Triggering unit)) Not equal to Blademaster
          • (Unit-type of (Triggering unit)) Not equal to Far Seer
          • (Unit-type of (Triggering unit)) Not equal to Tauren Chieftain
          • (Unit-type of (Triggering unit)) Not equal to Shadow Hunter
          • (Unit-type of (Triggering unit)) Not equal to Death Knight
          • (Unit-type of (Triggering unit)) Not equal to Lich
          • (Unit-type of (Triggering unit)) Not equal to Dreadlord
          • (Unit-type of (Triggering unit)) Not equal to Crypt Lord
          • (Unit-type of (Triggering unit)) Not equal to Keeper of the Grove
          • (Unit-type of (Triggering unit)) Not equal to Priestess of the Moon
          • (Unit-type of (Triggering unit)) Not equal to Demon Hunter
          • (Unit-type of (Triggering unit)) Not equal to Warden
          • (Unit-type of (Triggering unit)) Not equal to Alchemist
          • (Unit-type of (Triggering unit)) Not equal to Naga Sea Witch
          • (Unit-type of (Triggering unit)) Not equal to Tinker
          • (Unit-type of (Triggering unit)) Not equal to Beastmaster
          • (Unit-type of (Triggering unit)) Not equal to Dark Ranger
          • (Unit-type of (Triggering unit)) Not equal to Firelord
          • (Unit-type of (Triggering unit)) Not equal to Pandaren Brewmaster
          • (Unit-type of (Triggering unit)) Not equal to Pit Lord
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Unit - Remove (Triggering unit) from the game
      • Unit - Create a (Unit-type of (Triggering unit)) corpse for (Owner of (Triggering unit)) at (Position of (Triggering unit))
 
Level 2
Joined
Feb 18, 2008
Messages
21
Sorry, yeah it would be much easier to do that if the footman was the only unit I was going to create, but my overall (and slightly ambitious) aim is to replace all units barring workers, with heroes. So having a big list of NOT original heroes is more efficient than a bigger list containing all my new hero units of which only the footman exists so far.
 
Level 6
Joined
Oct 10, 2009
Messages
1,425
couldn't you just use kill triggering unit. it will never work with remove triggering unit. that removes all instances that your unit ever existed. so it would make it no longer reviveable.

EDIT:eek:hhh, i misread your question and I'm 98% sure i know how to do what your actually asking, give me a minute to go check my WE.
 
Level 2
Joined
Feb 18, 2008
Messages
21
The problem with that approach is (although I haven't actually tested it) that by the time this trigger fires the unit is already dead, so killing it would do nothing. This would also not stop the heroic footman's soul from returning to the Altar so he could be revived, which is something that I wish to be reserved for the original heroes only.

Once a heroic footman dies, I want the only way he can live again to be via the Paladin's resurrection spell, not the Altar... just like any standard unit. The only way I've found to do this so far is by removing the unit (which also removes the corpse, making him unrevivable at all). I can probably get around that via some slightly more complicated trigger trickery, but my main question was: Is there a way to stop specific heroes being revivable at an Altar -without- the use of triggers?

EDIT: Just read your edit lol
 
Level 2
Joined
Feb 18, 2008
Messages
21
That helps a bit with the visuals, although the corpse still sort of fades away unless I remove the unit, but if I remove the unit there's not really a need to remove the animations in the first place.

At the moment using triggers, depending on whether I use Unit - Died or Unit - Becomes Revivable here is what I have to do to make a unit die like a standard unit:

Unit - Died
Wait for unit death animation
Remove floating animation
Remove fading animation
(last 2 steps unnecessary due to unit removal)
Remove unit
Create unit corpse

Unit - Becomes Revivable
(too late to remove 'hero death' animations)
Remove unit
Create unit corpse

The problem with the first approach is I don't know how to wait for the specific duration of each unit, as all their death animations are different lengths and I don't want to be creating a new trigger for each unit. The problem with the second approach is that I can't remove the animations at all...

I'm specifically looking for any possible way of simplifying this process, without triggers at all if possible. Surely it can't be this difficult to get a unit to just die...
 
Last edited:
Level 2
Joined
Feb 18, 2008
Messages
21
Well, after a few hours (about 6...) of poking around this site and others, I have crafted a trigger solution. Although it only works for one unit so far, it can be expanded to utilize many units in the future (which will be my next task). Unfortunately I could not find a non-trigger solution in the end, although I am still not convinced that there isn't one. Thanks for everyone's help here, hopefully this will be useful to someone in the future.

I will probably also end up converting this to JASS to remove those unnecessary globals and tighten up the code a bit.

******

So here is my trigger for the death of the unit. I'm basically just grabbing all the relevant data from my Hero unit and then replacing it with a normal footman place holder.

  • FootmanDies
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to FootmanHero
    • Actions
      • Set location = (Position of (Triggering unit))
      • Set rotation = (Facing of (Triggering unit))
      • Set xp = (Hero experience of (Triggering unit))
      • Unit - Remove (Triggering unit) from the game
      • Unit - Create 1 Footman for (Owner of (Triggering unit)) at location facing rotation degrees
      • Unit - Set the custom value of (Last created unit) to xp
      • Unit - Kill (Last created unit)
      • Custom script: call RemoveLocation(udg_location)
If a paladin decides to res the dead unit, I replace it again. Thus completing the swap and resetting the hero's experience to be what it was before death. If he decides to let it stay dead, it remains a visually appealing corpse, with the player remaining ignorant of the unit change. It's a little hacky and I'm going to see if I can refine it some more, but for now it works satisfactorily.

  • FootmanRes
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Resurrection
    • Actions
      • Set resGroup = (Units within 900.00 of (Position of (Triggering unit)))
      • Unit Group - Pick every unit in resGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is dead) Equal to True
              • (Owner of (Picked unit)) Equal to (Owner of (Triggering unit))
              • (Unit-type of (Picked unit)) Equal to Footman
            • Then - Actions
              • Set xp = (Custom value of (Picked unit))
              • Unit - Replace (Picked unit) with a FootmanHero using The new unit's max life and mana
              • Hero - Set (Last replaced unit) experience to xp, Hide level-up graphics
              • Special Effect - Create a special effect attached to the origin of (Last replaced unit) using Abilities\Spells\Human\Resurrect\ResurrectTarget.mdl
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
      • Custom script: call DestroyGroup(udg_resGroup)
 
Status
Not open for further replies.
Top