• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 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!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

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