• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

How tocreate custom spells/abilities/buffs/passives?

Status
Not open for further replies.
Level 2
Joined
Jan 22, 2013
Messages
11
Is there a tutorial for it? I could not find ANY! And i mean custom spells. Not just poor modifications of existing ones because there is plenty tutorials that explain nothing. And i dont wanna to change grunt berserker upgrade to give 300hp more. I need to create new values.

For example i wish to create upgradeable ability that will give following:
natural passive ability -> 40% chance for shield block 10 damage
upgrade -> +4% additional chance for block for every other soldier in proximity up to total of 40%
+6 damage
-50% attack speed

And another:
autocast spell -> every 10 seconds consumes 20 mana and explodes around the caster healing allied units and damaging enemy units for 15hp

And this:
autocast spell -> every basic attack consumes 1 mana and deals 1 additional damage. if the attacker stays on target every consequent strike will consume 0,5 more mana and deals 1 additional damage for every attack. second attack equals to 2 more damage and tenths attack equals to 10 more damage.

So, can someone point me to right direction? How to create those kinds of things?
 
Last edited:
Level 39
Joined
Feb 27, 2007
Messages
5,019
Do you intend for your autocast skills to be toggleable or are they permanently on? Catching the toggle orders will be required if you want toggling to work. Most of spellmaking is just using logic and looking for the right trigger event/condition/action. Think about what you're trying to do: what actual thing happening 'triggers' the ability? Block skill = attack damage dealt to caster, area heal skill = periodic event, stacking attack skill = attack damage dealt by caster.

Okay now what do you have to 'do' when this trigger happens? Block skill = count units nearby, check random number <= chance, reduce incoming damage. Area skill = subtract mana, pick units in area, damage enemies, heal allies. Stacking skill = increase counter, subtract mana, deal bonus damage.

You may need to use some variables to store information like 'last attacked target', 'current number of stacks', 'toggle status on/off', 'group of units that have this ability active', etc.. Again, think about it and do what seems logical. Now that you have the spell working for 1 unit at a time (with variables) you will have to make it MUI. To do this you can also use hashtables to store the appropriate information if you do not want to use array variables and dynamically index them. Experiment. Try what seems like it should work. Don't be afraid to use too many variables. A tutorial about dynamically indexing and a good resource for detecting unit attacks (and other damage events) is below.

Visualize: Dynamic Indexing
Damage Engine 5.4.1.0
 
Level 39
Joined
Feb 27, 2007
Messages
5,019
No... you import it into and use it in your map. Read the system documentation if you don't understand; it's actually very simple to use and extremely powerful.

What was unclear about what I wrote? I tried to show how to break down what you want to do into the component parts. The trigger editor actions are searchable so you can easily find the thing to do each step.
 
Level 39
Joined
Feb 27, 2007
Messages
5,019
I dunno man, it’s like you’re being willfully ignorant. You copy and paste the two system triggers (shown in the documentation, like I suggested you read) into your map; it’s that fucking simple. There is almost no wc3 development situation in which triggers are imported through the import manager. Have you actually never once used a trigger/script resource from this site in the 6 years you’ve been a member?
 
Level 5
Joined
Jun 12, 2018
Messages
148
From Damage Engine documentation :
How to install or upgrade to Damage Engine 5:
  1. Use WarCraft 3 Version 1.31
  2. If you're upgrading from 3.8 or prior, please delete the entire "Damage Engine" category from your map.
  3. Copy & Paste the Damage Engine category from the attached map to your own map.

To automatically import the variables the library is using, Go to File->Preferences->Tick "Automatically create unknow variables..." (or something like this, my editor is in french)

To get all the code needed for the system, you just have to open the Damage Engine map, and copy the category folder named "Damage Engine". Then get back to your map, go to the Trigger Editor and right click + paste (Ctrl - C + Ctrl -V also works).

There you go, either read the "How to use" section or check the examples given in the map.

That being said, I think what @Pyrogasm was trying to say is that you can use this damage system to create your own custom abilities.

For example given your "Natural passive ability" you could go for :

---When a units is getting damage
-----If the target of the attack has the Natural passive
--------Randomize a number representing the percent of chance of blocking
--------If the unit can block, get the level of the passive ability
------------If the ability level is superior to 1
----------------Do your custom upgrade stuff here

I hope this is clear for you. Cheers and good luck ! :)
 
Level 9
Joined
Jul 30, 2018
Messages
445
And to make clear: Damage Engine is not some make-your-own-spell tool, it's just a system that can detect when units do damage and you can change the damage (among plenty other features).

