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

Need help with a reviving mechanic

Status
Not open for further replies.
Level 2
Joined
Sep 15, 2022
Messages
5
I'm trying to create a resurrection mechanic similar to modern games. The hero does not die, but loses consciousness. Another hero uses rescue skill while being next to him and, after a while, brings a wounded comrade back to life. Two problems have appeared:
1. At first, I tried to immediately revive the dying hero, play his death animation and make him invulnerable. The problem is that the size of the hero is very large and if he loses consciousness And becomes invulnerable, he closes narrow passages with his giant body, which ruins the balance of the map. I tried to assign different categories to him, but still haven't found a way to make his body "transparent". Ideally, it would be great to stick with this one. To understand how you can make a character "transparent" but present at the time of death, and then return everything to how it was afrer ressurecting.
2. After first failure, I decided to create a copy of the hero and reduced it hertbox to 1. When the main character dies, he is replaced by a "transparent" copy, and when the ability is used on it, the real one is resurrected. But when you change between the copy and the real version, all abilities of the real one are reset and they must be reassigned. Can't find solution, will be glad for any advice 🙏
 
Level 2
Joined
Sep 15, 2022
Messages
5
I tested with several things until I found the right ability for that:

  • Unit - Add Ghost (Visible) to (Triggering unit)
It makes no difference visually (the unit doesn't become transparent), but other units can walk through it as if it were invisible, should get the job done
Thank you, it helped! But now there is another problem. When unit lies, he need to be paused. Pause command, however, have some sort of conflict with Ghost ability. When unit paused, it just wont work. Even if unit had the ability before dying, pause command removing transperent effect
 
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,871
Another idea is to kill the hero but create something that represent their corpse. This is more convenient than handling death effects yourself.

Here's an example map (requires latest patch) with both MUI and MPI triggers.
 

Attachments

  • Hero Revive System 1.w3m
    24.9 KB · Views: 8
Level 2
Joined
Sep 15, 2022
Messages
5
Thank you all for your advices!
Pause first then add Ghost? You can also stun the hero with something like a dummy cast Storm Bolt instead of Pausing.
First advice didn't work, was trying it from the start. Pause command neutralises all status effects, didn't matter when they were casted. But your second advice saved the day! Guess I just overthinking it, when it was on the surface 😁 Thank you very much!
Another idea is to kill the hero but create something that represent their corpse. This is more convenient than handling death effects yourself.

Here's an example map (requires latest patch) with both MUI and MPI triggers.
Thank you for helping, but I don't have the latest patch version 🙏
 
Level 6
Joined
Nov 3, 2018
Messages
79
hey there here's a small demo but is this what you are trying to do?

The method you could use is

Unit Gets downed

Turn on a timer trigger
Give the downed unit an invisible aura (make the aura's range super low)
the timer trigger should be checking every 0.03 seconds that units affected by that aura have their collision turned off (so that they can walk through him)and that timer also makes that any unit not having the aura have their collision turned on instead

then after the guy gets " revived" turn the collision alteration check off

there may be flaws to this method but this is what i came up with

ALSO instead of pause unit you could make the unit sleep
 

Attachments

  • bandicam 2024-02-29 14-55-49-945.mp4
    22.4 MB
Last edited:
Level 45
Joined
Feb 27, 2007
Messages
5,578
Aura update frequency is quite low (on the order of a second or two sometimes depending on how many units are in the map), and while that method looks cool it introduces exploitable behavior when units have their collision turned off in that small area. A savvy player could use such a mechanic to get units into unintended locations by strategically killing a hero to make a collision-free zone, or use it to stack an entire army in one location easily.

In the worst case implementation it also requires you to enumerate over every single unit on the map every tick because you need to find units that used to have the aura buff but don't any more. This can be solved, but approaching the problem like this is IMO an easy way to create a subpar solution that will start to bog down the map if unit counts get high.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,871
Thank you all for your advices!

First advice didn't work, was trying it from the start. Pause command neutralises all status effects, didn't matter when they were casted. But your second advice saved the day! Guess I just overthinking it, when it was on the surface 😁 Thank you very much!

Thank you for helping, but I don't have the latest patch version 🙏
Here's the triggers if you're interested, no worries if you want to try something else:
  • Hero Dies
    • Events
      • Unit - A unit Becomes revivable
    • Conditions
    • Actions
      • Set VariableSet HRS_Point = (Position of (Triggering unit))
      • -------- --------
      • Unit - Create 1 Tombstone for (Owner of (Triggering unit)) at HRS_Point facing 0.00 degrees
      • Unit - Turn collision for (Last created unit) Off.
      • Custom script: call SetUnitX( bj_lastCreatedUnit, GetLocationX( udg_HRS_Point ) )
      • Custom script: call SetUnitY( bj_lastCreatedUnit, GetLocationY( udg_HRS_Point ) )
      • -------- --------
      • Set VariableSet HRS_Index = (Player number of (Owner of (Triggering unit)))
      • Set VariableSet HRS_Hero[HRS_Index] = (Triggering unit)
      • -------- --------
      • Custom script: call RemoveLocation( udg_HRS_Point )
  • Hero Revive Begin
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Revive
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Target unit of ability being cast)) Not equal to Tombstone
        • Then - Actions
          • Unit - Order (Triggering unit) to Stop.
        • Else - Actions
          • Set VariableSet HRS_Index = (Player number of (Owner of (Triggering unit)))
          • Set VariableSet HRS_Tombstone[HRS_Index] = (Target unit of ability being cast)
  • Hero Revive Finish
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Revive
    • Actions
      • Set VariableSet HRS_Index = (Player number of (Owner of (Triggering unit)))
      • Set VariableSet HRS_Tombstone[0] = HRS_Tombstone[HRS_Index]
      • Set VariableSet HRS_Index = (Player number of (Owner of HRS_Tombstone[0]))
      • -------- --------
      • -------- Remove the tombstone: --------
      • Unit - Remove HRS_Tombstone[0] from the game
      • -------- --------
      • -------- Revive the hero: --------
      • Set VariableSet HRS_Point = (Position of HRS_Hero[HRS_Index])
      • Hero - Instantly revive HRS_Hero[HRS_Index] at HRS_Point, Show revival graphics
      • Custom script: call RemoveLocation( udg_HRS_Point )
Revive is based on Aerial Shackles:
1709241352494.png

The Tombstone is a "dummy" Hero that's invulnerable and has the Ward classification. It can't do anything other than get targeted by the Revive ability. The idea is that you channel the Revive ability on a Tombstone for 3 seconds to resurrect the fallen hero. Of course, channeling is optional, I just thought it'd be interesting since it can be interrupted and could create exciting moments in gameplay.

Here's another neat addition, this trigger allows you to Right-click a Tombstone in order to revive it:
  • Right Click Revive
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Unit-type of (Target unit of issued order)) Equal to Tombstone
      • (Issued order) Equal to (Order(smart))
      • (Level of Revive for (Triggering unit)) Greater than 0
    • Actions
      • Unit - Order (Triggering unit) to Human Dragonhawk Rider - Aerial Shackles (Target unit of issued order)
This also means you could hide the Revive ability (don't forget to remove it's Hotkey) and save a slot on the command card.

Also, you can swap out Player Number for Custom Value and use a Unit Indexer if you want it to be MUI, which means it'll work for any number of Heroes per Player. That being said, it's much better when used with a one Hero per Player setup.
 
Last edited:
Status
Not open for further replies.
Top