• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] Reincarnation-type spell

Status
Not open for further replies.
Level 7
Joined
Jan 11, 2022
Messages
108
Trying to make a spell that would work kind of like a reincarnation. It would be a passive effect that if a hero dies, it summons a spirit with same skills as a hero for period of time. I'm trying to kind of base it on Dread Lord's Infernus ability, but can't figure out a trigger to set it all up. my idea was to make it like "If the unit dies, create a dummy that will cast a Infernus-type spell summoning the spirit, then the dummy expires". But my main problem is making passive effect even start working after unit's death, can't find a function that would apply to that.
Also tried with order function but can't set it to Dread Lord's Infernus, so I have no idea how to order the dummy to cast the spell with a base like that

Edit: would need also a cooldown function, to not let it reincarnate every time a hero dies.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
The Inferno spell targets a Point and can be found in the Issue Order Targeting A Point action:
  • Events
    • Unit - A unit Dies
  • Conditions
    • (Level of YourAbility for (Triggering unit)) Greater than 0
  • Actions
    • Unit - Create 1 Dummy...
    • // Proceed to setup the Dummy unit //
    • Unit - Order YourDummy to Undead Dreadlord - Inferno (Position of (Triggering unit))
The method used for the cooldown of the passive skill will depend on which version of Warcraft 3 you're using. It's possible to manually Start ability cooldowns in more recent versions of Warcraft 3, otherwise you'll need to rely on older less reliable methods.
 
Last edited:
Level 7
Joined
Jan 11, 2022
Messages
108
I've set it up like this

  • Guardian Angel
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Level of Guardian Angel for (Triggering unit)) Greater than 0
    • Actions
      • Set PD_caster = (Casting unit)
      • Unit - Create 1 Spirit Healer for (Owner of PD_caster) at (Target point of ability being cast) facing generic building facing degrees
      • Unit - Set level of Guardian Angel Dummy for (Last created unit) to (Level of Guardian Angel for (Triggering unit))
      • Unit - Order (Last created unit) to Undead Dreadlord: Inferno (Position of (Triggering unit))
      • Unit - Add a 2.00 second generic expiration timer to (Last created unit)
But still it does nothing. I think it can be because Inferno ability has to have the AoE region set to be cast, and it's not set in the trigger so the dummy don't know where to cast it, but i'm not sure if that's the case, if it's the only reason it doesn't work
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
  • Set PD_caster = (Casting unit)
^ There is no (Casting unit) since this is a "A unit Dies" Event which has nothing to do with abilities.

There are Events and there are Event Responses. When a unit levels up, dies, casts a spell, etc, these are all considered Events which have their own exclusive Event Responses. You can use these Event Responses in your trigger's Conditions/Actions in order to interact with the Units/Players/Items involved with your Event.

The Event Responses available in your trigger are: (Dying unit), (Killing unit), and (Triggering unit).

Note that (Triggering unit) will ALWAYS be set to the unit mentioned in a Unit Event ---> A unit Dies.

So in this case (Triggering unit) is identical to (Dying unit), so pick the one that makes the most sense to you.

Also, there is no (Target point of ability being cast) either, because again the trigger's Event has nothing to do with abilities. Instead, you want to cast Inferno at the (Position of (Triggering unit)). Or you could use the (Dying unit)'s position, either Event Response will work.

Lastly, I would use a different variable than PD_caster or at least come up with a variable name that makes sense. Often users will create "generic" variables that are intended to be used throughout their triggers and name them as temp or temporary:
  • Set Temp_Unit = (Some unit)
  • Set Temp_Point = (Position of...)
  • Set Temp_UnitGroup = (Units in...)
It can also be wise to create a new variable dedicated to your trigger to avoid rare but potential clashing issues:
  • Set GA_Hero = (Dying unit)
 
Last edited:
Level 7
Joined
Jan 11, 2022
Messages
108
After changing Event Responses everything works perfectly! I have to spend more time learning all features of triggers and how they work to not make such mistakes.

