Tutorial Attribute Based Spells

Oninuva

You can change this now in User CP.
Reaction score
221
Oninuva’s Guide to Attribute Based Spells

Attribute based spells save a lot of time when you need a lot of ranks for spells. They do damage according to your level. It’s also great for RPG’s. If you ever played an RPG you might have noticed that some skills do damage based on one’s attribute points.

First to explain the attributes, Strength is normally used for melee heroes. Agility is mainly for ranged heroes and intelligence is for magic based heroes.


Index

  • One Target Melee - Storm Bolt
  • Indigence - AoE Healing Ability
  • De Buff - Curse
  • Custom Abilities




One Target Melee - Storm Bolt

Let’s start off by making a melee one target skill. Create a new skill based on Storm Bolt. Set these stats to the following:

Levels – 1
Cast Range – 50
Damage – 0

Set the others to anything your hearts desire!

Now go into the trigger editor and make a new trigger.

Code:
StormBolt
    Events
        Unit - A unit Finishes casting an ability
    Conditions
        (Ability being cast) Equal to Storm Bolt 
    Actions
        Set Strength = (Strength of (Casting unit) (Include bonuses))
        Set Convert = (Real(Strength))
        Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (Convert x 5.00) damage of attack type Spells and damage type Normal
There are two variables in this trigger.
Strength – Integer (Default Value 1)
Convert – Real

We need the Integer to store the attribute level of the unit and Real to convert an integer so we can use it as a damage. The other good thing about using 100% triggered spells are that you can even add special effects and more!

Inteligence - AoE Healing Ability

Now you will learn how to make AoE Heal Spells.

Make a new spell based on Flame Strike.

Set all damages to 0 and make the levels one. Then set delete the effect. Change target allowed to Allied and Self.

Now make this trigger.
Code:
AoE Heal
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to Mass Heal 
    Actions
        Set Inteligence = (Intelligence of (Casting unit) (Include bonuses))
        Set Convert = (Real(Inteligence))
        Set UnitGroup = (Units within 600.00 of (Target point of ability being cast) matching ((Owner of (Matching unit)) Equal to (Owner of (Triggering unit))))
        Game - Display to (All players) the text: (Currently Casting:  + (Name of (Ability being cast)))
        Unit Group - Pick every unit in UnitGroup and do (Unit - Set life of (Picked Unit) to ((Life of (Picked unit)) + (Convert x 4.00)))
        Unit Group - Pick every unit in UnitGroup and do (Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Human\HolyBolt\HolyBoltSpecialArt.mdl)
        Special Effect - Destroy (Last created special effect)
        Custom script:   call DestroyGroup(udg_UnitGroup)

The Finished Product Will Look Like

aoehealyz0.jpg


De Buff - Curse

Next we are going to make a de-buff, curse. It will cause a unit to miss based on the casting units inteligence divided by 10. This will require two triggers. One for the casting of the trigger and one for the actual effect. To start make a skill based on curse and set the chance to miss to 0.

Then create this trigger:

Code:
Curse
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to Curse 
    Actions
        Set Inteligence = (Intelligence of (Casting unit) (Include bonuses))
        Set Convert = (Real(Inteligence))
        Game - Display to (All players) the text: (Currently Casting:  + (Name of (Ability being cast)))
        Trigger - Turn on Curse Effect <gen>
        Wait 60.00 seconds
        Trigger - Turn off Curse Effect <gen>

Inteligence - Integer
Convert - Real

Then create the effect of the spell:

Code:
Curse Effect
    Events
        Unit - A unit Is attacked
    Conditions
        (Attacking unit) Equal to Cursed
    Actions
        Set Integer = (Random integer number between 1 and 100)
        Set Convert = (Real((Inteligence / 10)))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Integer Less than or equal to (Integer(Convert))
            Then - Actions
                Unit - Order Cursed to Stop
            Else - Actions

Note: You must set this trigger to [ ] Initially On. Uncheck it.

An explanation of this spell is, say a hero has 20 inteligence. It casts the spell curse. Then everytime the unit attacks it will have a 2% chance to miss. Note: The values can be easily changed by setting how much the inteligence is divided by.

Custom Abilities

Now time to learn how to make your own spells based on attributes. First off you need to figure out a formula. Examples are:

Str * 3 = Damage
Agi * 12 = Range
Int / 2 = Miss Chance

