Page 1 of 1

Custom Spell

Posted: Thu Apr 24, 2008 7:10 pm
by Blake
I made a spell that casts a buff on a unit and if that unit is killed while being being under the buff, the unit is resurrected, the buff can be dispelled...

Here are the triggers:

Rebirth
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to Rebirth
    Actions
        Set RUnit = (Target unit of ability being cast)
        Trigger - Turn on Rebirth Buff Destroyed

Rebirth Buff Destroyed
    Events
        Time - Every 0.50 seconds of game time
    Conditions
        ((RUnit is alive) Equal to True) and ((RUnit has buff Rebirth (Custom)) Equal to False)
    Actions
        Set RUnit = NoUnit
        Trigger - Turn off (This trigger)


Raise Rebirth Unit
    Events
        Unit - A unit Dies
    Conditions
        (Dying unit) Equal to RUnit
    Actions
        Special Effect - Create a special effect at (Position of (Dying unit)) using Abilities\Spells\Other\Awaken\Awaken.mdl
        Unit - Create 1 (Unit-type of RUnit) for Player 1 (Red) at (Position of (Dying unit)) facing Default building facing degrees

Now I was wondering if there was a better way this can be done...

Also I know that I can make a dummy unit with a modified ability of resurrection appear and cast it to bring back the fallen unit...

Re: Custom Spell

Posted: Fri Apr 25, 2008 8:57 am
by tipereth
Uh.


Raise Rebirth Unit
    Events
        Unit - A unit Dies
    Conditions
        (Dying unit) has buff Rebirth equal to True.
    Actions
        Special Effect - Create a special effect at (Position of (Dying unit)) using Abilities\Spells\Other\Awaken\Awaken.mdl
        Unit - Create 1 Unit-type of dying unit at position of Dying Unit.

And you should only need the one trigger.

Re: Custom Spell

Posted: Fri Apr 25, 2008 11:48 am
by Blake
tipereth wrote: Uh.


Raise Rebirth Unit
    Events
        Unit - A unit Dies
    Conditions
        (Dying unit) has buff Rebirth equal to True.
    Actions
        Special Effect - Create a special effect at (Position of (Dying unit)) using Abilities\Spells\Other\Awaken\Awaken.mdl
        Unit - Create 1 Unit-type of dying unit at position of Dying Unit.

And you should only need the one trigger.
I'm pretty sure that any buffs a unit has are removed once the unit dies, so this trigger alone will not work.

Re: Custom Spell

Posted: Fri Apr 25, 2008 1:16 pm
by tipereth
Try it.

Re: Custom Spell

Posted: Fri Apr 25, 2008 3:51 pm
by Xenon
It's a really bad idea to create special effects and not destroy them. Just destroy the (last created special effect) immediately; it won't just disappear immediately but will be removed after 5 seconds, which is usually enough for short-term animated ones.

Re: Custom Spell

Posted: Fri Apr 25, 2008 6:11 pm
by Blake
I've tried it, it doesn't seem to work, I've also tried it with a slightly altered trigger...

Untitled Trigger 001
    Events
        Unit - A unit Dies
    Conditions
        ((Dying unit) has buff Rebirth of the Phoenix ) Equal to True
    Actions
        Set rebirth = (Dying unit)
        Set RevivePoint = (Position of (Dying unit))
        Special Effect - Create a special effect at (Position of (Dying unit)) using Abilities\Spells\Other\Awaken\Awaken.mdl
        Unit - Create 1 (Unit-type of rebirth) for Player 1 (Red) at RevivePoint facing Default building facing degrees

Doesn't seem to work either...

Xenon wrote: It's a really bad idea to create special effects and not destroy them. Just destroy the (last created special effect) immediately; it won't just disappear immediately but will be removed after 5 seconds, which is usually enough for short-term animated ones.
What's wrong with not destroying special effects? Do they lag the game up later?

Re: Custom Spell

Posted: Fri Apr 25, 2008 6:43 pm
by Xenon
Yes, and there's a limit to the number of special effects that can be in the game at a time. If you don't destroy them they add up.

Re: Custom Spell

Posted: Fri Apr 25, 2008 6:52 pm
by Blake
Xenon wrote: Yes, and there's a limit to the number of special effects that can be in the game at a time. If you don't destroy them they add up.
Oh, thanks for telling me, I thought that just because they're not visible means they ceased to exist..

Re: Custom Spell

Posted: Fri Apr 25, 2008 6:53 pm
by RazorclawX
Couldn't you use the triggers to temporarily add a variant of Reincarnate to the unit, then remove it later?

Re: Custom Spell

Posted: Fri Apr 25, 2008 7:01 pm
by Blake
RazorclawX wrote: Couldn't you use the triggers to temporarily add a variant of Reincarnate to the unit, then remove it later?
Trouble is, I was trying to make it so that even if an enemy unit was put under this spell it would be reborn as your unit...there's an item called "ruin of rebirth" I believe, if i remember correctly that does just that, however the ability wont work unless a dead unit actually drops that item...

Thing is to make this spell dispel-able you need to make another trigger, because  buffs are automatically removed from a dead unit upon death...