With PD_caster I'll have to rename it because it's a variable I used in my first trigger and it just stayed :xxd:


I wanted to ask about last thing, and it's cooldown on passive abilities and methods you mention. I'm on version 1.27 so I guess I'll have to take up a way around it. But after looking into reincarnation passive I found that there's actually something like it called Statistics - cooldown (acdn) - (number). I based my reincarnation on Dread Lord's Vampiric aura, because it was the first passive spell I came across while making a passive dummy. and there's also such statistic. I put the numbers for cooldown, tested it and after reviving a hero and dying it also activated the passive reincarnate even though I set it to 600sec, so I'm wondering if it's the right statistic i've set or not

Also what Event Response should I set to add abilities to summoned unit (And the level of that ability to the level of hero's ability)? not to the dummy summoning the unit but the unit itself? Because tried something like this, but no matter which response I set, ability doesnt appear in the unit:
  • Unit - Add Circle of Light to (Summoned unit)
  • Unit - Set level of Circle of Light for (Summoned unit) to (Level of Circle of Light for (Triggering unit))
Tried "summoned unit", "last created unit (I know it would apply maybe for the dummy that was created)", "Triggering unit", and couple more but can't quite... find it
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
Abilities are programmed to do a specific thing. Vampiric Aura is an aura that grants lifesteal to nearby units. Reincarnation is an ability that prevents death and then goes on cooldown. These are two completely different abilities with different mechanics which are hardcoded to function a certain way.

The Object Editor is misleading because it offers many fields like Buffs, Duration, Cooldown, Cast Range, Area of Effect, etc, despite the fact that these do not work for every ability. Almost every ability is different and you can only really tweak an existing ability to do more or less of what it already does.

So if you want a completely custom ability then you'll need to trigger it.

Since you're on such an old version (is there a reason you can't update?) you will need to use an older method for a visual passive cooldown: Passive ability with cooldown - Best method!

The actual logic for the cooldown which will prevent the ability from happening again can be handled in many different ways.

The easiest I can think of is to use a Unit Group variable and a Wait action. The Hero will be Added to a Unit Group for 60.00 seconds or however long you want the cooldown of the ability to be, and then Removed from the Unit Group afterwards. As long as the Hero is in this Unit Group it cannot trigger the ability again (see the new condition):
  • Guardian Angel
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Level of Guardian Angel for (Triggering unit)) Greater than 0
      • (Triggering unit) is in GA_CooldownGroup) Equal to False
    • Actions
      • Set GA_Hero = (Triggering unit)
      • Unit - Create 1 Spirit Healer for (Owner of GA_Hero) at (Position of GA_Hero) facing generic building facing degrees
      • Unit - Set level of Guardian Angel Dummy for (Last created unit) to (Level of Guardian Angel for GA_Hero)
      • Unit - Order (Last created unit) to Undead Dreadlord: Inferno (Position of GA_Hero)
      • Unit - Add a 2.00 second generic expiration timer to (Last created unit)
      • Unit Group - Add GA_Hero to GA_CooldownGroup
      • Wait 60.00 game-time seconds
      • Unit Group - Remove GA_Hero from GA_CooldownGroup
Note that this trigger can have issues if more than one unit has the Guardian Angel ability. This is due to the fact that we're using a global variable along with a Wait action.

To get around this issue I recommend doing something like this to convert the global variable into a local variable:
  • Guardian Angel
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Level of Guardian Angel for (Triggering unit)) Greater than 0
      • (Triggering unit) is in GA_CooldownGroup) Equal to False
    • Actions
      • Custom script: local unit udg_GA_Hero = GetTriggerUnit()
      • Unit - Create 1 Spirit Healer for (Owner of GA_Hero) at (Position of GA_Hero) facing generic building facing degrees
      • Unit - Set level of Guardian Angel Dummy for (Last created unit) to (Level of Guardian Angel for GA_Hero)
      • Unit - Order (Last created unit) to Undead Dreadlord: Inferno (Position of GA_Hero)
      • Unit - Add a 2.00 second generic expiration timer to (Last created unit)
      • Unit Group - Add GA_Hero to GA_CooldownGroup
      • Wait 60.00 game-time seconds
      • Unit Group - Remove GA_Hero from GA_CooldownGroup
