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

[Solved] Switch units upon ability - need help w/ trigger

Status
Not open for further replies.
Level 7
Joined
May 15, 2009
Messages
192
I have tried to create a trigger that, when you activate an ability, switches the hero for another one. That hero will then be able to switch back. I want to retain the levels of the abilities that each hero has learned, for starters I just used a Death Knight and a Paladin.

I have two problems, first of all the unit group doesn't seem to work. And second of all, the levels of the abilities are never applied.

  • Shift On
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Side Shift Channel (DK)
    • Actions
      • Set Spell1_Level = (Level of Holy Light for (Triggering unit))
      • Set Spell2_Level = (Level of Divine Shield for (Triggering unit))
      • Set Spell3_Level = (Level of Devotion Aura for (Triggering unit))
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Death Knight)) and do (Actions)
        • Loop - Actions
          • Unit - Set level of Death Coil for (Picked unit) to Spell1_Level
          • Unit - Set level of Death Pact for (Picked unit) to Spell2_Level
          • Unit - Set level of Unholy Aura for (Picked unit) to Spell3_Level
          • Unit - Change ownership of (Picked unit) to Player 1 (Red) and Change color
          • Unit - Unhide (Picked unit)
          • Unit - Make (Picked unit) Vulnerable
      • Unit - Change ownership of (Triggering unit) to Neutral Passive and Change color
      • Unit - Make (Triggering unit) Invulnerable
      • Unit - Hide (Triggering unit)
(There is a similar trigger, but only with each field changed to fit the champion, this trigger is for when the Paladin switches to Death Knight)
Help appreciated
 
Level 7
Joined
May 15, 2009
Messages
192
why not add an ability based on bear form?? you will need no triggers

The problem with abilities like Bear Form and Metamorphosis on heroes is that hero abilities will be mimicked when you shift shape. If you added Metamorphosis to a Death Knight and a Paladin and made them shapeshift into eachother, they would retain the old abilites. I.E the Death Knight would have Holy Light, Divine Shield etc...
Same thing goes for Bear Form, crow form... etc.

In other news: Thx alot for the advice on the unit variables, it does complicate the map a bit, but it fixed my problem. Now, another one has arisen. I need the levels of the varying abilities to be mimicked, so that when the paladin raises the level of his Holy Light, the level of the Death Knights Death Coil will be raised by 1 level aswell. This level setting also requires that the paladin has learned the same spells as the Death Knight.

I made a trigger to check for the learning of an ability and it works alright for the Death Coil learning atleast, but the Divine Shield/death pact and Devotion/Unholy Aura don't quite the respond.
Here is my triggers for mimicking

The shapeshifting Trigger
  • Shift On
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Side Shift Channel (DK)
    • Actions
      • Unit - Hide Paladin
      • Unit - Move DK instantly to (Position of Paladin)
      • Unit - Make Paladin Invulnerable
      • Set Spell1_Level = (Level of Holy Light for Paladin)
      • Set Spell2_Level = (Level of Divine Shield for Paladin)
      • Set Spell3_Level = (Level of Devotion Aura for Paladin)
      • Unit - Change ownership of Paladin to Neutral Passive and Change color
      • Unit - Change ownership of DK to Player 1 (Red) and Change color
      • Hero - Set DK experience to (Hero experience of Paladin), Hide level-up graphics
      • Selection - Clear selection for (Owner of (Triggering unit))
      • Unit - Set level of Death Coil for DK to Spell1_Level
      • Unit - Set level of Death Pact for DK to Spell2_Level
      • Unit - Set level of Unholy Aura for DK to Spell3_Level
      • Unit - Unhide DK
      • Unit - Make DK Vulnerable
      • Selection - Add DK to selection for (Owner of (Triggering unit))
The trigger that allows the mimicking of abilites, "set level" won't work if the ability is not atleast level 1
  • Learning
    • Events
      • Unit - A unit Learns a skill
    • Conditions
    • Actions
      • -------- First Skill --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Learned Hero Skill) Equal to Death Coil
        • Then - Actions
          • Hero - Learn skill for Paladin: Holy Light
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Learned Hero Skill) Equal to Holy Light
            • Then - Actions
              • Hero - Learn skill for DK: Death Coil
            • Else - Actions
      • -------- Second Skill --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Learned Hero Skill) Equal to Death Pact
        • Then - Actions
          • Hero - Learn skill for Paladin: Divine Shield
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Learned Hero Skill) Equal to Divine Shield
            • Then - Actions
              • Hero - Learn skill for DK: Death Pact
            • Else - Actions
      • -------- Third Skill --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Learned Hero Skill) Equal to Unholy Aura
        • Then - Actions
          • Hero - Learn skill for Paladin: Devotion Aura
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Learned Hero Skill) Equal to Devotion Aura
            • Then - Actions
              • Hero - Learn skill for DK: Unholy Aura
            • Else - Actions
      • -------- Ultimate --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Learned Hero Skill) Equal to Side Shift Channel (DK)
        • Then - Actions
          • Hero - Learn skill for DK: Side Shift Channel (Pally)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Learned Hero Skill) Equal to Side Shift Channel (Pally)
            • Then - Actions
              • Hero - Learn skill for Paladin: Side Shift Channel (DK)
            • Else - Actions
