• 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.

Two issues with abilities/triggers

Status
Not open for further replies.
Level 3
Joined
Apr 1, 2009
Messages
30
Alright, I have two issues I was hoping to get help with.

Issue 1: So I have two heroes, each with a different set of abilities (one is melee, one is ranged). One hero transforms into the other using the Bear Form ability.

Thats how I'd LIKE it to be, however I cant make it work properly. Lets say Hero 1 has Firebolt level 2, and when the hero transforms into Hero 2 it gets Critical Strike level 2 (and loses Firebolt). When Hero 2 changes back to Hero 1, its reversed. And if Hero 1 levels up Firebolt to level 3 (or Hero 2 levels up Critical Strike to level 3) the corresponding ability is also leveled up.

Issue 2: A hero uses Blink, and surrounding enemy units take damage. Simple as that. Well, for you, atleast.

Im absolutely rubbish at triggers and (especially) variables (they make absolutely NO sense to me even after reading tons of guides) so I simply cant do it myself before I get wrinkles, gray hair and a shriveled... uuh... elbow. Can someone help?
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
Alright, I have two issues I was hoping to get help with.

Issue 1: So I have two heroes, each with a different set of abilities (one is melee, one is ranged). One hero transforms into the other using the Bear Form ability.

Thats how I'd LIKE it to be, however I cant make it work properly. Lets say Hero 1 has Firebolt level 2, and when the hero transforms into Hero 2 it gets Critical Strike level 2 (and loses Firebolt). When Hero 2 changes back to Hero 1, its reversed. And if Hero 1 levels up Firebolt to level 3 (or Hero 2 levels up Critical Strike to level 3) the corresponding ability is also leveled up.

Issue 2: A hero uses Blink, and surrounding enemy units take damage. Simple as that. Well, for you, atleast.

Im absolutely rubbish at triggers and (especially) variables (they make absolutely NO sense to me even after reading tons of guides) so I simply cant do it myself before I get wrinkles, gray hair and a shriveled... uuh... elbow. Can someone help?

i think better if u give all ability to both of ur hero and just enable and disable them same with transform skill.(i use metamorph and disable in map init when i want use then enable/order metamorph and disable and sameway i transform back, and u can check allways if u are ranged or no if u check the unit type)

u could add lets say both 5 melee/5ranged skill, if ur unit type is melee hero then disable all melee skills and enable all ranged skills after transform, if ur unit type is ranged then invers.

(1 think, for me sometimes unit die if i transform and another hero dont got same abilities :p this is why i like the disable/enable methode. also disabled ability dont take place, not visible.)

in my example i use when my weapon is bow (if weapon is 900-950 then its bow) just u add your disble firebolt/enable critical stuff

  • *plNR=triggering player number*
  • *attachment_unit=my hero
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Weapon[plNR] Greater than or equal to 900
      • Weapon[plNR] Less than 950
    • Then - Actions
      • Player - Enable Transform Villager for (Player(plNR))
      • Unit - Order Attachment_Unit to Night Elf Demon Hunter - Metamorphosis
      • Player - Disable Transform Villager for (Player(plNR))
    • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of Attachment_Unit) Equal to Hero Archer
        • Then - Actions
          • Player - Enable Transform Villager for (Player(plNR))
          • Unit - Order Attachment_Unit to Night Elf Demon Hunter - Metamorphosis
          • Player - Disable Transform Villager for (Player(plNR))
        • Else - Actions
 
Level 3
Joined
Apr 1, 2009
Messages
30
To be honest, I dont quite understand what you mean, and you might have misunderstood me... if its me being slow, I apologize, but from my experience, you cant add more than 5 hero abilities to a hero, right?
Also that trigger makes absolutely no sense to me (told you Im rubbish at this)
 
Level 8
Joined
Jan 8, 2010
Messages
493
1. check the map in this post i made about a hero changing into another hero, both with different sets of skills.

2. for the Blink, are the units that take damage before or after the hero Blinks?
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Blink
  • Actions
    • --this wait is for the "after" Blinking--
    • --remove it if it is before--
    • Wait 0.33 seconds
    • Set Point = (Position of (Triggering unit))
    • Custom Script: set bj_wantDestroyGroup=true
    • Unit Group - Pick every unit within 400 of Point and do Actions
      • Unit - Make (Triggering unit) damage (Picked unit) dealing 400 damage of type Normal
    • Custom script: call RemoveLocation(udg_Point)
