• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Methamorphosis/add ability problem

Status
Not open for further replies.
Level 6
Joined
Jul 22, 2009
Messages
214
I've create a system that add some ability to the hero when he have all item of a set. My system work like this:
  • Events
    • Unit - A unit Acquires an item
  • Conditions
    • Or - Any (Conditions) are true
      • Conditions
        • (Item-type of (Item being manipulated)) Equal to |CFF4A79FFCrusader's Plate|r
        • (Item-type of (Item being manipulated)) Equal to |CFF4A79FFCrusader's sword|r
        • (Item-type of (Item being manipulated)) Equal to |CFF4A79FFCrusader's helm|r
  • Actions
    • Wait 0.02 seconds
    • Set SetHero = (Hero manipulating item)
    • Set PlayerItem = (Player group((Owner of SetHero)))
    • Set SetPlayerNumber = (Player number of (Owner of SetHero))
    • Set SetTier1[SetPlayerNumber] = (SetTier1[SetPlayerNumber] + 1)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • SetTier1[SetPlayerNumber] Equal to 3
      • Then - Actions
        • Set CrusaderSet1[SetPlayerNumber] = True
        • Game - Display to PlayerItem for 5.00 seconds the text: |CFFA8A8A8Crusader ...
        • Game - Display to PlayerItem for 5.00 seconds the text: 200 hit point
        • Game - Display to PlayerItem for 5.00 seconds the text: 14 armor
        • Game - Display to PlayerItem for 5.00 seconds the text: 5 hit points regen ...
        • Unit - Add Item Armor Bonus (+14) to SetHero
        • Unit - Add Item Life Regeneration(5/s) to SetHero
        • Unit - Add Item HP Bonus (+200) to SetHero
      • Else - Actions
And for remove the abilities is the hero drop an item of the set
  • Events
    • Unit - A unit Loses an item
  • Conditions
    • Or - Any (Conditions) are true
      • Conditions
        • (Item-type of (Item being manipulated)) Equal to |CFF4A79FFCrusader's Plate|r
        • (Item-type of (Item being manipulated)) Equal to |CFF4A79FFCrusader's sword|r
        • (Item-type of (Item being manipulated)) Equal to |CFF4A79FFCrusader's helm|r
  • Actions
    • Wait 0.02 seconds
    • Set SetHero = (Hero manipulating item)
    • Set PlayerItem = (Player group((Owner of SetHero)))
    • Set SetPlayerNumber = (Player number of (Owner of SetHero))
    • Set SetTier1[SetPlayerNumber] = (SetTier1[SetPlayerNumber] - 1)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • SetTier1[SetPlayerNumber] Not equal to 3
      • Then - Actions
        • Set CrusaderSet1[SetPlayerNumber] = False
        • Unit - Remove Item Armor Bonus (+14) from SetHero
        • Unit - Remove Item Life Regeneration(5/s) from SetHero
        • Unit - Remove Item HP Bonus (+200) from SetHero
      • Else - Actions
My problem is that one of my hero use an ability based on metamorphosis, and when he cast this spell the new hero created by the spell doesn't keep the three ability i've added for the set. I've find a solution for this part of my problem. Another trigger
  • Events
    • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Divine froce (crusader spell)
    • Actions
      • Set SetPlayerNumber = (Player number of (Owner of (Casting unit)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CrusaderSet1[SetPlayerNumber] Equal to True
        • Then - Actions
          • Unit - Add Item Armor Bonus (+14) to SetHero
          • Unit - Add Item Life Regeneration(5/s) to SetHero
          • Unit - Add Item HP Bonus (+200) to SetHero
        • Else - Actions
My real problem is when my hero come back to his normal form, I don't find any way for making him keep the ability. Can someone help me please. If it's not clear what I mean just say it to my I will try to explain it better.
 
Level 8
Joined
Aug 21, 2009
Messages
333
I know the answer to this, give me one second.

EDIT:
I had the exact same problem a while back.
After you add the ability you need to call this:
  • Custom script: call UnitMakeAbilityPermanent(udg_SetHero, true, 'A00R')
Instead of 'A00R', you would use the spell ID of the spell you are trying to keep :D
Also, you would need to call this once for each ability you are adding.

In addition, you may need to call this before removing the ability:
  • Custom script: call UnitMakeAbilityPermanent(udg_SetHero, false, 'A00R')
 
Level 8
Joined
Aug 21, 2009
Messages
333
It should look like this:
  • Events
    • Unit - A unit Acquires an item
  • Conditions
    • Or - Any (Conditions) are true
      • Conditions
        • (Item-type of (Item being manipulated)) Equal to |CFF4A79FFCrusader's Plate|r
        • (Item-type of (Item being manipulated)) Equal to |CFF4A79FFCrusader's sword|r
        • (Item-type of (Item being manipulated)) Equal to |CFF4A79FFCrusader's helm|r
  • Actions
    • Wait 0.02 seconds
    • Set SetHero = (Hero manipulating item)
    • Set PlayerItem = (Player group((Owner of SetHero)))
    • Set SetPlayerNumber = (Player number of (Owner of SetHero))
    • Set SetTier1[SetPlayerNumber] = (SetTier1[SetPlayerNumber] + 1)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • SetTier1[SetPlayerNumber] Equal to 3
      • Then - Actions
        • Set CrusaderSet1[SetPlayerNumber] = True
        • Game - Display to PlayerItem for 5.00 seconds the text: |CFFA8A8A8Crusader ...
        • Game - Display to PlayerItem for 5.00 seconds the text: 200 hit point
        • Game - Display to PlayerItem for 5.00 seconds the text: 14 armor
        • Game - Display to PlayerItem for 5.00 seconds the text: 5 hit points regen ...
        • Unit - Add Item Armor Bonus (+14) to SetHero
        • Custom script: call UnitMakeAbilityPermanent(udg_SetHero, true, '<ARMOR BONUS SPELL ID>')
        • Unit - Add Item Life Regeneration(5/s) to SetHero
        • Custom script: call UnitMakeAbilityPermanent(udg_SetHero, true, '<LIFE REGEN SPELL ID>')
        • Unit - Add Item HP Bonus (+200) to SetHero
        • Custom script: call UnitMakeAbilityPermanent(udg_SetHero, true, '<HP BONUS SPELL ID>')
      • Else - Actions
To figure out the spell ID's, go look at your abilities in the object editor and press CTRL+D. If the abilities don't go away when you drop the items, then I can tell you an addition trigger to fix that.

EDIT: lol, looks like you figured it out :)
 
Status
Not open for further replies.
Top