Or even easier, get rid of the variable and do something like this:
  • Guardian Angel
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Level of Guardian Angel for (Triggering unit)) Greater than 0
      • (Triggering unit) is in GA_CooldownGroup) Equal to False
    • Actions
      • Unit - Create 1 Spirit Healer for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing generic building facing degrees
      • Unit - Set level of Guardian Angel Dummy for (Last created unit) to (Level of Guardian Angel for (Triggering unit))
      • Unit - Order (Last created unit) to Undead Dreadlord: Inferno (Position of (Triggering unit))
      • Unit - Add a 2.00 second generic expiration timer to (Last created unit)
      • Unit Group - Add (Triggering unit)to GA_CooldownGroup
      • Wait 60.00 game-time seconds
      • Unit Group - Remove (Triggering unit) from GA_CooldownGroup
(Triggering unit) is safe to use throughout this trigger even with a Wait.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
The Infernal is summoned by the Dummy unit so you should be able to detect this with a new trigger using the Summon Event:
  • Events
    • Unit - A unit Spawns a summoned unit
  • Conditions
    • (Unit-type of (Summoned unit)) Equal to Guardian Angel Summon
  • Actions
    • Unit - Add Circle of Light to (Summoned unit)
    • Unit - Set level of Circle of Light for (Summoned unit) to X
But since this is a separate trigger which will happen after a delay we will have lost track of our dying Hero.

However, there's an easy solution.
You could Add Circle of Light to your Dummy in the Guardian Angel trigger, Set it's level, and then reference this ability in the new Summon Trigger:
  • Events
    • Unit - A unit Spawns a summoned unit
  • Conditions
    • (Unit-type of (Summoned unit)) Equal to Guardian Angel Summon
  • Actions
    • Unit - Add Circle of Light to (Summoned unit)
    • Unit - Set level of Circle of Light for (Summoned unit) to (Level of Circle of Light for (Summoning unit))
Remember, the (Summoning unit) is the Dummy, not the Hero, which is what makes this workaround necessary.
 
Last edited:
Level 7
Joined
Jan 11, 2022
Messages
108
It worked with the first try! Glad I didn't mess it up this time :xxd:
The Spirit has exactly same abilities and levels of those abilities like the hero that died, so works just like I wanted it to work, thank you again Uncle!
(Cooldown trigger also works!)
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
Glad it worked. Note that the difficulty and complexity of these triggers changes depending on how your map works, so providing extra information in your posts can go a long way!

For example, if the Guardian Angel ability is used by a single Hero then your triggers become a lot more simple. This is because you can easily reference the Hero that has this ability by using a Unit variable instead of needing to rely on Event Responses. The GA_Hero variable that we were using in those other triggers becomes completely unnecessary if we already have a reference to the Hero.

Here's an example of tracking a Hero that was trained from an Altar or created using a trigger.
I don't know the name of your Hero but let's call him the Holy Paladin for now:
  • Events
    • Unit - A unit enters the map
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Holy Paladin
  • Actions
    • Set Hero_HolyPaladin = (Triggering unit)
Now any trigger that revolves around the Holy Paladin has a direct reference to the Hero at any given time. With this design we wouldn't need to worry about that workaround I explained in the Summon Trigger since we can easily get our Hero at any time:
  • Unit - Set level of Circle of Light for (Summoned unit) to (Level of Circle of Light for Hero_HolyPaladin)
If the Hero was pre-placed on the map then this becomes even easier since you can already reference them without the need of a Unit variable.

Again, this is only safe to do if you're 100% sure that there will only be ONE Holy Paladin on the map. You should also take into consideration the Refreshing/Resetting ability cooldown mechanic which could very easily break your spell triggers if they aren't designed properly. This issue may not exist in your map since you may not have this type of mechanic. Dispelling buffs is another mechanic that could clash with your spell triggers if you don't design them properly, although there is no buff involved with Guardian Angel so we're safe here.
 
