Tutorial Bear Form Adding Effects

RedRage

New Member
Reaction score
7
Bear Form
What will this teach?
How do add attribute bonus, hp bonus, armour bonus, ect when bear form is turned on.
How to remove bonus when bear form is turned off.
*EDIT* How to make it so hero doesn't lose attribute once they level spell in dragon form.

Making bear form
First make your hero, then make the unit/hero it will turn into
Go into object editor, click abilities and right click, press new custom ability. Then unit ability, and locate bear form. Name it what ever you want, I named my spell Dragon Form, and my two triggers, Dragon Spell, and Dragon Spell Undo.

Delete tech tree req


To make it an hero ability just locate, then make it true:
Stats - Hero Ability [True]

To change the model it will turn into, and normal form.
Level 1 - Date - Normal Form
Level 1 - Date - Alternate Form

Starting the trigger
Go into Trigger editor, make new category, then make your trigger
First make this :
Code:
Events
    Unit - A unit Starts the effect of an ability

Conditions
    (Ability being cast) Equal to Dragon Form

Now we need a variable to represent the caster. INFO DragonCaster is an unit
Code:
Set DragonCaster = (Triggering unit)


Next we will make a IF/THEN/ELSE
Code:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    If - Conditions
    Then - Actions
    Else - Actions

Now make two triggers which are almost the same, except change the second spell Starts the effect of an ability to, Finishes casting an ability.
IMPORTANT!!!! CHECK THE INITIALLY ON BOX SO IT'S OFF FOR THE DRAGON SPELL UNDO!

Code:
Dragon Spell
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Dragon Form 
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
            Then - Actions
            Else - Actions
Code:
Dragon Spell Undo
    Events
        Unit - A unit Finishes casting an ability
    Conditions
        (Ability being cast) Equal to Dragon Form 
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
            Then - Actions
            Else - Actions
Adding the heart of the trigger, this will remove the effects when the spell is turned off, then add the effects when the spell is turned on
Code:
Set DragonCasterCheck = 0
and
Code:
DragonCasterCheck Equal to 0

Now lets add this in to the first trigger:
Code:
Dragon Spell
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Dragon Form 
    Actions
        Set DragonCaster = (Triggering unit)
        Set DragonCasterCheck = 0
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                DragonCasterCheck Equal to 0
            Then - Actions
                Set DragonCasterCheck = 0
            Else - Actions
                Set DragonCasterCheck = 0

The second trigger should look like this:
Code:
Dragon Spell Undo
    Events
        Unit - A unit Finishes casting an ability
    Conditions
        (Ability being cast) Equal to Dragon Form 
    Actions
        Set DragonCaster = (Triggering unit)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                DragonCasterCheck Equal to 1
            Then - Actions
                Set DragonCasterCheck = 1
            Else - Actions
                Set DragonCasterCheck = 1
Now we will add the turn off/on part of this trigger, this turns on/off the 2nd trigger, and the 2nd trigger turns on/off the first.
Code:
Dragon Spell
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Dragon Form 
    Actions
        Set DragonCaster = (Triggering unit)
        Set DragonCasterCheck = 0
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                DragonCasterCheck Equal to 0
            Then - Actions
                Set DragonCasterCheck = 0
                Trigger - Turn on Dragon Spell Undo <gen>
                Trigger - Turn off (This trigger)
            Else - Actions
                Set DragonCasterCheck = 0

Code:
Dragon Spell Undo
    Events
        Unit - A unit Finishes casting an ability
    Conditions
        (Ability being cast) Equal to Dragon Form 
    Actions
        Set DragonCaster = (Triggering unit)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                DragonCasterCheck Equal to 1
            Then - Actions
                Set DragonCasterCheck = 1
                Trigger - Turn on Dragon Spell <gen>
                Trigger - Turn off (This trigger)
            Else - Actions
                Set DragonCasterCheck = 1


Adding Effect
Now you've finished the hardest part it's time for you to add effects! The effects will always go between the THEN ACTIONS

