Ability Snippets

Status
Not open for further replies.
D

DU_CyNiCaL_oNe

Guest
Hey everyone, heres some tutorials i came up with in my spare time:



- ! Abilities ! -

Ok, so I know what you're thinking: "I have this awesome level but my custom spells wont work (and/or they just suxx0r and u dun wanna admit it!! :) )!! Help me PWEEZ!!"

Calm down little man! Spells and abilities are easy, for example, if you wanted to make... per say... 3 infernals shoot down from the sky, but at the same time you wanted the effect of "stampede" and "starfall" to come into play, no prob! Just do this, make a new ability called (your ability here), then, use inferno as the base for the skill. Now go to Data : Summoned unit amount: 3

Now the fun part.... :) Double Cilick Art Caster and do this:
Code:
 Starfall (effect)

And now, double click art target and do this:
Code:
 Stampede (effect)

------------------------------------------------------------------------------------

- ! Triggers] ! -

Now, triggers are a littllllle bit more difficult, some anyway.. I'll give examples of around 10 or 11 triggers that are commonly used..

to start off with, gold!
If you wanted to make a TD level where you gain gold after a certain amount of time, do this!

Code:
 Events - Timed event - every x seconds of game time, 
add x property to player x's current gold

Now, how about a hero select? (people in the background) YAH!! PLEASE!! ;)

Calm down my naiev friends.. this is an easy one!
FIRST! Put circles in front of the heros to indicate where you select them, make a region called <your region name here>, and make a new trigger. In your trigger, do the following things:

Code:
 Events - Generic Unit Event - A Unit Enters <region name here>

Conditions - Unit Type Comparison - (Triggering Unit )) is Equal To <your hero selector>

Actions - Create Unit(s) - Create 1 (your hero here) for owner of (triggering unit )) 
at center of <your region here> facing default building degrees

And thats the hero select! What else can i show you... how about units spawn and get ordered targeting a specific point? Eh? :)

K, this is an easy one too, personally, I had to have help in the begining.. I was a n00b at map editing... :( LOL! =) Anyway, (thnx guys!!)

Heres unit spawn and move:

Code:
 Events - Timed event - every x seconds of the game

Conditions - 

Actions - Create Unit(s) - Create x  <your unit here> for (a team of ur choice) 
at <your region here> facing default building degrees

Thats the spawn, now the move!

Code:
Events - Generic Unit Event - A Unit Enters <spawn region>

Conditions - Player Comparison -  Owner of (Triggering Unit )) 
Is Equal To <Player that gets the spawned units>

Actions - Unit group - Pick every unit in <spawn region> and do
Unit group - Order units in <spawn region> to move to <another region that they move to>

And that concludes that... Hmm.... what else do people like... lol Oh i no... check this out, good for city levels.. opening and closing stuff, destroying stuff, ect.. on command of typing!

Now this is gonna be how to kill a unit when you type something..

First, put a unit on the map, and then make a trigger like this:

Code:
 Events - Player chat message - 
Player 1 Red Types A Chat Message -kill <your unit here> as an exact match

Actions - Kill Unit - Kill <your unit here>
Ah i dono.. just something funny.. lol..

I'll have more tutorials as soon as my hands stop aching from all this typing.. :)
 
D

DU_CyNiCaL_oNe

Guest
Ok, You got the original ability tutorial, so now, May i present to u...
- ! Advanced Ability Tutorial ! -

We'll Start out with Buffs/Effects ..

Heres an explanation of what they are.. An effect, is something that happens when something is casted/attacked/ect.. a buff is what happens while the effect is taking place.. So for an example. An assassin, Has slow poison.. When it hits a unit, it gets slowed, and takes damage over time.. Notice the icon of "slow poison" on the attacked unit. That is a buff. To create Your own custom ability with custom buffs/effects, go to Buffs/Effects and click create new buff. Heres something really cool you could do..Make a buff with the base of flame strike. Now, for it to be REALLY cool, make a new buff, call it whatever you want. Make the base of it, Earthquake. Change the Art - Target model to Spawned Effects - UDeath. Change the tooltips and stuff to (Your text here). Now.. Go back and create a new ability called (I dont really care what you call it). Now, goto Art - Target and find your custom buff. Now, get the other one and put it under Art - Caster. Now what happens you ask? You would use the skill, targeting the ground or another unit, and when you do, you know when an undead building dies? that little explosion? Thats what happens, but not only does it explode ONCE, it explodes about 100 times, causing damage each time.

