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

How do I make a unit invulnerable after being reincarnated?

Status
Not open for further replies.
Level 2
Joined
Jan 22, 2008
Messages
11
How do I make a unit invulnerable for 3 seconds after being reincarnated by a Hero holding the item Ankh of Reincarnation? TY for any help!

Code:
Reincarnation
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Item Reincarnation 
    Actions
        Unit - Make (Triggering unit) Invulnerable
        Set UnitVariable[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)
        Wait 3.00 seconds
        Unit - Make UnitVariable[(Player number of (Owner of (Triggering unit)))] Vulnerable

The above code doesn't seem to work.
 
Level 7
Joined
Aug 5, 2005
Messages
218
I've actually tried this before, and I couldn't find any way to trigger an event with reincarnation. Also when the unit dies it doesn't trigger "A unit dies" event.

What I did was remove reincarnation and rebuild the whole effect with triggers. Then you have a way to actually detect when the unit revives.

I could be wrong about the first part.
 
Level 2
Joined
Jan 22, 2008
Messages
11
Is there a way so that when the Hero dies, it won't count as a death like in the score results after the game? Besides that:

Thanks guys for the major help I triggered the entire effect and it works now.
Here's the code for whoever wishes to use (give credit if used please):

Code:
Reincarnation
    Events
        Unit - A unit Dies
    Conditions
        ((Triggering unit) has an item of type Ankh of Reincarnation) Equal to True
    Actions
        Set TempPlayer = (Owner of (Triggering unit))
        Set UnitVariable[(Player number of TempPlayer)] = (Triggering unit)
        Set TempPoint[(Player number of TempPlayer)] = (Position of UnitVariable[(Player number of TempPlayer)])
        Special Effect - Create a special effect at TempPoint[(Player number of TempPlayer)] using Abilities\Spells\Orc\Reincarnation\ReincarnationTarget.mdl
        Special Effect - Destroy (Last created special effect)
        Wait 5.00 seconds
        Hero - Instantly revive UnitVariable[(Player number of TempPlayer)] at TempPoint[(Player number of TempPlayer)], Show revival graphics
        Unit - Make UnitVariable[(Player number of TempPlayer)] Invulnerable
        Animation - Change UnitVariable[(Player number of TempPlayer)]'s vertex coloring to (100.00%, 25.00%, 25.00%) with 0.00% transparency
        Item - Set charges remaining in (Item carried by UnitVariable[(Player number of TempPlayer)] of type Ankh of Reincarnation) to ((Charges remaining in (Item carried by UnitVariable[(Player number of TempPlayer)] of type Ankh of Reincarnation)) - 1)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Charges remaining in (Item carried by UnitVariable[(Player number of TempPlayer)] of type Ankh of Reincarnation)) Equal to 0
            Then - Actions
                Hero - Drop (Item carried by UnitVariable[(Player number of (Triggering player))] of type Ankh of Reincarnation) from UnitVariable[(Player number of TempPlayer)]
                Item - Remove (Last dropped item)
            Else - Actions
                Do nothing
        Wait 3.00 seconds
        Animation - Change UnitVariable[(Player number of TempPlayer)]'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
        Unit - Make UnitVariable[(Player number of TempPlayer)] Vulnerable
 
Status
Not open for further replies.
Top