Adding Attribute Bonus
We will do this by the level of the ability, you can change strength to agility, or intelligence. This is how it would look like. BE SURE TO ADD THIS TO Dragon Spell
Code:
Dragon Spell 
    Events
        Unit - A unit Finishes casting an ability
    Conditions
        (Ability being cast) Equal to Dragon Form 
    Actions
        Set DragonCaster = (Triggering unit)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                DragonCasterCheck Equal to 1
            Then - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Level of Dragon Form  for DragonCaster) Equal to 1
                    Then - Actions
                        Hero - Modify Strength of DragonCaster: Add 10
                    Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Level of Dragon Form  for DragonCaster) Equal to 2
                            Then - Actions
                                Hero - Modify Strength of DragonCaster: Add 20
                            Else - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        (Level of Dragon Form  for DragonCaster) Equal to 3
                                    Then - Actions
                                        Hero - Modify Strength of DragonCaster: Add 30
                                    Else - Actions
                                        Do nothing
                Set DragonCasterCheck = 1
                Trigger - Turn on Dragon Spell <gen>
                Trigger - Turn off (This trigger)
            Else - Actions
                Set DragonCasterCheck = 1


And this is how Dragon Spell Undo would look like:
Code:
Dragon Spell Undo
    Events
        Unit - A unit Finishes casting an ability
    Conditions
        (Ability being cast) Equal to Dragon Form 
    Actions
        Set DragonCaster = (Triggering unit)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                DragonCasterCheck Equal to 1
            Then - Actions
                Set DragonCasterCheck = 1
                Trigger - Turn on Dragon Spell <gen>
                Trigger - Turn off (This trigger)
            Else - Actions
                Set DragonCasterCheck = 1
Ok you're done this, but now when the person levels their spell while Dragon Form is on, then changes back they lose attribute, the solution? Another trigger! INFO DragonCasterStat is integer
Code:
DragonCasterAttributeChanger
    Events
        Unit - A unit Learns a skill
    Conditions
        ((Level of Dragon Form  for DragonCaster) Equal to 1) or (((Level of Dragon Form  for DragonCaster) Equal to 2) or ((Level of Dragon Form  for DragonCaster) Equal to 3))
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Learned Hero Skill) Equal to Dragon Form 
                (Learned skill level) Equal to 3
            Then - Actions
                Set DragonCasterStat = ((Strength of DragonCaster (Exclude bonuses)) - 20)
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Learned Hero Skill) Equal to Dragon Form 
                        (Level of Dragon Form  for DragonCaster) Equal to 2
                    Then - Actions
                        Set DragonCasterStat = ((Strength of DragonCaster (Exclude bonuses)) - 10)
                    Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Learned Hero Skill) Equal to Dragon Form 
                                (Level of Dragon Form  for DragonCaster) Equal to 1
                            Then - Actions
                                Set DragonCasterStat = ((Strength of DragonCaster (Exclude bonuses)) - 0)
                            Else - Actions
                                Do nothing
We're done this, but where will it come into effect?
Lets add this into Dragon Undo, because it will change the casters attribute onec the spell is done
Code:
Hero - Modify Strength of DragonCaster: Set to DragonCasterStat
Code:
Dragon Spell Undo
    Events
        Unit - A unit Finishes casting an ability
    Conditions
        (Ability being cast) Equal to Dragon Form 
    Actions
        Set DragonCaster = (Triggering unit)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                DragonCasterCheck Equal to 1
            Then - Actions
               Hero - Modify Strength of DragonCaster: Set to DragonCasterStat
                Set DragonCasterCheck = 1
                Trigger - Turn on Dragon Spell <gen>
                Trigger - Turn off (This trigger)
            Else - Actions
                Set DragonCasterCheck = 1
You can change the str to what ever attribute you want, i just used str as my attribute


Adding Range, attack, armour, hp, ect