Phew.. my hands hurt again.. ;) I'll be back with more soon!
 

Grurf

Ultra Cool Member
Reaction score
30
Blink Strike Variation

This is a variation on Blink Strike. Instead of attacking a single target, the unit jumps around and attacks a random enemy unit every time. Feel free to adjust this trigger, feel free to use it without credits (although I would like it if you did credit me). This trigger uses the channeling ability Spiritual Rage, if you want it to work give your unit a channeling ability with the same name or change the name inside the trigger.

Code:
Event:
Unit - A unit Starts the effect of an ability
Conditions:
(Ability being cast) Equal to Spiritual Rage
Actions:
For each (Integer A) from 1 to ((Level of Spiritual Rage  for (Triggering unit)) x 5), do (Actions)
    Loop - Actions
        Set SpiritualRageTarget = (Random unit from (Units within 512.00 of (Position of (Triggering unit)) matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True))))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                SpiritualRageTarget Equal to No unit
            Then - Actions
                Skip remaining actions
            Else - Actions
                Lightning - Create a lightning effect Magic Leash (Position of (Triggering unit)) (Position of SpiritualRageTarget)
                Unit - Move (Triggering unit) instantly to (Position of SpiritualRageTarget)
                Unit - Make (Triggering unit) face SpiritualRageTarget over 0.00 seconds
                Animation - Play (Triggering unit)'s attack animation
                Unit - Order (Triggering unit) to damage SpiritualRageTarget for (((Power(3.00, (Real((Level of Spiritual Rage  for (Triggering unit)))))) x (10.00 x (Random real number between 1.00 and 3.00))) + 1.00) using attack type Chaos and damage type Normal.
                Wait 0.25 seconds
                Lightning - Destroy (Last created lightning effect)
                Set SpiritualRageTarget = No unit
                Unit Group - Destroy unit group (Last created unit group)

Edit:

Couldn't sleep, fixed all warnings :p
 

Nenad

~Choco Coronet~ Omnomnom
Reaction score
137
Morphing a unit at the end of a spell

Yup this is my first post in the free trigger section

So, say u want to make an RPG map with ure heros as elementals (water,fire)
and when they cast certain spells u want them to morph to the end of them (well at least to the point where the target was) like water-wave or fire-breath of fire then use this trigger

Code:
Events - A unit begins casting an ability
Conditions - Ability being cast equal to Wave 
Actions - Wait 0.20 seconds 
          Unit - Move Triggering unit (instantly) to (target point of ability being cast)

Thats all there is to it now if u want u can tamper with the time but i suggest u leave it at 0.20 becouse it gets the best effect and the map doesnt miss the trigger
 
P

Persen

Guest
Well, heres a usefull trigger for creating spells like immolation or defend (toggle)

Code:
    Events
        Unit - A unit Is issued an order with no target
    Conditions
        Or - Any (Conditions) are true
                (Unit-type of (Ordered unit)) Equal to No unit-type
        Or - Any (Conditions) are true
            Conditions
                (Issued order) Equal to (Order(defend)) //CHANGE
                (Issued order) Equal to (Order(undefend)) //CHANGE
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Issued order) Equal to (Order(defend)) //CHANGE
            Then - Actions
                Unit - Make (Ordered unit) Invulnerable //CHANGE
                Skip remaining actions
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Issued order) Equal to (Order(undefend)) //CHANGE
            Then - Actions
                Unit - Make (Ordered unit) Vulnerable //CHANGE
                Skip remaining actions
            Else - Actions
 