natural passive ability -> 40% chance for shield block 10 damage
upgrade -> +4% additional chance for block for every other soldier in proximity up to total of 40%
+6 damage
-50% attack speed

Make any custom ability that has not stats. Then make a trigger something like this:
  • Block Spell
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00 //(This is a custom event that comes with Damage Engine)
    • Conditions
      • (Level of [Your ability] for DamageEventTarget) Greater than 0 //(There is no conditions to check if a unit has certain ability, so this is a workaround for that)
    • Actions
      • Set TempPoint = (Position of DamageEventTarget)
      • Set TempGroup = (Units within 512.00 of TempPoint matching (((Matching unit) is alive) Equal to True))
      • Custom script: call RemoveLocation(udg_TempPoint) //(This is to remove the leak)
      • Set TempInteger = (Number of units in TempGroup)
      • Custom script: call DestroyGroup(udg_TempGroup)
      • Set BlockChance = 40.00
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of [Your ability] for DamageEventTarget) Greater than 1
        • Then - Actions
          • Set BlockChance = (BlockChance + ((Real(TempInteger)) x 4.00))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • BlockChance Greater than 80.00
            • Then - Actions
              • Set BlockChance = 80.00
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random real number between 1.00 and 100.00) Less than or equal to BlockChance
        • Then - Actions
          • Set DamageEventAmount = (DamageEventAmount - 10.00)
        • Else - Actions
Now this is to give some idea and to get you started. You can try to apply the other effects yourself. Feel free to ask for more help, but try to go as far as you can by yourself, because that way you'll learn the best.

Edit: I just realized that my trigger was wrong way around. You have to check if the unit that is being attacked (DamageEventTarget) has the ability. But the logic is still the same.
 
Last edited:
Level 2
Joined
Jan 22, 2013
Messages
11
I dunno man, it’s like you’re being willfully ignorant. You copy and paste the two system triggers (shown in the documentation, like I suggested you read) into your map; it’s that fucking simple. There is almost no wc3 development situation in which triggers are imported through the import manager. Have you actually never once used a trigger/script resource from this site in the 6 years you’ve been a member?

Person who cant understan what i was confused about after i explained it in one simple sentence and had only that one sentence to read and could not comprehend it calls me ignorant. Allright. You still explained nothing. Not only you explained nothing but you told me t import this file and then that there is no situation where ineed to import it. I asked if i need to open this engine map and you said NO, you imort it. Now i read that i need to open it. So, yeah... get grip on reality pal.


I hope this is clear for you. Cheers and good luck ! :)

Yes, it is. I found random variables thing to select. But i dont have engine folder anywhere to copy. It opens as blank map with nothing in it.
 
Level 5
Joined
Jun 12, 2018
Messages
148
Yes, it is. I found random variables thing to select. But i dont have engine folder anywhere to copy. It opens as blank map with nothing in it.

This "Damage Engine" folder I told you about is in the Damage Engine 5.4.2.0 map. Open this map, go to the Trigger Editor (F4), copy only this folder, close the map. Then you can open your map, go to the same trigger editor and paste it here (it will import automatically all the variables you need), you will see the whole folder in your map :)

If your Warcraft version is below 1.31, you'll need to import from this instead : Damage Engine 3.8.0.0 | HIVE

Once this is done, you can read the @Sabe example which gives you a precise idea of what you want to achieve creating your custom spell.
 
Level 39
Joined
Feb 27, 2007
Messages
5,019
It opens as blank map with nothing in it.
This is the source of all your confusion. Double-clicking a map to open the WE (whether the WE is open already or not) does not open the map right now (for whatever arcane Blizzard reason), it just creates a new blank map instead. Open the WE, then select and open the .w3x file with the File > Open command. This will actually open the map.

Now... go back and reread everything I wrote in this thread keeping in mind I assume you know how to do this and are actually opening the map properly and seeing the triggers inside it. That is why I suggested you were being willfully ignorant.
It is not entirely clear to me what you wrote. I open damage engine in wc3 editor then on the map it provides i create triggers to make spells, yes?
I provided a whole bunch of spellmaking information and all you responded with was this post. You literally do not say what is unclear, just that “it is”, so m assumption is that my commentary about spellmaking is what is confusing. I’m actually giving you the benefit of the doubt by assuming that it couldn’t be something so basic as actually getting the map to open so you can c’n’p triggers. Also the system has documentation that I suggested you could read to understand what it is and how it works.
Person who cant understan what i was confused about after i explained it in one simple sentence and had only that one sentence to read and could not comprehend it calls me ignorant. Allright. You still explained nothing. Not only you explained nothing but you told me t import this file and then that there is no situation where ineed to import it. I asked if i need to open this engine map and you said NO, you imort it. Now i read that i need to open it. So, yeah... get grip on reality pal.
Your vitriol does not help you here, it just makes you look like an ass. To try to call me out for trying to help you is ridiculous. “Import” in general means “put into your map”. If you import code you copy and paste it. If you import abilities you copy and paste them. If you import models you use the import manager. If you import sounds you use the import manager. How different data are imported into you map project is again something that I am assuming you are competent enough to know how to do!
 
