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
Code:
Set DragonCasterCheck = 0
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
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
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
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
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)
Sorry if i couldn't explain this better
You're done!