Im_On_56k

Hm...
Reaction score
116
Here is a jass script i found at www.wc3sear.ch
Exact link: http://wc3sear.ch/index.php?p=JASS&ID=284&sid=

Note: I did not make this, just thought this would be extremely useful for people.

This script was made by Blade.dk2 at www.wc3sear.ch
-------------------------------------------------------
This script resets the cooldown for a specific ability.

How it does this is, it removes the ability, then adds it again, and sets it back to the original level of the ability.

Code:
Jass Text Name: UnitResetCooldownSpecific
Code:
function UnitResetCooldownSpecific takes unit whichUnit, integer abilcode returns nothing
    local integer level = GetUnitAbilityLevel(whichUnit, abilcode)
    if (level > 0) then 
        call UnitRemoveAbility(whichUnit, abilcode)
        call UnitAddAbility(whichUnit, abilcode)
        call SetUnitAbilityLevel(whichUnit, abilcode, level)
    endif
endfunction
 

Rad

...
Reaction score
228
Simple Nova System

Code:
Fire Nova
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Fire Nova 
    Actions
        Set Abil_FNova_Point = (Position of (Casting unit))
        Set Abil_FNova_Caster = (Casting unit)
        For each (Integer A) from 1 to (4 + ((Level of Fire Nova  for Abil_FNova_Caster) x 2)), do (Actions)
            Loop - Actions
                Unit - Create 1 Dummy for (Owner of Abil_FNova_Caster) at Abil_FNova_Point facing Default building degrees
                Unit - Set level of firenova  for (Last created unit) to 1
                Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
                Unit - Order (Last created unit) to Undead Dreadlord - Carrion Swarm (Abil_FNova_Point offset by 50.00 towards ((Real((Integer A))) x (360.00 / (4.00 + ((Real((Level of Fire Nova  for Abil_FNova_Caster))) x 2.00)))) degrees)

Requires a unit (Abil_FNova_Caster) and point(Abil_FNova_Point) variable, carrion swarm(firenova) with the nova data (per missile), dummy instant-cast ability(Fire Nova) with the art and mana that you give to the hero.
This works for multi-level nova's and each level will increase number of projectiles be 2.
 

Rabarber

You can change this now in User CP.
Reaction score
94
This is a code that makes units fly into the air, and fall down, taking damage.

Code:
Golem flight
    Events
        Unit - A unit Is attacked
    Conditions
        (Unit-type of (Attacking unit)) Equal to <[b]enter hero unit type here[/b]>
    Actions
        Set attacker = (Attacking unit)
        Set tempUnit = (Attacked unit)
        Unit - Add Storm Crow Form to tempUnit
        Unit - Remove Storm Crow Form from tempUnit
        Unit - Make tempUnit Invulnerable
        Unit - Pause tempUnit
        Animation - Change tempUnit flying height to 410.00 at 270.00
        Wait 1.00 seconds
        Animation - Change tempUnit flying height to 0.00 at 330.00
        Wait 0.70 seconds
        Special Effect - Create a special effect attached to the origin of tempUnit using Abilities\Spells\Orc\WarStomp\WarStompCaster.mdl
        Unit - Make tempUnit Vulnerable
        Unit - Unpause tempUnit
        Set TempSpecEffect = (Last created special effect)
        Unit - Cause attacker to damage tempUnit, dealing (Random real number between 32.00 and 55.00) damage of attack type Normal and damage type Demolition
        Wait 0.20 seconds
        Special Effect - Destroy TempSpecEffect
This only works for one unit, so use it as a hero special effect. If you want, add sounds and targets allowed. Looks kind of nice though.
 
D

Dino.pl

Guest
Flashbang Trigger

Flashbang Trigger by Dino.pl

It invokes a blinding flash when a flashbang is "thrown".
Its power depends on unit's facing and distance from the exploding flashbang.

You need:
-a global array unit variable "unit" (array dimensions 0-11 -> player 1 - player 12)
-an ability with point target
-a unit assigned to the "unit" array (with the Flashbang ability of course)

