[Spell] Is it possible to give a spell more damage if a unit has a debuff?

Level 3
Joined
Nov 24, 2014
Messages
19
Hello, I have not played Warcraft 3 in a long time, much more using the world editor. But I picked it up again recently and I am able to navigate okay. I'm testing out the triggers and game caches, I'm wondering if it's possible to give a spell more damage if a target has a debuff.

For instance, a Unit casts a spell such as "Firebolt", and if the target of the spell has the debuff "Slowed", firebolt will deal more damage on impact. How would I do this if it's possible via the trigger manager?

Thank you in advance.
 

Retera

Tool Reviewer
Level 30
Joined
Apr 19, 2008
Messages
1,205
Please, please to achieve this pick up your keyboard and hold it over your knee. Then throw it downward with a quick motion and you will see the keyboard as it breaks into two large halves. Then take these two halves and hold them up to the sides of your head like horns, and declare in a loud voice, "IN TRUTH, IT WAS I WHO WAS BETRAYED!"

Then stand up from your computer still with the keyboard horns on your head and recite the following,

Warcraft 3 is a binary application created for a battle between Orcs and Humans and two other new fun races in the year 2002 that was written hastily with tons of C++ code that almost nobody understands and that will never be published. The units are stored in Microsoft Excel spreadsheets and text documents made in Notepad and the behavior of abilities can only be changed from in the office in the C++ code. Then some fans discovered they could use the campaign cinematic event setup language fake the existence of new abilities into the game. It is amazing since the campaign setup language was hacked together in a couple of days with a simple system of triggers back in 2002. Because players were super into this, in the Expansion the dev team threw together an Ability Editor copied from the code of the Unit Editor that additionally allowed players to create two or more configurations for the same C++ ability class that would essentially allow two separate copies of the Excel spreadsheet row for the balance parameters of that ability.
So, when I ask if a methodology was made for me to change the behavior of a spreadsheet row to have new code behind it, like how creep Breath of Frost and Panda Breath of Fire are different, and Panda Breath of Fire deals more damage to units with Drunken Haze buff -- the answer here is that the "code" column of my spreadsheet row is in one case 'ANbf' and in the other case 'ACbf' and so 'ACbf' uses a different copy of the C++ code for that Excel spreadsheet row and thus does not interact with Drunken Brawler. So, now I must realize that in order to change this column for the Excel spreadsheet of my row and give it a new C++ class to spawn to define its ability behavior, I have to work at Blizzard, which I do not, so for me there is no solution and no salvation, even though what I want to do would be a 30 minute code change if I was permitted to add additional C++ classes or their equivalent to my project.

Then, take off your keyboard horns and strap them now instead to your feet like shoes. Now, walk on these shoes to your bathroom mirror, close the door, turn off the light, and recite the first few lines of Archimonde from the Undead end cinematic 5 times in a row (this has to be from memory, no notecard with you):

Azhir uval nutarus, azhir mudas ethanul.
Azhir uval nutarus, azhir mudas ethanul.
Azhir uval nutarus, azhir mudas ethanul.
Azhir uval nutarus, azhir mudas ethanul.
Azhir uval nutarus, azhir mudas ethanul.

Once you do this, if you return to your World Editor and open the Ability Editor you should now see two tabs on the right hand side above the table.

behavioreditor3-gif.374227

With these two tabs, you should see one labelled Stats and the other labelled Behavior. Click on Firebolt (in my example I am using Storm Bolt). In the Behavior tab you will see basically a GUI that is the same as the Trigger Editor, but it defines the actions for the CAbility class instance that will be generated corresponding to this Ability Editor config's Excel spreadsheet row's "code" column.

In this section, "On Cast - Actions" which lists the trigger actions for this particular ability when it is cast, you will now see the list of actions for creating the Firebolt missile based on the "Art - Missile Art" config values followed by the block to "Cause (Casting unit) to damage (Target unit of ability being cast)..." which does the actual damage. I know its a bit weird we do not see the delay between missile launch and when it hits the target, but basically the Missile action "Launch (Last create missile)..." holds the thread while we wait for the missile to arrive. (As I recall there is an Action available to also configure missiles not to wait, which is how I do Nova spells or how stuff like Cluster Rockets work that need several simultaneous missles.)

So, as I am sure you can imagine, what you want to do now is to copy the second IF block starting with "If (All Conditions Are True)" that has for its condition a check on the LocalBuffType level on the target. You can copy with CTRL+C and then paste this block with CTRL+V above the decision for dealing damage to the target unit. Delete its "Then - Actions" and "Else - Actions" so it has only filled in the "If - Conditions" subheading. Then, double click on the "(Level of LocalBuffType for (Target unit of ability being cast)) Greater Than 0". This will get you to a Configure Condition popup where you must click on "LocalBuffType" because we want to change it to "Slowed" instead, using a "Value" instead of a "Variable".

