• 🏆 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!

[Solved] Add Ability to item using trigger editor.

Level 4
Joined
Mar 7, 2024
Messages
44
I want to add a Capability to the item not directly modifying it but through the trigger editor? Is this possible?
multiple abilities.png
 
Level 39
Joined
Feb 27, 2007
Messages
5,031
There are a couple things you could mean, and the approach is different for each:
  1. Add an additional passive ability to an item with a trigger. Example: the item now has a +100 HP ability it didn't have before.
  2. You want another active ability that can be used by interacting with the item in some way. Example: the item alternates between casting Holy Light and Death Coil.
  3. Use a trigger to create custom functionality for an item that can't be done with the Object Editor. Example: the item pulls nearby enemies towards you when held (or when activated).
What exactly are you hoping to accomplish?
 
Level 4
Joined
Mar 7, 2024
Messages
44
Similar to number 1, I want to upgrade items through the trigger editor, for example, a champion's shield has no hp + additional gems combined with 50% success will combine into the old shield item but that shield will have +100hp and merged multiple times.
 
Level 4
Joined
Mar 7, 2024
Messages
44
When a hero receives the Trueshot Aura ability, he receives an auto-damage skill that when using one of that hero's skills has a 50% chance of dealing 5xstr explosive damage to the area around the hero dealing damage to enemies. Please help me do this.
 
Level 4
Joined
Mar 7, 2024
Messages
44
I need your help
Pyrogasm , please help me solve these 2 problems:
1. I want to upgrade items through the trigger editor, for example, a champion's shield has no hp + additional gems combined with 50% success will combine into the old shield item but that shield will have +100hp and merged multiple times.
2. When a hero receives the Trueshot Aura ability, he receives an auto-damage skill that when using one of that hero's skills has a 50% chance of dealing 5xstr explosive damage to the area around the hero dealing damage to enemies. Please help me do this.
 
Level 39
Joined
Feb 27, 2007
Messages
5,031
Similar to number 1, I want to upgrade items through the trigger editor, for example, a champion's shield has no hp + additional gems combined with 50% success will combine into the old shield item but that shield will have +100hp and merged multiple times.
If you are using a (somewhat) recent World Editor version, you will likely have access to special trigger actions that add/remove/modify abilities on items as discussed in this thread. A trigger like this will work to add attribute bonus to the unit, and even change the value of the attribute bonus added dynamically:
  • Hero - Create Mask of Death and give it to Archmage 2 0010 <gen>
  • Set VariableSet ITM = (Last created item)
  • Set VariableSet ABL_CODE = Attribute Bonus
  • Item - For Item: ITM, Add Ability: ABL_CODE
  • Ability - Set Ability: (Item: ITM's Ability with Ability Code: ABL_CODE)'s Integer Level Field: Agility Bonus ('Iagi') of Level: 0 to 4
  • Unit - Increase level of ABL_CODE for Archmage 2 0010 <gen>
  • Unit - Decrease level of ABL_CODE for Archmage 2 0010 <gen>
That gives the +3 attribute bonus ability, changes the agility bonus to +4 instead, and then refreshes the ability so these stats are properly given to the unit holding the item. There are some important things to know, though:
  • Most level-related fields are 0-indexed, meaning that to modify the ability data for level 1 you'll actually modify index 0. So just subtract 1 from the level you actually want to change.

  • If you level an item ability above level 1 it will provide the correct benefits for its level, but when the item is dropped or given to another unit all of the ability's modified fields will all reset the default as if you had not modified anything. In general, instead of using additional levels on these abilities you should be modifying the ability fields for level 1 directly (like in my above trigger)... but even that doesn't fully avoid this issue. Every time a unit picks up the item, all of its attached abilities will need to be leveled up+down to properly refresh.

    As an example: when I drop the Mask of Death in my above trigger, I lose my 3/4/3 attribute bonus (expected). When I pick the item back up with the same unit I gain back a 3/3/3 bonus instead (unexpected). If I then increase/decrease the level of that attribute bonus ability (doing nothing else) I get the 3/4/3 bonus back again. This is pretty annoying to work around but can be done. Or you could just... not let players drop or trade items in your map. :)

  • Many ability fields do not get immediately updated when they are changed and must also be manually refreshed. You will accomplish this by changing the level of the ability to something else and then back to the correct level. Since (from my 2nd point here) item abilities can only reliably be kept at level 1 it will usually be best to increase and then decrease the level by 1. This means that even if you do not intend to use Level 2 of an ability (and you shouldn't on an item), the ability must have 2 levels anyway so that it can be increased and then decreased to properly refresh.

  • HP Bonus Abilities are severely bugged and do not interact with leveling up properly as I have explained above. Try it out and you'll see that the HP does not get updated on level up but instead only when the item/ability is removed from the unit. This is a longer discussion than I want to have here and you'll have to learn about it for the example of the shield gems you gave. Some searches here should show discussion about this bug and how people work around it. It's the basis of the old BonusMod system and its successor NewBonus which you might be able to use here with a little finagling.
Attached is a testmap where you can see this method in action. The Escape trigger is the only relevant one (that's my generic testmap). Press Escape to spawn an item for the archmage that gives 3/4/3 stats and play around with dropping it to see that behavior.

2. When a hero receives the Trueshot Aura ability, he receives an auto-damage skill that when using one of that hero's skills has a 50% chance of dealing 5xstr explosive damage to the area around the hero dealing damage to enemies. Please help me do this.
  • Spell Damage
    • Events
      • Unit - A starts the effect of an ability
    • Conditions
      • (Level of Trueshot Aura for (Triggering Unit)) greater than 0
    • Actions
      • If (All conditions are true) then do (Then actions) else do (Else actions)
        • If - Conditions
          • (Random number between 0.00 and 1.00) greater than or equal to 0.50
        • Then - Actions
          • Set TempPoint = (Position of (Triggering Unit))
          • Set TempGroup = (Units within RANGE of TempPoint)
          • Set DMG = (5.00 x (Real(Strength of (Triggering Unit) (Include bonuses))))
          • Unit Group - Pick every unit in TempGroup and do (Actions)
            • Loop - Actions
              • If (All conditions are true) then do (Then actions) else do (Else actions)
                • If - Conditions
                  • ((Picked Unit) belongs to an enemy of (Owner of (Triggering Unit))) equal to True
                  • ((Picked Unit) is Alive) equal to True
                  • -------- any other filters you want here --------
                • Then - Actions
                  • Unit - Cause (Triggering Unit) to damage (Picked Unit) dealing DMG of attack type Spells and damage type Normal
                  • -------- do special effects here if you want them --------
                • Else - Actions
          • Custom script: call RemoveLocation(udg_TempPoint) //cleaning point leak, look it up if you don't understand
          • Custom script: call DestroyGroup(udg_TempGroup) //cleaning group leak
        • Else - Actions
 

Attachments

  • Almost Blank Test.w3m
    38.6 KB · Views: 2
Level 4
Joined
Mar 7, 2024
Messages
44
you helped me with what i needed you are so good thank you so much.😍
1. Yes, I need it, but I probably won't be able to use it because I'm using version 1.29.
2. I will do it immediately thank you very much.
 
Top