Trigger Flashbang:
Code:
function Trig_Flashbang_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A001' //replace this with your ability code
endfunction

function Trig_Flashbang_Actions takes nothing returns nothing
    local boolean my_boolean
    local location my_locationTarget = GetSpellTargetLoc()
    local location my_location
    local real my_realAngle
    local real my_realDist
    local real my_real
    local integer my_loopIndex = 0
    if (bj_cineFadeContinueTimer != null) then
        call DestroyTimer(bj_cineFadeContinueTimer)
    endif
    if (bj_cineFadeFinishTimer != null) then
        call DestroyTimer(bj_cineFadeFinishTimer)
    endif
    loop
        exitwhen my_loopIndex > 11
        set my_boolean = true
        set my_location = GetUnitLoc(udg_unit[my_loopIndex])
        set my_realDist = DistanceBetweenPoints(my_location, my_locationTarget)
        if (my_realDist == 0) then
            set my_real = 1
        else
            set my_realAngle = getAngle(udg_unit[my_loopIndex], my_locationTarget)
            set my_real = 384 / (my_realDist * (0.5 + my_realAngle / 360))
            if (my_real < .2) then
                set my_boolean = false
            endif
            if (my_real > 1) then
                set my_real = 1
            endif
        endif
        if (GetLocalPlayer() == Player(my_loopIndex)) then
            call SetCineFilterTexture("ReplaceableTextures\\CameraMasks\\White_mask.blp")
            call SetCineFilterBlendMode(BLEND_MODE_BLEND)
            call SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE)
            call SetCineFilterStartUV(0, 0, 1, 1)
            call SetCineFilterEndUV(0, 0, 1, 1)
            call SetCineFilterStartColor(255, 255, 255, R2I(255 * my_real))
            call SetCineFilterEndColor(255, 255, 255, 0)
            call SetCineFilterDuration(4 * my_real)
            call DisplayCineFilter(true)
        endif
        set my_loopIndex = my_loopIndex + 1
    endloop
    call RemoveLocation(my_location)
    call RemoveLocation(my_locationTarget)
    set my_location = null
    set my_locationTarget = null
endfunction

function InitTrig_Flashbang takes nothing returns nothing
    local integer index = 0
    set gg_trg_Flashbang = CreateTrigger(  )
    loop
        call TriggerRegisterPlayerUnitEvent(gg_trg_Flashbang, Player(index), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
        set index = index + 1
        exitwhen index == 11
    endloop
    call TriggerAddCondition( gg_trg_Flashbang, Condition( function Trig_Flashbang_Conditions ) )
    call TriggerAddAction( gg_trg_Flashbang, function Trig_Flashbang_Actions )
endfunction
And function getAngle (in Custom Script Code):
Code:
function getAngle takes unit get_unit, location get_location returns real
    local real my_real = bj_RADTODEG * Atan2(GetLocationY(get_location) - GetUnitY(get_unit), GetLocationX(get_location) - GetUnitX(get_unit)) - GetUnitFacing(get_unit)
    if (my_real < 0) then
        set my_real = -my_real
    endif
    if (my_real > 180) then
        return 360 - my_real
    endif
    return my_real
endfunction
(thx to Orc_Tamer for submiting and thx to AceHart for changing post's owner)
 

Deathbedeli2

New Member
Reaction score
18
*Off Topic* Um kroff, People would know you thought of it first because the date of the this post would be earlyer then any other persons post.

*On Topic*

Positive/Negative Charge Damage -
When a unit is attack by a "Positive Charged" unit, The attacked unit is given a "Positive Charged" Status.
When a unit is attack by a "Negative Charged" unit, The attacked unit is given a "Negative Charged" Status.
When a unit has both a "Positive Charged Status" and "Negative Charged Status" it causes the unit to be unstable and be damaged for a large amount of damage, Once the unit has become damage it will revert to a stable form and restart the process anew.

Code:
Charge Towers
    Events
        Unit - A unit Is attacked
    Conditions
        ((Unit-type of (Attacking unit)) Equal to Positive Charge) or ((Unit-type of (Attacking unit)) Equal to Negative Charge)
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Triggering unit) has buff Positive Charge ) Equal to False
                (Unit-type of (Attacking unit)) Equal to Positive Charge
            Then - Actions
                Unit - Add Positive Charge  to (Attacked unit)
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Triggering unit) has buff Negative Charge ) Equal to True
                    Then - Actions
                        Unit - Remove Positive Charge  from (Attacked unit)
                        Unit - Remove Negative Charge  from (Attacked unit)
                        Unit - Cause (Attacking unit) to damage circular area after 0.00 seconds of radius 50.00 at (Position of (Attacked unit)), dealing 500.00 damage of attack type Chaos and damage type Universal
                    Else - Actions
                        Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Triggering unit) has buff Negative Charge ) Equal to False
                (Unit-type of (Attacking unit)) Equal to Negative Charge
            Then - Actions
                Unit - Add Negative Charge  to (Attacked unit)
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Triggering unit) has buff Positive Charge ) Equal to True
                    Then - Actions
                        Unit - Remove Negative Charge  from (Attacked unit)
                        Unit - Remove Positive Charge  from (Attacked unit)
                        Unit - Cause (Attacking unit) to damage circular area after 0.00 seconds of radius 50.00 at (Position of (Attacked unit)), dealing 500.00 damage of attack type Chaos and damage type Universal
                    Else - Actions
                        Do nothing
 

