HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Hero Sleeps and regenerating HP/Mana

05-05-2004, 02:43 PM#1
PatruX
Okey, I did this: When your Hero uses an ability (Sleep) on himself, He will start sleeping for 10 seconds. After each second he will get 10 HP and 10 Mana (Max HP / Mana = 100). That's what I could do myself.
Problem:
When he's attacked (While sleeping) he will be able to move again, BUT he will still regenerate HP / Mana until these 10 seconds is over.

Here's the trigger:
Quote:
Events
Unit - A unit Begins casting an ability


Conditions
(Ability being cast) Equal to Rest (All)


Actions
Player Group - Pick every player in (Player group((Owner of (Triggering unit)))) and do (Cinematic - Fade out over 2.00 seconds using texture Dream and color (0.00%, 0.00%, 0.00%) with 0.00% transparency)
Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + 10.00)%
Unit - Set mana of (Triggering unit) to ((Life of (Triggering unit)) + 10.00)%
Wait 1.00 seconds
Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + 10.00)%
Unit - Set mana of (Triggering unit) to ((Life of (Triggering unit)) + 10.00)%
Wait 1.00 seconds
Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + 10.00)%
Unit - Set mana of (Triggering unit) to ((Life of (Triggering unit)) + 10.00)%
Wait 1.00 seconds
Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + 10.00)%
Unit - Set mana of (Triggering unit) to ((Life of (Triggering unit)) + 10.00)%
Wait 1.00 seconds
Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + 10.00)%
Unit - Set mana of (Triggering unit) to ((Life of (Triggering unit)) + 10.00)%
Wait 1.00 seconds
Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + 10.00)%
Unit - Set mana of (Triggering unit) to ((Life of (Triggering unit)) + 10.00)%
Wait 1.00 seconds
Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + 10.00)%
Unit - Set mana of (Triggering unit) to ((Life of (Triggering unit)) + 10.00)%
Wait 1.00 seconds
Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + 10.00)%
Unit - Set mana of (Triggering unit) to ((Life of (Triggering unit)) + 10.00)%
Wait 1.00 seconds
Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + 10.00)%
Unit - Set mana of (Triggering unit) to ((Life of (Triggering unit)) + 10.00)%
Wait 1.00 seconds
Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + 10.00)%
Unit - Set mana of (Triggering unit) to ((Life of (Triggering unit)) + 10.00)%
Wait 1.00 seconds
Player Group - Pick every player in (Player group((Owner of (Triggering unit)))) and do (Cinematic - Fade in over 2.00 seconds using texture Dream and color (0.00%, 0.00%, 0.00%) with 0.00% transparency)

And I want it to stop regenerate his HP / Mana when he is attacked.. :>
05-05-2004, 03:46 PM#2
JJ912
Code:
Events
    A unit Starts the effect of an ability

Conditions
    ((Ability being cast) Equal to Sleep) and ((Target unit of ability being cast) Equal to (Casting unit))

Actions
    Set HeroSleeping = (Casting unit)
    Start SleepTimer as a One-shot timer that will expire in 1.00 second

Code:
Events
    SleepTimer expires

Actions
    If - Conditions
        ((HeroSleeping) has buff Sleep) Equal to True
    Then - Actions
        Set life of (HeroSleeping) to ((Life of (HeroSleeping)) + 10.00)
        Start SleepTimer as a One-shot timer that will expire in 1.00 seconds
    Else - Actions
        Set HeroSleeping = No unit
05-05-2004, 05:01 PM#3
PatruX
Thanks :D
05-05-2004, 05:10 PM#4
th15
You know, you could just cast the healing salve and clarity potion spells on him... Just convert the item abilities to unit abilities and make a dummy unit with both.
05-05-2004, 05:36 PM#5
Panto
Or the scroll of restoration.

Or, you could use the Staff that one of the melee racial shops sells that teleports a unit, stuns them for a length of time, and heals them over time. Might not want just that effect, though.

At any rate, trigger-based questions belong in the Trigger Haven.
05-05-2004, 06:03 PM#6
PatruX
Just curious, but how do you make a Item ability a Unit ability?
05-05-2004, 06:07 PM#7
Kamux
Just set the 'item abillity - true' to be false and then it is an unit abillity.
05-05-2004, 06:09 PM#8
PatruX
Hmm, I can't find it (Looking at Healing Salve). I must be blind, checked the column like 5 times.. o_O

Edit: Eh, lol.. Found it ;DD
05-05-2004, 10:27 PM#9
Arohk
Quote:
Originally Posted by PatruX
Okey, I did this: When your Hero uses an ability (Sleep) on himself, He will start sleeping for 10 seconds. After each second he will get 10 HP and 10 Mana (Max HP / Mana = 100). That's what I could do myself.
Problem:
When he's attacked (While sleeping) he will be able to move again, BUT he will still regenerate HP / Mana until these 10 seconds is over.

Here's the trigger:


And I want it to stop regenerate his HP / Mana when he is attacked.. :>

insert this IF/THE/ELSE after each healing action
IF Unit(sleeping unit) has buff (sleep) equal to true THEN do nothing ELSE do skip remeining conditions

should work if you do it right
05-05-2004, 10:27 PM#10
Shimrra
You should be able to do this simply by using this trigger:
[edit] This is basically a formatted, tested version of the above (I hadn't refreshed during my test, so I didn't notice it...)

Code:
Sleep
    Events
        Unit - A unit Begins casting an ability
    Conditions
        ((Ability being cast) Equal to Sleep) and ((Target unit of ability being cast) Equal to (Casting unit))
    Actions
        Wait 1.00 seconds
        Game - Display to (All players) the text: +10!
        Unit - Set life of (Casting unit) to ((Life of (Casting unit)) + 10.00)
        Unit - Set mana of (Casting unit) to ((Mana of (Casting unit)) + 10.00)
        For each (Integer A) from 1 to 10, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Casting unit) has buff Sleep) Equal to True
                    Then - Actions
                        Unit - Set life of (Casting unit) to ((Life of (Casting unit)) + 10.00)
                        Unit - Set mana of (Casting unit) to ((Mana of (Casting unit)) + 10.00)
                        Wait 1.00 seconds
                    Else - Actions
                        Set UnitVariable = No unit
                        Skip remaining actions