Level 8
Joined
May 21, 2019
Messages
435
For example i wish to create upgradeable ability that will give following:
natural passive ability -> 40% chance for shield block 10 damage
upgrade -> +4% additional chance for block for every other soldier in proximity up to total of 40%
+6 damage
-50% attack speed
This will be very difficult to do without a damage engine. The upgrades will have to be done through some fairly difficult trigger coding, but the hardest part is definitely reducing the damage based on chance, as you need to determine if the block happens on every swing, and then alter the damage before it takes effect. This is almost impossible to do in the regular GUI.

autocast spell -> every 10 seconds consumes 20 mana and explodes around the caster healing allied units and damaging enemy units for 15hp
I forgot what the spell is named, but there is this spell used by the statues on the undead faction that can heal nearby friendly units with an aoe.
Now, all you'd have to do to add a damage component to that spell, is run a trigger with the event of a unit beginning the effect of an ability, a condition being that the ability cast is your spell, and an action that picks every nearby enemy unit and deals damage to them from the casting unit.
Pretty simple.

autocast spell -> every basic attack consumes 1 mana and deals 1 additional damage. if the attacker stays on target every consequent strike will consume 0,5 more mana and deals 1 additional damage for every attack. second attack equals to 2 more damage and tenths attack equals to 10 more damage.
The damage consumption for mana is pretty easy to trigger. The stacking effect is a bit trickier, but nowhere near as hard as the first spell you described.
What you need to do, is keep track of your attacking units last target and stack number. Hashtables would be a relatively simple way to go about that.
Basically, you're going to use the attacking unit as the key, and then store the values of target and stack count in 2 indices of your choosing. Then you run a trigger every time a unit with the dummy ability lands an attack, and use this information to decide what the outcome should be. You can use the stack count to determine the damage, and the target to determine if the attack is aimed at the same unit. You can also easily check if the attacker has enough mana to perform the action. I'd generally advice against using 0.5 mana, as that will be a real pain in the ass to deal with in a lot of situations, including the fact that integer conversions will be hell, as they do not support decimals as opposed to "real" numbers.
 
Level 39
Joined
Feb 27, 2007
Messages
5,019
I'd generally advice against using 0.5 mana, as that will be a real pain in the ass to deal with in a lot of situations, including the fact that integer conversions will be hell, as they do not support decimals as opposed to "real" numbers.
Mana and life are reals internally, not integers; there is nothing difficult about subracting 0.5 (or some multiple) mana per attack. Additionally, integer > real does not lose any information; only real > integer truncates. GUI won't let you do it but operations involving integers and reals together generally do not need to be converted if you intend a real result (rather than integer result), and they can be mixed/matched as necessary.
 
Level 8
Joined
May 21, 2019
Messages
435
Mana and life are reals internally, not integers; there is nothing difficult about subracting 0.5 (or some multiple) mana per attack. Additionally, integer > real does not lose any information; only real > integer truncates. GUI won't let you do it but operations involving integers and reals together generally do not need to be converted if you intend a real result (rather than integer result), and they can be mixed/matched as necessary.
I am aware of this, which is why I wrote "generally", as I advise it as a more general guideline than a case specific thing. There are scenarios in which you may want to convert a real to an integer, and if he changes his mind about how this spell works in the future, that could seed a problem. Also, on a pure UX-design basis, I prefer to not use values like this that aren't displayed in-game, as that makes it difficult for players to get visual feedback on their actions. It also makes it hard to determine whether or not an ability can be used when at "0" mana. It just doesn't seem like a good user experience to me.

I'd always advice anyone to design their systems around as few quirky mechanics as possible. I can't recall the exact specifics, but I think that hero stats are treated as both integers and reals in different contexts. As such, I tend to avoid fractions when dealing with hero stats, and balance my map around that philosophy.

You may disagree with that approach, and that's fine, it's only an opinion, after all.
 
Status
Not open for further replies.
Top