Tonks

New Member
Reaction score
160
Jumping Region Trigger

This is something for mazes in particular, but I suppose it could come in handy in some other games. It makes your unit "Jump" when it hits a certain region. The jump makes the unit rise in the air, wait three seconds, and fall back down. NOTE: Only work on flying units, so change the unit>Movement Type to Fly.
Code:
[B][U]Jump[/U]-[/B]
[B]Event-[/B]
Unit enters Jump Region
[B]Condition-[/B]
Owner of Triggering unit equal to Player 1 (Red)
[B]Action-[/B]
Trigger- Turn off (Kill red's unit) [I]*MAZE ONLY*[/I]
Animation- Change (Triggering unit) flying height to [U]350.00[/U] at [U]350.00[/U]
Wait [U]3.00[/U] seconds
Animation- Change (Triggering unit) flying height to 0.00 at [U]350.00[/U]
Trigger- Turn on (Kill Red's Unit) [I]*MAZE ONLY*[/I]
I suppose you could also make it so when the player presses esc key it makes them jump. To do that, you would want this trigger:
Code:
[B]Event-[/B]
Player 1 (Red) skips a cinematic sequence
[I]*I know that the event looks wrong, but trust me this works. Test it out in a map if you don't believe me :)*[/I]
[B]Condition-[/B]
None
[B]Action-[/B]
Trigger- Turn off (Kill red's unit) [I]*MAZE ONLY*[/I]
Unit Group- Pick every unit in (Units selected by Player 1 (Red) and do (Animation- Change (Picked unit) flying height to [U]350.00[/U] at [U]350.00[/U])
Wait [U]3.00[/U] seconds
Unit Group- Pick every unit in (Units selected by Player 1 (Red) and do (Animation- Change (Picked unit) flying height to [U]0.00[/U] at [U]350.00[/U])
Trigger- Turn on (Kill Red's Unit) [I]*MAZE ONLY*[/I]
Also, you could make it so that they can only use the ESC key to jump when their unit is in a certain region. To do that you would add this condition to the above trigger:
Code:
"Units in (Jump Region) owned by Player 1 (Red) is [U]equal[/U] to 1"
There is also another way to make them jump. You could make it so that when they press S or H (or click Stop or Hold Position) they jump. To do that, simple replace the event in the above trigger with:
Code:
([U]Unit[/U]) is issued an order with no target
Hope this helps :D
 
Status
Not open for further replies.
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