that trigger is what i used in a Blinking-type spell. the wait is because the default Blink has a 0.33 second before the unit moves. and i have removed the sample leaks you will most probably encounter in the trigger.

but if you want a really accurate one, base your Blink spell on Channel. and use this trigger:
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to BlinkThatIsBasedOnChannel
  • Actions
    • --if you will damage that units before blinking--
    • --set the variable Point BEFORE THE MOVE Action--
    • --else, set it AFTER--
    • Set Point = (Position of (Triggering unit))
    • Set Point2 = (Target point of (Ability being cast))
    • Unit - Move (Triggering unit) to Point2
    • Custom Script: set bj_wantDestroyGroup=true
    • Unit Group - Pick every unit within 400 of Point and do Actions
      • Unit - Make (Triggering unit) damage (Picked unit) dealing 400 damage of type Normal
    • Custom script: call RemoveLocation(udg_Point)
    • Custom script: call RemoveLocation(udg_Point2)
you can add special effects for a good Blink effect.
 
Level 3
Joined
Apr 1, 2009
Messages
30
Hmm, the blink ability works, but it also damages friendly units... Im sure its an easy fix and that I will facepalm afterwards, but can you help with that? And the link for the map says its expired or deleted, would you care to resend it?
 
Level 11
Joined
Nov 15, 2007
Messages
800
Hmm, the blink ability works, but it also damages friendly units... Im sure its an easy fix and that I will facepalm afterwards, but can you help with that? And the link for the map says its expired or deleted, would you care to resend it?

Rather than using "Pick every unit in range", use "Pick every unit in range matching condition", then set your condition to "Unit belongs to an ally of (Owner of unit (event response - triggering unit)) = False" if you want it to damage neutral units, otherwise "Unit belongs to an enemy of (Owner of unit (event response - triggering unit)) = True" if you only want it to damage enemies, and not neutral targets.

There are a lot of other conditions you'll want to do for more advanced triggered spells, but that one condition should be enough for what you want to do. Damage type - magic damage already ensures it won't damage magic immune units, etc.

edit: For your hero ability, it sounds like you want to learn abilities on both hero-forms separately, correct?

I think the only way to do this is either:

1) Use triggers to unlearn all of the hero's abilities whenever it transforms.
Or
2) Save the stats, items, level and ability levels of both heroes to variables, remove the hero from the game when it transforms and replace it with the alternate form.

The second is, obviously, a lot more daunting to code with triggers, but the first solution would require you to re-learn all of your abilities whenever you transform, which can be annoying for the player.
 
Level 3
Joined
Apr 1, 2009
Messages
30
Save the stats, items, level and ability levels of both heroes to variables, remove the hero from the game when it transforms and replace it with the alternate form.

Sounds good, but how exactly do I do that? Ive been dabbling a bit with triggers and variables but they confuse the heck out of me. Im getting better with triggers, but Im still new to this AND English is not my mothertongue, so I dont understand a lot of the variables and how they function.

Tried finding some proper noob guides for triggers and variables, but they dont tell me in detail what all the stuff (like arrays, integer or whatever) means. I would be grateful for eternity if anyone could be bothered to teach me a little or link a decent tutorial.
 
Last edited:
Level 8
Joined
Jan 8, 2010
Messages
493
oh oops. sorry. here's the link:
Changing Heroes

there are some explanations in the triggers used for that changing heroes map. and it uses the Hero Passive Transformation technique using Bear Form (is that what you use?)

anyway, variables are just storage places for a certain data. most often you will encounter variables using Integers (whole numbers), Real (numbers with decimals), Boolean (either True or False) and String (characters/letters/symbols). other variables are self-explanatory, like Unit, Unit Group, Item, Dialog, etc.

an array is a variable that can save more than 1 data. just imagine a variable as a closet, and the arrays are the different drawers in it. although of course, since it is only from one closet (variable), you can only save the same type of data in the drawers (arrays) :p
 
Level 8
Joined
Jan 8, 2010
Messages
493
that was what i did in the sample map i provided. whenever the hero learns a skill (which in in the map was just a dummy invisible Channel-based skill), the level of the learned skill is saved in a variable (SkillLevel) then the true skill (Paladin/Blood Mage Skill) is added to the Hero. whenever he transforms, the skill is automatically removed because of Bear Form, so the transformed mode's skill is added and level is set via the value in SkillLevel.
 
