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

[Solved] Summon Unit Type Based On Corpse Of Dead Unit Type

Status
Not open for further replies.
Level 26
Joined
Dec 3, 2020
Messages
817
Hi,

how do I make it so when for example a Necromancer uses the Raise Dead ability (which will be an edited Carrion Beetles ability), the skeleton summoned changes according to the corpse/remains of the dead/unit being raised?
Example 1: Necromancer uses ability on a dead Troll Headhunter and a Skeleton Archer is summoned in its place (just 1).
Example 2: Necromancer uses ability on a dead Grunt and a Skeleton Orc is summoned in its place (again, just 1).

Bonus:
Also, how can I make it when a unit with the race "Orc" for example is raised into a skeleton, to make it summon a Skeleton Orc? No matter the unit type but it must only raise a Skeleton Orc if the raised unit has Race: Orc.

Thanks in advance!
 

Uncle

Warcraft Moderator
Level 70
Joined
Aug 10, 2018
Messages
7,386
Raise Dead targets a corpse which is not much different than a normal unit. So what you do is simply check the unit-type of the corpse that you've targeted with the ability and create the summon depending on that:
  • Raise Dead Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Raise Dead
    • Actions
      • Set VariableSet Raise_Unit_Type = (Unit-type of (Target unit of ability being cast))
      • Set VariableSet Raise_Point = (Position of (Target unit of ability being cast))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Raise_Unit_Type Equal to Footman
        • Then - Actions
          • Unit - Create 1 Skeleton Warrior for (Owner of (Triggering unit)) at Raise_Point facing Default building facing degrees
          • Set VariableSet Raise_Summon = (Last created unit)
          • Unit - Add a 45.00 second Generic expiration timer to Raise_Summon
          • Animation - Play Raise_Summon's birth animation
          • Animation - Queue Raise_Summon's stand animation
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Raise_Unit_Type Equal to Archer
            • Then - Actions
              • Unit - Create 1 Skeleton Archer for (Owner of (Triggering unit)) at Raise_Point facing Default building facing degrees
              • Set VariableSet Raise_Summon = (Last created unit)
              • Unit - Add a 45.00 second Generic expiration timer to Raise_Summon
              • Animation - Play Raise_Summon's birth animation
              • Animation - Queue Raise_Summon's stand animation
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Raise_Unit_Type Equal to Grunt
                • Then - Actions
                  • Unit - Create 1 Skeletal Orc for (Owner of (Triggering unit)) at Raise_Point facing Default building facing degrees
                  • Set VariableSet Raise_Summon = (Last created unit)
                  • Unit - Add a 45.00 second Generic expiration timer to Raise_Summon
                  • Animation - Play Raise_Summon's birth animation
                  • Animation - Queue Raise_Summon's stand animation
                • Else - Actions
      • Custom script: call RemoveLocation( udg_Raise_Point )
You can also check for the Race of the corpse to summon a specific variant:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Race of (Target unit of ability being cast)) Equal to Orc
    • Then - Actions
      • Unit - Create 1 Orc Skeleton for (Owner of (Triggering unit)) at Raise_Point facing Default building facing degrees
      • Set VariableSet Raise_Summon = (Last created unit)
      • Unit - Add a 45.00 second Generic expiration timer to Raise_Summon
      • Animation - Play Raise_Summon's birth animation
      • Animation - Queue Raise_Summon's stand animation
    • Else - Actions
If you want to summon more than one then use a For Loop and repeat the Actions any number of times:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Raise_Unit_Type Equal to Footman
    • Then - Actions
      • For each (Integer A) from 1 to 5, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Skeleton Warrior for (Owner of (Triggering unit)) at Raise_Point facing Default building facing degrees
          • Set VariableSet Raise_Summon = (Last created unit)
          • Unit - Add a 45.00 second Generic expiration timer to Raise_Summon
          • Animation - Play Raise_Summon's birth animation
          • Animation - Queue Raise_Summon's stand animation
    • Else - Actions
Because we're summoning the units in our triggers we need to make sure that our actual Raise Dead ability doesn't summon anything. However, I imagine the game will crash if you try to summon nothing so instead change the summoned Unit-Type on the ability to a Dummy unit that the user cannot see or control and with a duration of 0.01 seconds. To clarify, a Dummy unit is a unit based on the Locust but has some of it's settings changed so it cannot attack, move, or be seen.
 

Attachments

  • Raise Dead Unique Skeles.w3m
    18.9 KB · Views: 7
Last edited:

Uncle

Warcraft Moderator
Level 70
Joined
Aug 10, 2018
Messages
7,386
Got it, sir!
Just 1 question sir: do the if else statements have to be nested or can they be done on the same "level"/indentation?
The only reason to nest them here is because it's more performant. If for example the Unit-Type is a Footman, the trigger will skip checking if it was a Grunt or Archer due to how it's structured. However, if you don't nest them, the trigger will check those other mutually exclusive Conditions despite the fact that we know they're impossible, a unit can only be ONE unit-type after all.

But if you want more readability and don't care about a minor optimization then organize it however you'd like.

Also, I edited the triggers slightly and added a demo map to my previous post.
 
Last edited:

Uncle

Warcraft Moderator
Level 70
Joined
Aug 10, 2018
Messages
7,386
Thank you sir.
Also, if I remember correctly: I can give a unit the Summoned tag, right?(sorry for stupid question but I cannot open World Editor right now/today)
To make it take damage from Dispel Magic for example and Purge.
Yeah, there's an Add Classification function, just type classification in the Search For Text box in the Actions menu and you should find it.

Something like this:
  • Unit - Add Summoned classification to Raise_Summon
 
Status
Not open for further replies.
Top