Last edited:
Level 7
Joined
Jan 11, 2022
Messages
108
Glad it worked. Note that the difficulty and complexity of these triggers changes depending on how your map works, so providing extra information in your posts can go a long way!

For example, if the Guardian Angel ability is used by a single Hero then your triggers become a lot more simple. This is because you can easily reference the Hero that has this ability by using a Unit variable instead of needing to rely on Event Responses. The GA_Hero variable that we were using in those other triggers becomes completely unnecessary if we already have a reference to the Hero.

Here's an example of tracking a Hero that was trained from an Altar or created using a trigger.
I don't know the name of your Hero but let's call him the Holy Paladin for now:
  • Events
    • Unit - A unit enters the map
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Holy Paladin
  • Actions
    • Set Hero_HolyPaladin = (Triggering unit)
Now any trigger that revolves around the Holy Paladin has a direct reference to the Hero at any given time. With this design we wouldn't need to worry about that workaround I explained in the Summon Trigger since we can easily get our Hero at any time:
  • Unit - Set level of Circle of Light for (Summoned unit) to (Level of Circle of Light for Hero_HolyPaladin)
If the Hero was pre-placed on the map then this becomes even easier since you can already reference them without the need of a Unit variable.

Again, this is only safe to do if you're 100% sure that there will only be ONE Holy Paladin on the map. You should also take into consideration the Refreshing/Resetting ability cooldown mechanic which could very easily break your spell triggers if they aren't designed properly. This issue may not exist in your map since you may not have this type of mechanic. Dispelling buffs is another mechanic that could clash with your spell triggers if you don't design them properly, although there is no buff involved with Guardian Angel so we're safe here.
Holy Paladin is supposed to be in Human race, and i'm making a map to play with my friends etc. What should I do to prevent issues in case at least two players pick Holy Paladin as their hero? Because I'm afraid it will add abilities or use cooldown for the wrong player when both are using the same hero
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
Well, which of those 3 triggers that I suggested are you using? One uses GA_Hero as a global variable (BAD), another uses GA_Hero as a local variable (GOOD), and the last doesn't use it at all (GOOD).

To clarify, see my 3rd post where I show all of the triggers, I explained how to make the spell work for multiple units.

Side note:
Speaking of multiple units/players, there are two terms worth learning: MUI and MPI
MUI means that the trigger is designed to work for multiple units without issue.
MPI means that the trigger is designed to work for multiple players without issue.

Making something MUI or MPI all depends on what you're doing exactly. Sometimes the triggers already work for multiple units / players by default, sometimes it's an easy fix like using the correct Event Responses, and other times you need to use more advanced techniques like Indexing where you take advantage of variable Arrays.

Hopefully I'm not confusing you too much with excess information.
 
Last edited:
Level 7
Joined
Jan 11, 2022
Messages
108
Well, which of those 3 triggers that I suggested are you using? One uses GA_Hero as a global variable (BAD), another uses GA_Hero as a local variable (GOOD), and the last doesn't use it at all (GOOD).

To clarify, see my 3rd post where I show all of the triggers, I explained how to make the spell work for multiple units.

Side note:
Speaking of multiple units/players, there are two terms worth learning: MUI and MPI
MUI means that the trigger is designed to work for multiple units without issue.
MPI means that the trigger is designed to work for multiple players without issue.

Making something MUI or MPI all depends on what you're doing exactly. Sometimes the triggers already work for multiple units / players by default, sometimes it's an easy fix like using the correct Event Responses, and other times you need to use more advanced techniques like Indexing where you take advantage of variable Arrays.

Hopefully I'm not confusing you too much with excess information.
I used the last trigger without variables/local variables from 3rd post. The one that uses "add(triggering unit) to GA_CooldownGroup" so I hope it should be fine, haven't tested it yet. Also thanks for mentioning those two terms, seen them many times but didn't check what they mean, so now I know!
 
Status
Not open for further replies.
Top