Ideally you would come back later and add to this modified code definition for ANfb behavior (Firebolt) to have "DataB1" store a configurable value for the Slowed ('Bfro') setting as well as DataC1 for bonus damage in this case. By doing this you can then copy your ability and easily make other Firebolt instances that deal their bonus damage against other buff types and other bonus damage amounts. But lets start with assuming a flat bonus 50 damage and hardcoding the damage amount and the buff to check into our Behavior's actions.

So, now we have it checking for Slowed on the target at damage time but we did not actually change the damage amount yet. So, right click near the top where it says "Local Variables" and create a new Local Variable named "LocalTargetDamage". Where it says Variable Type, expand the dropdown and choose Real.

Now go back to our new If block above "Cause damage" that we added where the "Then - Actions" and "Else - Actions" are still empty. For starters, we want the else case to work the same as before so just right click "Else - Actions", choose "New Action", and then choose "Set Variable". From there, on the left hand side choose "LocalTargetDamage" and on the right hand side for what we set it to, use the same configuration as what we see in the old "Cause.." damage line. This should look like:

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Level of Slowed for (Target unit of ability being cast)) Greater than 0
    • Then - Actions
    • Else - Actions
      • Set LocalTargetDamage = (Ability: (This ability)'s Real Level Field Damage ('Htb1'), of Level: LocalLevel)
Now, we want to do the special part, which is to add 50 damage in the "Then - Actions" case. Copy the variable setting line we just created twice. I'll explain why in a moment. But you can do this by tapping CTRL+V twice. It should look like this:

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Level of Slowed for (Target unit of ability being cast)) Greater than 0
    • Then - Actions
      • Set LocalTargetDamage = (Ability: (This ability)'s Real Level Field Damage ('Htb1'), of Level: LocalLevel)
      • Set LocalTargetDamage = (Ability: (This ability)'s Real Level Field Damage ('Htb1'), of Level: LocalLevel)
    • Else - Actions
      • Set LocalTargetDamage = (Ability: (This ability)'s Real Level Field Damage ('Htb1'), of Level: LocalLevel)
Now, for the second variable set line we just created change the assigned value to Arithmetic. In the operator dropdown choose '+' which is the default anyway. The important thing is to use the variable LocalTargetDamage on the left hand side and the value 50 on the right hand side.


  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Level of Slowed for (Target unit of ability being cast)) Greater than 0
    • Then - Actions
      • Set LocalTargetDamage = (Ability: (This ability)'s Real Level Field Damage ('Htb1'), of Level: LocalLevel)
      • Set LocalTargetDamage = (LocalTargetDamage + 50)
    • Else - Actions
      • Set LocalTargetDamage = (Ability: (This ability)'s Real Level Field Damage ('Htb1'), of Level: LocalLevel)
Now as you can see we created redundancy! This is a great opportunity to improve our code. Delete the "Else - Actions" copy and drag the "Then - Actions" first line out to be before the entire IF block.

  • Set LocalTargetDamage = (Ability: (This ability)'s Real Level Field Damage ('Htb1'), of Level: LocalLevel)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Level of Slowed for (Target unit of ability being cast)) Greater than 0
    • Then - Actions
      • Set LocalTargetDamage = (LocalTargetDamage + 50)
    • Else - Actions
To finish up, double click on the "Cause (Casting unit)..." damage line and in the popup click on "(Ability: (This ability)'s Real Level Field Damage ('Htb1'), of Level: LocalLevel)" and replace this setting with the variable "LocalTargetDamage." This way, the ability will use our new variable for deciding the actual amount of damage.

Like I said I would personally add a new data field (you can base this on Htb1) for the bonus damage to be configurable in other copies of this ability in the ability editor (so that below "Data - Damage" you would have also "Data - Bonus Damage When Slowed" in the Stats tab). But again that's probably more than you need.

Now we have a really nice little block to determine our bonus damage, and we can even copy it to give the same spell other bonus damage amounts against other buffs!

Let me know if any of the steps in the process weren't clear or if some part of this doesn't work for you how it did for me when I used Storm Bolt.
 

Attachments

  • behavioreditor3.gif
    2.3 MB · Views: 100
Last edited:
Level 3
Joined
Nov 24, 2014
Messages
19
Let me know if any of the steps in the process weren't clear or if some part of this doesn't work for you how it did for me when I used Storm Bolt.

Instructions unclear, I seem to have opened a portal.
Thank you so much. I'll be trying this. too. :O
 
Level 12
Joined
Dec 4, 2007
Messages
1,079
^ it's one of Lord Retera's hidden secrets

maybe we will be granted access, once this community has proven its worth?!
 
Top