HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

A custom heal & damage ability problem

08-13-2007, 10:48 PM#1
i-dont-mass-lings
Hi, I'm new here and I'm starting my first Map. I am attempting to create two abilities for a hero of mine. The first is supposed to damage the target based on the percent health that target is already at, so here is the code. It makes sense to me.
Events
Unit - A unit Begins casting an ability
Conditions
(Ability being cast) Equal to Heaven's Wrath (Archimonde)
Actions
Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (200.00 / (Percentage life of (Target unit of ability being cast))) damage of attack type Hero and damage type Normal

The other ability is supposed to be an aoe heal that heals all allied units based on the amount of allied units in the area
Events
Unit - A unit Begins casting an ability
Conditions
(Ability being cast) Equal to Allied Perseverance
Actions
Unit Group - Pick every unit in (Units in (Playable map area) matching (((Player 1 (Red) controller) Equal to ((Owner of (Picked unit)) controller)) or (((Player 2 (Blue) controller) Equal to ((Owner of (Picked unit)) controller)) or ((Player 3 (Teal) controller) Equal to ((Owner of (Picked and do (Actions)
Loop - Actions
Unit Group - Add all units of (Units of type (Unit-type of (Picked unit))) to (Last created unit group)
Set Units = ((Number of units in (Last created unit group)) x 10)
Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + (Real(Units)))
Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + (Real(Units)))

I'd like to thank anyone who takes the time to look at this because it is really bugging me ><"
08-17-2007, 11:04 PM#2
The Elite
Quote:
Originally Posted by i-dont-mass-lings
Hi, I'm new here and I'm starting my first Map. I am attempting to create two abilities for a hero of mine. The first is supposed to damage the target based on the percent health that target is already at, so here is the code. It makes sense to me.
Events
Unit - A unit Begins casting an ability
Conditions
(Ability being cast) Equal to Heaven's Wrath (Archimonde)
Actions
Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (200.00 / (Percentage life of (Target unit of ability being cast))) damage of attack type Hero and damage type Normal
Trigger:
Your Spell
Collapse Events
Unit - A unit Begins casting an ability
Collapse Conditions
(Ability being cast) Equal to Heaven's Wrath (Archimonde)
Collapse Actions
Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (200.00 / (Life of (Target unit of ability being cast))) damage of attack type Hero and damage type Normal

In Unit - Cause Damage, you have made TRIGGERING UNIT damage another unit, triggering unit will not work for abilities, use casting unit instead
and, this will not stuff up your ability but don't use Unit - A unit Begins casting an ability, use Unit - A unit Starts the effect of an ability
Quote:
The other ability is supposed to be an aoe heal that heals all allied units based on the amount of allied units in the area
Events
Unit - A unit Begins casting an ability
Conditions
(Ability being cast) Equal to Allied Perseverance
Actions
Unit Group - Pick every unit in (Units in (Playable map area) matching (((Player 1 (Red) controller) Equal to ((Owner of (Picked unit)) controller)) or (((Player 2 (Blue) controller) Equal to ((Owner of (Picked unit)) controller)) or ((Player 3 (Teal) controller) Equal to ((Owner of (Picked and do (Actions)
Loop - Actions
Unit Group - Add all units of (Units of type (Unit-type of (Picked unit))) to (Last created unit group)
Set Units = ((Number of units in (Last created unit group)) x 10)
Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + (Real(Units)))
Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + (Real(Units)))
Trigger:
Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) x 10.00)
that line should be
Trigger:
Unit - Set life of (Casting unit) to ((Life of (Casting unit)) x 10.00)
There we go, i think it works now
08-17-2007, 11:59 PM#3
Ignitedstar
Wait a minute. I thought "Picked Unit" was only for Unit Groups? Unless I have been mistaken this entire time.

By the way, instead of the event "Unit - A unit Begins casting an ability", you should use the event "Unit - A unit Begins the effect of an ability" or something. I believe casting refers to what happens when the unit is going to cast a spell, not when the actual effects of the spell happens.
08-18-2007, 12:07 AM#4
The Elite
woops typed the wrong thing in the last trigger code( a typo ) *fixed*
08-19-2007, 10:45 AM#5
Nenner
Quote:
Originally Posted by i-dont-mass-lings
The other ability is supposed to be an aoe heal that heals all allied units based on the amount of allied units in the area
Trigger:
Collapse Events
Unit - A unit Begins casting an ability
Collapse Conditions
(Ability being cast) Equal to Allied Perseverance
Collapse Actions
Collapse Unit Group - Pick every unit in (Units in (Playable map area) matching (((Player 1 (Red) controller) Equal to ((Owner of (Picked unit)) controller)) or (((Player 2 (Blue) controller) Equal to ((Owner of (Picked unit)) controller)) or ((Player 3 (Teal) controller) Equal to ((Owner of (Picked and do (Actions)
Collapse Loop - Actions
Unit Group - Add all units of (Units of type (Unit-type of (Picked unit))) to (Last created unit group)
Set Units = ((Number of units in (Last created unit group)) x 10)
Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + (Real(Units)))
Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + (Real(Units)))

I'd like to thank anyone who takes the time to look at this because it is really bugging me ><"

Trigger:
Your Trigger
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Allied Perseverence
Collapse Actions
Set Temp_Point = (Position of (Triggering unit))
Set Temp_Group = (Units within 512.00 of Temp_Point matching ((((Matching unit) belongs to an ally of (Owner of (Triggering unit))) Equal to True) and (((Matching unit) is alive) Equal to True)))
Set Number = (Number of units in Temp_Group)
Collapse Unit Group - Pick every unit in Temp_Group and do (Actions)
Collapse Loop - Actions
Unit - Cause (Triggering unit) to damage (Picked unit), dealing (-10.00 x (Real(Number))) damage of attack type Spells and damage type Normal
Custom script: call RemoveLocation (udg_Temp_Point)
Custom script: call DestroyGroup (udg_Temp_Group)

This should work...
08-19-2007, 12:30 PM#6
Pyrogasm
Nenner is the only one who got it right.

Triggering Unit > Casting Unit in every possible situation. Triggering Unit works through waits while Casting Unit and many other event responses don't.
08-22-2007, 02:10 AM#7
i-dont-mass-lings
Thanks alot for the help, really appreciate it. So I'll check out that healing ability, but I was able to fix the percent damage ability. I was working based on the assumption that when it said percent life that it meant say 75% and took it as .75. So I had to divide the total by 100 to get the dmg to work the way i wanted.
08-22-2007, 02:48 AM#8
darkwulfv
To tell you now, fetch a tutorial on GUI memory leaks, since your original trigger had some.

Also, use trigger tags ([trigger][/ trigger] <-- no space) next time.

And welcome to wc3campaigns!