HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Blocking/Unblocking Spell

06-18-2006, 05:20 AM#1
Jarock
This is what I want to do exactly.

-When I cast an ability(Block)

-My hero can not get hurt when attacked from front, and I want to also not be able to attack when blocking.


Then I want to remove that ability when casted then add another ability that will turn off the block move. How will I do all this?
06-18-2006, 06:02 AM#2
PipeDream
The usual way to solve this is to trigger unit is damaged with an appropriate refund based on direction. To stop attacking you can issue stop or move orders when the unit tries to attack. The latter can probably also be accomplished with orbs. Give it a shot, if you get stuck, we can take a look.
06-18-2006, 06:51 AM#3
Jacek
But, if you get hit by some lethal strike like 1500 dmg or something, you won't heal in time.
06-18-2006, 07:11 AM#4
blu_da_noob
If the damage is greater than your hp, then you have a backup ability which adds lots of extra hp temporarily so you can survive and then refund in the callback of a 0 duration timer.
06-18-2006, 05:01 PM#5
Jarock
I don't think the damage source works, because I used a trigger like this and I still didn't gain life.

Trigger:
Damage Source
Collapse Events
Unit - A unit Begins casting an ability
Collapse Conditions
(Owner of (Casting unit)) Equal to Player 1 (Red)
(Ability being cast) Equal to Defend
Collapse Actions
Trigger - Turn on Damage SourceOn <gen>
Trigger - Turn on No Attack <gen>

Damage SourceOn is the trigger for getting life back.
Trigger:
Damage SourceOn
Collapse Events
Unit - General 0106 <gen> Takes damage
Conditions
Collapse Actions
Unit - Set life of General 0106 <gen> to ((Life of General 0106 <gen>) + (Damage taken))

And I was also able to attack too.

Trigger:
No Attack
Collapse Events
Unit - General 0106 <gen> Acquires a target
Conditions
Collapse Actions
Unit - Order General 0106 <gen> to Stop

What am I doing wrong?
06-18-2006, 08:42 PM#6
StockBreak
Quote:
Originally Posted by Jarock
I don't think the damage source works, because I used a trigger like this and I still didn't gain life.
It is better to use a 0 duration timer started in the "unit takes damage" trigger and then add the damage taken as life in a "timer expires" trigger, else the unit doesn't get healed properly (in example if the unit has FULL HP and you damage it, with such trigger it doesn't get healed).
06-19-2006, 12:56 AM#7
Jarock
Ok I have figured some things out, but my footman keeps waving around his sword and he is able to attack sometimes. I was sitting there waving my sword around then my footman put damage on the enemy. So I don't want that. Is there a better way to disable attack?
06-19-2006, 10:12 AM#8
blu_da_noob
Collapse JASS:
call UnitAddAbility(unit,'Abun')
06-19-2006, 11:26 AM#9
Siphonized
"Unit Takes damage"

Does that Event exist? :o
06-19-2006, 12:59 PM#10
blu_da_noob
Yes, but only as a specific unit event.