To make sure that the other shape can actually have the skill points to learn the abilities.
  • Keep On Par
    • Events
      • Unit - A unit Gains a level
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Paladin
        • Then - Actions
          • Hero - Set DK Hero-level to (Level of Paladin), Hide level-up graphics
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Death Knight
        • Then - Actions
          • Hero - Set Paladin Hero-level to (Level of DK), Hide level-up graphics
        • Else - Actions
 
Level 7
Joined
May 15, 2009
Messages
192
This trigger keeps getting more and more strange.

Now I got the mimicking to work, except for the fact that the hero somehow ends up with minus skill points from changing shape (???) and also, when learning a spell the hero will somehow always try to put the ability to level 3, using as many skill points as possible.

For example, if you have 6 unused skill points and try to put Death Coil to level 1, it will jump to level 3 and take 3 skill points. If you have 1 skill point, and try to put Death Coil to level 1, it will take 1 skill points - but jump to level 3...

I am utterly confused, I am uploading the map here, so that people can get inside and take a look without me having to spam this thread with all the triggers.
 

Attachments

  • Test.w3x
    21.7 KB · Views: 44
Level 7
Joined
May 15, 2009
Messages
192
Oh, thx. Will try and do that. I thought it would be fixed by the trigger turn off. But much of this is also due to my misunderstanding the "Unit Learns an Ability" trigger, I thought it only ran once, when they learned level 1. But apparently it works everytime a skill point is used.


At school now so I can't fix the trigger right now, will update when I get home and fix it.
 
Level 7
Joined
Sep 9, 2007
Messages
253
The problem with abilities like Bear Form and Metamorphosis on heroes is that hero abilities will be mimicked when you shift shape. If you added Metamorphosis to a Death Knight and a Paladin and made them shapeshift into eachother, they would retain the old abilites. I.E the Death Knight would have Holy Light, Divine Shield etc...
Same thing goes for Bear Form, crow form... etc.

Yes but you are exchanging the abilities in your trigger so just do that but with a shapeshift ability.


I made a druid style hero with a shapeshift like the druid of the claw

  • Druid Bear Form
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to D Reverse Form (trigger)
      • (Unit-type of (Casting unit)) Equal to Druid
    • Actions
      • Set aaTempUnit = (Triggering unit)
      • Animation - Play aaTempUnit's spell animation
      • Special Effect - Create a special effect attached to the origin of aaTempUnit using Objects\Spawnmodels\NightElf\EntBirthTarget\EntBirthTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Wait until ((Unit-type of aaTempUnit) Not equal to Druid), checking every 0.10 seconds
      • -------- do your ability swapping here. --------
  • Druid Night Elf Form
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to D Reverse Form (trigger)
      • 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)
    • Actions
      • Set aaTempUnit = (Triggering unit)
      • Animation - Play aaTempUnit's spell animation
      • Special Effect - Create a special effect attached to the origin of aaTempUnit using Objects\Spawnmodels\NightElf\EntBirthTarget\EntBirthTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Wait until ((Unit-type of aaTempUnit) Equal to Druid), checking every 0.10 seconds
      • -------- do your ability swapping here. --------
So at the start of the actions on each trigger you would save your ability levels into an array. Then add the new ones and set them to the same levels as the old abilities.
 
Level 7
Joined
May 15, 2009
Messages
192
Well, I got my system working, after a bit of messing around, turning triggers on and off and so on. +rep for all the help.

(The fix for the near-infinite loop was to divide the the "learning" triggers into one for the Paladin leveling and one for the Death Knight leveling. Then, whenever you swtiched to Death Knight it would activate the triggers that responded to leveling of abilities such as Death Coil, and when you switched to Paladin it would turn off the Death Knight activated trigger, and turn on the Paladin version)

This thread can be closed now.
 
Last edited:
Status
Not open for further replies.
Top