• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Trigger Issue

Status
Not open for further replies.
Level 2
Joined
Apr 23, 2013
Messages
12
Hello everyone, I'm making a custom map, with custom heroes and abilities, and today I came across a problem with a trigger:

I'm creating a spell that damages an enemy unit, and also heals every friendly units in 500 AoE from the target of the spell for the same amount of damage dealt.

For the single target damage I used chain lightning, removing bounces and animations, then I was thinking for the trigger something like this:

Event : A unit cast a spell
Cond : Spell equal to "myspell"
Actions : Pick every unit |in range X| from |target unit of ability being cast| matching |conditions| and do actions

For the conditions I can't understand how to set: "units that belong to an ally of owner of casting unit"

Can someone explain me how to do a similar thing?

And also, after I set this condition, what is the action I should trigger to heal the picked units for the equal damage dealt to the enemy?

Thank you.
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
Well, you will need to learn what variables are :)
Look at this topic: http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/variables-5896/ to get a basic idea.

For the amount of heal, you will want to first calculate what damage/heal you do.
If level 1 deals 150 damage and each additional level deals 75 more damage, the calculation would be 75+ (spell_level * 75). So if you had level 1, it would be "75 + (1*75) = 150"

The healing effect should be done like this
  • Triggers
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Your_Spell
    • Actions
      • Set HealAmount = (75.00 + ((Real((Level of Your_Spell for (Triggering unit)))) x 75.00))
      • Set TempPoint = (Position of (Target unit of ability being cast))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 500.00 of TempPoint matching (((Matching unit) belongs to an ally of (Owner of (Triggering unit))) Equal to True)) and do (Actions)
        • Loop - Actions
          • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + HealAmount)
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Custom script: set udg_TempPoint = null
Things to know:
HealAmount is a "real" variable
Change values in the HealAmount so it's same like what damage your spell does
in the HealAmount equation there is this part "(Real((Level of Your_Spell for (Triggering unit)))" - ability levels are defined as integers, so to use this number, you need to use "Conver integer to real" function.

TempPoint is a "point" variable. You need to save the position of the target into this variable, so you can remove it at the end of the trigger to prevent memory leaks (too many memory leaks make your map laggy and in worst case may cause crash)

in the unit group you use "Pick every unit in *location*) and as *location* you set "Units in range matching condition".

The three lines:
Custom script: set bj_wantDestroyGroup = true
Custom script: call RemoveLocation(udg_TempPoint)
Custom script: set udg_TempPoint = null

prevent memory leaks. Be sure that the 2nd and 3rd custom scripts have exact name just like the point variable you use (I use TempPoint variable here, so in the custom script I write TempPoint as well. If I named TempPoint as SpellLoc, then both custom scripts would have SpellLoc as well)
 
Level 2
Joined
Apr 23, 2013
Messages
12
Ah! I knew what variables are, I use them often, I didn't thought about using them in this way here though. Thanks for your help, this should work all fine! ^_^
 
Level 2
Joined
Apr 23, 2013
Messages
12
Ugh, wait, I can't find: "(Real((Level of Your_Spell for (Triggering unit)))"
Where do I find the "level of a spell" value, to set a real number?
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
Well, the complete formula looks like this:
HealAmount = Arithmetic( A + [ Arithmetic{B x C} ] )
A is 75
B is "Convert Integer to Real"
C is 75

Once you select the option Convert Integer to Real, slide down in the new menu and find "Unit - Level of Ability for unit"
 
Status
Not open for further replies.
Top