You can use the following operations: (+, -, *, and /) - Addition, Subtraction, Multiplication, and Dividing. The two most common used one are multipling and dividing. So first I will teach damage spells.

Create a spell based off a blizzard skill. I recommend:

  • Stormbolt (One Target, Melee or Ranged)
  • Flame Strike (AoE)
  • Thunder Clap (AoE, Slow, Stun)
  • Chain Lighting (Multi-Target, Selected)

Those are good and easy to manipulate skills. You need to create a few variables (Str, Agi, and Int) those are all Integers. Then create (convert) real, (unit) unit, (point) point, and (unitg) unit-group.
 

Attachments

  • Attribute Spells.w3x
    29.7 KB · Views: 841

lh2705

Just another Helper
Reaction score
111
Why not use Starts the Effect of an ability instead of finishes casting and begins casting? its much more efficient..
 

Oninuva

You can change this now in User CP.
Reaction score
221
Because some spells have casting time. Also with this you can generate a casting time based on attributes :)
 

lh2705

Just another Helper
Reaction score
111
casting time doesnt affect the "Starts the effects of an ability".
Also, begins casting an ability is not very good because if you cast the triggered spell and press stop/hold position immediately after casting, the spell will trigger but the cooldown wont. So you will get a spell with no cooldown..sort of..
 

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
why did u use 2 variables?
u could have used 1 variable of real and convert the strenght of the hero instead converting variable...
anyway good job +Rep
 

Oninuva

You can change this now in User CP.
Reaction score
221
2 Variables so it can be used for other things.
 

Romek

Super Moderator
Reaction score
963
nice tut

+Rep
 

Andrewgosu

The Silent Pandaren Helper
Reaction score
716
Code:
StormBolt
    Events
        Unit - A unit Finishes casting an ability
    Conditions
        (Ability being cast) Equal to Storm Bolt 
    Actions
        Set Strength = (Strength of (Casting unit) (Include bonuses))
        Set Convert = (Real(Strength))
        Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (Convert x 5.00) damage of attack type Spells and damage type Normal

For such a simple spell, you do not need variables. If one has many things to do with attributes, with different functions, then one should set them into variables to increase the readability and make the triggering (Clicking) faster. ( And it is wiser to use triggering unit instead of casting unit)

Code:
StormBolt
    Events
        Unit - A unit Finishes casting an ability
    Conditions
        (Ability being cast) Equal to Storm Bolt 
    Actions
        Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing ((Strength of ([B]Triggering unit[/B]) (Include bonuses)) x 5.00) damage of attack type Spells and damage type Normal

Also, one should add a wait, equal to the distance between the triggering unit and the target unit of ability being cast divided the missle speed, to insure the damaging is done, when the missle actually hits the target, not before.


This belongs to the free trigger code section.
 

Thanatos_820

Death is Not the End
Reaction score
91
Nice, this trigger is familiar, as seen on The Alliance map (Hybrid Hero map and TD), or EotA. The creator of the map used a trigger similar to this one (You could say he used the same trigger but differently), but it was a bit more complex.

But this is the same as modifying spells just with attributes, yes? Like adding damage dealt with the amount of strength times whatever gives the value? For example:

Shockwave deals 50 damage, but deals additional damage equal to 0.5x the strength of the hero.

Is it related to that Oninuva?
 
Reaction score
148
Would be pretty nice... If you'd also add attribute based spells that don't do damage. For example, Summon spells that summon depending on your strength, Curses that make you miss % chance based off your intelligence etc etc. Now, this tutorial only covers teh damage dealing abilities. And only meele or instant :)
 

Oninuva

You can change this now in User CP.
Reaction score
221
Would be pretty nice... If you'd also add attribute based spells that don't do damage. For example, Summon spells that summon depending on your strength, Curses that make you miss % chance based off your intelligence etc etc. Now, this tutorial only covers teh damage dealing abilities. And only meele or instant :)

I hope you enjoy the newly added part of the tutorial just for you :) Don't you just feel so special!
 

rayquaza218

New Member
Reaction score
51
nice, many people would love this, although "starts the effect of an ability" is much more efficent.

+Rep!
 

Oninuva

You can change this now in User CP.
Reaction score
221
Updated Post with: Curse, Custom Abilites, and one screenshot!
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top