Level 3
Joined
Apr 1, 2009
Messages
30
Alright, the trigger you made worked perfectly to chance one ability into another, thats awesome. However Im having some problems when I try to do the same thing with several abilities, the hero learns all the skills when I try to transform, wont really transform and if I attempt to transform more the hero is stuck and cant do anything. Halp!
(Apologize for asking so many questions you probably know so well, but you are helping a ton :p)

Edit: Want me to link my triggers? If so (you guessed it) how?
 
Level 8
Joined
Jan 8, 2010
Messages
493
yup, the testmap is for only one ability. i.. guess i didn't note in it what to do for more abilities..? sorry XD

anyway. for additional abilities, you will need these:
1. an additional variable for saving the ability's level (eg. SkillLevel_1, SkillLevel_2,etc. or make SkillLevel an array and setting SkillLevel[0] to the unit's first skill, SkillLevel[1] to the second skill, etc)
2. an additional dummy Skill (you can create copies of Dummy Skill. just make sure to change the icon location)
3. an additional trigger for those additional skills (you can copy the Learn Skill trigger)
4. edit the skill adding part in Transform trigger

the thing with the method in my map is, unless i understand doing hashtables, i have trouble making it MUI (unless creating many variables is an option, especially SkillLevel).. at most i can make it MPI.

EDIT:
you can post triggers using [ TRIGGER ] tabs. or check this tutorial.
 
Level 7
Joined
Sep 9, 2007
Messages
253
Issue 1: So I have two heroes, each with a different set of abilities (one is melee, one is ranged). One hero transforms into the other using the Bear Form ability.

I have recently overcome this issue myself, I will provide my trigger below and explain them at the end. Please note that I am not the most experienced mapper so this method may be buggy but so far I have had no problems with it. My triggers dont switch abilities but rather save the same ability but you can still see the idea.

  • Druid Bear Form
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Unit-type of (Casting unit)) Equal to Druid
      • (Ability being cast) Equal to D Bear Tank
    • Actions
      • Wait until ((Unit-type of (Casting unit)) Not equal to Druid), checking every 0.50 seconds
      • Unit - Add DruidAbilities[1] to (Casting unit)
      • Unit - Add DruidAbilities[2] to (Casting unit)
      • Unit - Add DruidAbilities[3] to (Casting unit)
      • Unit - Add DruidAbilities[4] to (Casting unit)
      • Unit - Set level of DruidAbilities[1] for (Casting unit) to DruidAbilityLevel[1]
      • Unit - Set level of DruidAbilities[2] for (Casting unit) to DruidAbilityLevel[2]
      • Unit - Set level of DruidAbilities[3] for (Casting unit) to DruidAbilityLevel[3]
      • Unit - Set level of DruidAbilities[4] for (Casting unit) to DruidAbilityLevel[4]
  • Druid Night Elf Form
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Casting unit)) Equal to Druid (Bear Form 1)
          • (Unit-type of (Casting unit)) Equal to Druid (Bear Form 2)
          • (Unit-type of (Casting unit)) Equal to Druid (Bear Form 3)
          • (Unit-type of (Casting unit)) Equal to Druid (Bear Form 4)
      • (Ability being cast) Equal to D Bear Tank
    • Actions
      • Wait until ((Unit-type of (Casting unit)) Equal to Druid), checking every 0.50 seconds
      • Unit - Add DruidAbilities[2] to (Casting unit)
      • Unit - Add DruidAbilities[1] to (Casting unit)
      • Unit - Add DruidAbilities[3] to (Casting unit)
      • Unit - Add DruidAbilities[4] to (Casting unit)
      • Unit - Set level of DruidAbilities[2] for (Casting unit) to DruidAbilityLevel[2]
      • Unit - Set level of DruidAbilities[1] for (Casting unit) to DruidAbilityLevel[1]
      • Unit - Set level of DruidAbilities[3] for (Casting unit) to DruidAbilityLevel[3]
      • Unit - Set level of DruidAbilities[4] for (Casting unit) to DruidAbilityLevel[4]
You will also need triggers to set the variables to the appropriate values. I am working on a test map for you at the moment.
 
Level 7
Joined
Sep 9, 2007
Messages
253
Here is a test map, The triggers are very rough and inefficient so I'm betting you can refine them. What do you think?

Edit: Fantastic, I will have to implement that passive transformation into my map. Thank you ronojales. sorry I can't +rep you again so soon.
 

