HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Passive mana shield

10-01-2007, 07:18 PM#1
cohadar
I can't seem to find a mana shield ability that cannot be turned off.
Is it even possible to make this without triggering?

I so totally suck in object editor....
10-01-2007, 07:56 PM#2
Anopob
How bout adding it to a spell book while active then disable the spell book?
10-01-2007, 08:03 PM#3
cohadar
Almost doable...
But manashields turn off when you run out of mana, then what?

I guess this would require the same amount of triggering one way or the other... I make a custom one...
10-01-2007, 08:16 PM#4
Rising_Dusk
Quote:
Is it even possible to make this without triggering?
No. Make it fully triggered and it will be easier than trying to half-ass it.
10-01-2007, 09:13 PM#5
moyack
I would do it based on any aura, so it can show a buff, set the target only to self, and trigger the effect. Now that I think twice, it's very easy to trigger this ability.
10-01-2007, 09:15 PM#6
xombie
Because this is obviously going in the direction of damage detection and damage negation, I have a simple query.

If you want to deal 800 damage to a unit who only has 100 hit points, how can you negate all 800 damage without the unit dying? If you run a timer that expires in 0.00, and then add 800 back to the unit's hit points, will the unit die before it gets re-added or not?

...while I'm on the topic...

In the actual Unit Takes Damage function in a Damage Detection system, has the damage actually been dealt yet or is it merely being prepared to be dealt to the unit.
10-01-2007, 09:29 PM#7
cohadar
Quote:
Originally Posted by moyack
I would do it based on any aura, so it can show a buff, set the target only to self, and trigger the effect. Now that I think twice, it's very easy to trigger this ability.

I already have OnDamage system in the map but I would like to hear about this triggering you are talking about...


Quote:
Originally Posted by xombie
If you want to deal 800 damage to a unit who only has 100 hit points, how can you negate all 800 damage without the unit dying? If you run a timer that expires in 0.00, and then add 800 back to the unit's hit points, will the unit die before it gets re-added or not?

...while I'm on the topic...

In the actual Unit Takes Damage function in a Damage Detection system, has the damage actually been dealt yet or is it merely being prepared to be dealt to the unit.

You don't negate 800 damage, the unit dies, and it should die,
it is that way in any RPG system so I don't see a reason to be any different here.

The other question answer is yes. The damage is already delt.
10-01-2007, 10:27 PM#8
Anopob
Say a unit runs out of mana. When do you want manashield to turn back on (how much mana)?
10-01-2007, 10:31 PM#9
cohadar
It is passive mana-shield, it does not turn off,
while it has mana it soaks damage,
when you run out of mana you get your ass kicked, simple as that.
10-01-2007, 10:31 PM#10
Here-b-Trollz
The fact is that the event of a unit taking damage occurs just before the unit actually takes damage. To prevent death of uberness, you add a +80,000 health ability to the unit, start a 0. duration timer, and, in the callback, remove the ability and set the unit's life to where it should be.
10-01-2007, 10:35 PM#11
cohadar
Quote:
Originally Posted by Here-b-Trollz
The fact is that the event of a unit taking damage occurs just before the unit actually takes damage. To prevent death of uberness, you add a +80,000 health ability to the unit, start a 0. duration timer, and, in the callback, remove the ability and set the unit's life to where it should be.

Is this true? I didn't know this.
Can someone confirm it please.
10-01-2007, 10:37 PM#12
Here-b-Trollz
Can you use the search tool?

EDIT: I confirm it.

It is the same reason that people such as Rising_Dusk can make passives which add 1 strength point when the hero takes damage. Thus, it is impossible to kill the hero with the passive using an attack which does less damage than the health the strength point adds.

Or it could be used for a mana shield.
10-01-2007, 10:47 PM#13
cohadar
Ok, I believe you.

Btw that passive ability of +1str on attack sounds bizzarely imbalanced.
10-01-2007, 11:05 PM#14
Here-b-Trollz
BTW it fades off after 6-10 seconds.


Anyway, you should negate 800 damage... if the unit with 100 hp has 1000 mana. Makes sense, right?
10-01-2007, 11:44 PM#15
moyack
Quote:
Originally Posted by cohadar
I already have OnDamage system in the map but I would like to hear about this triggering you are talking about...
I was thinking in something like this:

Collapse JASS:
scope ManaShieldPassive

globals
    private constant integer SpellID     = 'A000' // Spell ability
endglobals

private constant function Absorb takes integer level returns real
    return 1. + 1. * (level - 1) // indicates how much mana is absorbed when the unit is attacked
endfunction

private function IsDamaged takes nothing returns nothing
    local unit c = GetTriggerUnit()
    local real dam = GetEventDamage()
    local real abs = dam / Absorb(GetUnitAbilityLevel(c, SpellID))
    if GetUnitState(c, UNIT_STATE_MANA) > 0. and GetUnitState(c, UNIT_STATE_MANA) >= abs then
        call SetWidgetLife(c, GetWidgetLife(c) + dam)
        call SetUnitState(c, UNIT_STATE_MANA, GetUnitState(c, UNIT_STATE_MANA) - abs)
    endif
    set c = null
endfunction


public function Conditions takes nothing returns boolean
    return GetLearnedSkill() == SpellID and GetUnitAbilityLevel(GetTriggerUnit(), SpellID) == 1
endfunction

public function Actions takes nothing returns nothing
    local unit c = GetTriggerUnit()
    local trigger t = CreateTrigger()
    call TriggerRegisterUnitEvent(t, c, EVENT_UNIT_DAMAGED)
    call TriggerAddAction(t, function IsDamaged)
    set c = null
    set t = null
    set tm = null
endfunction

//===========================================================================
function InitTrig_FranticAttack takes nothing returns nothing
    set gg_trg_ManaShieldPassive = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_ManaShieldPassive, EVENT_PLAYER_HERO_SKILL )
    call TriggerAddCondition( gg_trg_ManaShieldPassive, Condition( function Conditions ) )
    call TriggerAddAction( gg_trg_ManaShieldPassive, function Actions )
endfunction

endscope
Just add the FX you need and that's all.