First make an upgrade, then after you made it, add it to the unit your hero turns into Techtree - Upgrades Used, and this upgrade will affect that unit only.
But we will make it so depending on what level Dragon Form is.
Code:
Dragon Spell
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Dragon Form 
    Actions
        Set DragonCaster = (Triggering unit)
        Set DragonCasterCheck = 0
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                DragonCasterCheck Equal to 0
            Then - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Level of Dragon Form  for DragonCaster) Equal to 1
                    Then - Actions
                        Player - Set the current research level of Attack Bonus  to 1 for (Owner of DragonCaster)
                    Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Level of Dragon Form  for DragonCaster) Equal to 2
                            Then - Actions
                                Player - Set the current research level of Attack Bonus  to 2 for (Owner of DragonCaster)
                            Else - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        (Level of Dragon Form  for DragonCaster) Equal to 3
                                    Then - Actions
                                        Player - Set the current research level of Attack Bonus  to 3 for (Owner of DragonCaster)
                                    Else - Actions
                                        Do nothing
                Set DragonCasterCheck = 0
                Trigger - Turn on Dragon Spell Undo <gen>
                Trigger - Turn off (This trigger)
            Else - Actions
                Set DragonCasterCheck = 0


Code:
Dragon Spell Undo
    Events
        Unit - A unit Finishes casting an ability
    Conditions
        (Ability being cast) Equal to Dragon Form 
    Actions
        Set DragonCaster = (Triggering unit)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                DragonCasterCheck Equal to 1
            Then - Actions
 Player - Set the current research level of Attack Bonus  to 0 for (Owner of DragonCaster)
                Set DragonCasterCheck = 1
                Trigger - Turn on Dragon Spell <gen>
                Trigger - Turn off (This trigger)
            Else - Actions
                Set DragonCasterCheck = 1

Better Explained

How Does this work??
When the spell is activated, it sets DragonCasterCheck to 0, which activates the action of the IF/THEN/ELSE, which would be your effect, then it turns on Dragon Spell Undo, and turns itself off. But since Dragon Spell Undo only works when the spell is finished, it then sets DragonCasterCheck to 1. Then since Dragon Spell is turned off, and DragonCasterCheck is 1, it activates the IF/THEN/ELSE action, which takes away the effects, then turns on Dragon Spell, but it can't take effect right away because it only works when the ability is activated.

Adding Special Effects
You can add effects to make it cooler when you activate the spell
Code:
Untitled Trigger 001
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to Dragon Form 
    Actions
        Set DragonCaster = (Triggering unit)
        Set TempDragonCaster = (Position of DragonCaster)
        Special Effect - Create a special effect attached to the chest of DragonCaster using Abilities\Spells\Other\Doom\DoomDeath.mdl
        Special Effect - Destroy (Last created special effect)
        Special Effect - Create a special effect attached to the chest of DragonCaster using Abilities\Spells\Other\Incinerate\FireLordDeathExplode.mdl
        Special Effect - Destroy (Last created special effect)
        Special Effect - Create a special effect attached to the chest of DragonCaster using Objects\Spawnmodels\Undead\UCancelDeath\UCancelDeath.mdl
        Special Effect - Destroy (Last created special effect)
        Special Effect - Create a special effect attached to the chest of DragonCaster using Abilities\Spells\Demon\DarkConversion\ZombifyTarget.mdl
        Special Effect - Destroy (Last created special effect)
        Custom script:   call RemoveLocation (udg_TempDragonCaster)
INFO TempDragonCaster is point

Sorry if i couldn't explain this better
You're done! :p
 

ReVolver

Mega Super Ultra Cool Member
Reaction score
610
Very nice, this should answer some questions ask here a lot.
 

RedRage

New Member
Reaction score
7
Thxs, and i know because i was asking same question few days ago, then i came up with this.
 

elmstfreddie

The Finglonger
Reaction score
203
But isn't this not MUI?
Wouldn't it make more sense so it modifies the unit's custom value, not a global variable? Then it would be MUI.
 

RedRage

New Member
Reaction score
7
Guess it would :eek: but, this is meant for a hero, and that would mean more work figuring that out, and i'm trying to make it GUI no jass involved.
BTW you can't modify the units values with bonus mod, and thats jass, well actually you can with upgrades.
 

RedRage

New Member
Reaction score
7
Er.. Yes you can.
Unit - Set Unit Value or Custom Value something like that. It's there..!
Ugh, you can only add attribute bonus, i already got that so..... and you can't add hp, mana, ect.

*bump*?
:rolleyes:

Oh srry about this triple post but, i changed the above ATTRIBUTE add, so the person doesn't lose their attribute when they level dragon form =D

Though a comment on what you think about this tut would be appreciated

*Bump*
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top