Attachments

  • testmap1.w3x
    22.8 KB · Views: 41
Level 11
Joined
Nov 15, 2007
Messages
800
I have recently overcome this issue myself, I will provide my trigger below and explain them at the end. Please note that I am not the most experienced mapper so this method may be buggy but so far I have had no problems with it. My triggers dont switch abilities but rather save the same ability but you can still see the idea.

  • Druid Bear Form
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Unit-type of (Casting unit)) Equal to Druid
      • (Ability being cast) Equal to D Bear Tank
    • Actions
      • Wait until ((Unit-type of (Casting unit)) Not equal to Druid), checking every 0.50 seconds
      • Unit - Add DruidAbilities[1] to (Casting unit)
      • Unit - Add DruidAbilities[2] to (Casting unit)
      • Unit - Add DruidAbilities[3] to (Casting unit)
      • Unit - Add DruidAbilities[4] to (Casting unit)
      • Unit - Set level of DruidAbilities[1] for (Casting unit) to DruidAbilityLevel[1]
      • Unit - Set level of DruidAbilities[2] for (Casting unit) to DruidAbilityLevel[2]
      • Unit - Set level of DruidAbilities[3] for (Casting unit) to DruidAbilityLevel[3]
      • Unit - Set level of DruidAbilities[4] for (Casting unit) to DruidAbilityLevel[4]
  • Druid Night Elf Form
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Casting unit)) Equal to Druid (Bear Form 1)
          • (Unit-type of (Casting unit)) Equal to Druid (Bear Form 2)
          • (Unit-type of (Casting unit)) Equal to Druid (Bear Form 3)
          • (Unit-type of (Casting unit)) Equal to Druid (Bear Form 4)
      • (Ability being cast) Equal to D Bear Tank
    • Actions
      • Wait until ((Unit-type of (Casting unit)) Equal to Druid), checking every 0.50 seconds
      • Unit - Add DruidAbilities[2] to (Casting unit)
      • Unit - Add DruidAbilities[1] to (Casting unit)
      • Unit - Add DruidAbilities[3] to (Casting unit)
      • Unit - Add DruidAbilities[4] to (Casting unit)
      • Unit - Set level of DruidAbilities[2] for (Casting unit) to DruidAbilityLevel[2]
      • Unit - Set level of DruidAbilities[1] for (Casting unit) to DruidAbilityLevel[1]
      • Unit - Set level of DruidAbilities[3] for (Casting unit) to DruidAbilityLevel[3]
      • Unit - Set level of DruidAbilities[4] for (Casting unit) to DruidAbilityLevel[4]
You will also need triggers to set the variables to the appropriate values. I am working on a test map for you at the moment.

Always use "Triggering Unit" instead of "Casting Unit/Dying Unit/Attacked Unit/any other event response that can refer instead to Triggering Unit" - especially if you're using a wait.

Also, that transformation method ronojales posted is quite ingenious. It's funny how long TFT's map editor has existed and people are still discovering relatively simple tricks like that which save a lot of time.
 
Level 10
Joined
Mar 19, 2010
Messages
622
but if you want a really accurate one, base your Blink spell on Channel. and use this trigger:
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to BlinkThatIsBasedOnChannel
  • Actions
    • --if you will damage that units before blinking--
    • --set the variable Point BEFORE THE MOVE Action--
    • --else, set it AFTER--
    • Set Point = (Position of (Triggering unit))
    • Set Point2 = (Target point of (Ability being cast))
    • Unit - Move (Triggering unit) to Point2
    • Custom Script: set bj_wantDestroyGroup=true
    • Unit Group - Pick every unit within 400 of Point and do Actions
      • Unit - Make (Triggering unit) damage (Picked unit) dealing 400 damage of type Normal
    • Custom script: call RemoveLocation(udg_Point)
    • Custom script: call RemoveLocation(udg_Point2)
you can add special effects for a good Blink effect.

This will work but instead of editing the original blink spell, simply do this.
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Blink
  • Actions
    • Set Point = (Target point of (Ability being cast))
    • Custom Script: set bj_wantDestroyGroup=true
    • Unit Group - Pick every unit within 400 of Point and do Actions
      • Unit - Make (Triggering unit) damage (Picked unit) dealing 400 damage of type Normal
    • Custom script: call RemoveLocation(udg_Point)
 
Status
Not open for further replies.
Top