| 10-05-2007, 10:50 AM | #1 |
I made a spell based on thorn aura that gives nearby ally units Evasion bonus but sometime's it starts to heal the unit more than tha Damage taken can some one tell me whats the problem with this spell?Thanks in advance. JASS://==================================Evasion=Trigger====================================== function Evade_Evasion_Aura_Conditions takes nothing returns boolean return (GetRandomInt(1,100)<10*GetUnitAbilityLevel(GetTriggerUnit(),'B000')) endfunction function Evade_Evasion_Aura takes nothing returns nothing call SetUnitState(GetTriggerUnit(),UNIT_STATE_LIFE,GetUnitState(GetTriggerUnit(),UNIT_STATE_LIFE)+GetEventDamage()) call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Orc\\MirrorImage\\MirrorImageCaster.mdl",GetTriggerUnit(),"origin")) call DestroyTrigger(GetTriggeringTrigger()) endfunction //==============================End=of=Evasion=Trigger=================================== function Trig_Evasion_Aura_Conditions takes nothing returns boolean return (GetUnitAbilityLevel(GetTriggerUnit(), 'B000') > 0) endfunction function Trig_Evasion_Aura_Actions takes nothing returns nothing local trigger tr=CreateTrigger() call TriggerRegisterUnitEvent(tr,GetTriggerUnit(),EVENT_UNIT_DAMAGED) call TriggerAddCondition(tr,Condition(function Evade_Evasion_Aura_Conditions)) call TriggerAddAction(tr,function Evade_Evasion_Aura) endfunction //=========================================================================== function InitTrig_Evasion_Aura takes nothing returns nothing local trigger Evasion_Aura = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( Evasion_Aura, EVENT_PLAYER_UNIT_ATTACKED ) call TriggerAddCondition( Evasion_Aura, Condition( function Trig_Evasion_Aura_Conditions ) ) call TriggerAddAction( Evasion_Aura, function Trig_Evasion_Aura_Actions ) endfunction |
| 10-05-2007, 12:46 PM | #2 |
You should seriously just add the evasion ability to affected units, worried about the icon taking space? Just use the spellbook trick : (add spellbook that has the custom evasion, then disable spell book for that player) |
| 10-05-2007, 01:02 PM | #3 |
and this should be in Triggers And Scripts /sleep |
| 10-05-2007, 03:55 PM | #4 | |
Quote:
Thats a good Idea but I want my Pseudo evasion Stack with evasion ability Second i tryed adding evasion once but it was laggy, third: how I remove evasion when unit looses the aura without loss of multi instanceability? and what do you mean disabling spell book? |
| 10-05-2007, 04:11 PM | #5 | |
Quote:
I am not sure why removing the damage event and all that giberrish in MUI would be easier than removing an ability. If it was laggy you possibly did something wrong. If you want it to stack with evasion, you can do it by increasing the level of evasion. |
| 10-05-2007, 04:21 PM | #6 |
So there is no way to make it without using evasion ability?(I know they did it in some maps) what do you mean disabling spell book? I didn't know that it is possible to remove Events :D |
| 10-05-2007, 07:48 PM | #7 |
Disabling a spell book is like this: First you make a custom spell based off of Spellbook (it's under Items I believe), add your evasion spell in it, then go to triggers and whenever your event triggers, do "Player - Disable (SPELL = SPELLBOOK) for X Player". |
| 10-06-2007, 01:14 AM | #8 | ||
Quote:
An example: Quote:
What happens here is that EVENT_UNIT_DAMAGE triggers before the unit's life is subtracted. So, you need a timer. There are several topics regarding damage blocking out there, try a search, if this site's search doesn't work correctly use google and add site:wc3campaigns.net to the search query... |
| 10-06-2007, 12:43 PM | #9 | |
Quote:
anyway if it triggers before damage is subtracted how much takes till the hp get subtracted so i can use a timer or tiggersleepaction? Btw I will do search ![]() |
| 10-07-2007, 08:04 AM | #10 |
The problem Vexorian is talking about is that if a unit takes enough damage to kill it (no matter how much you give it in that trigger), the unit will always die. Take the following example
|
| 10-07-2007, 01:33 PM | #11 |
That's only one of the problems, but a more realistic one is the one his code is dealing with right now, that damage is done after the event, so if the unit had full hp, he wouldn't be able to block the damage without the timer. |
