• 🏆 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!

Avalanche - v0.2

Scroll down for description.

*some letters to fill this box with at least 30 letters*

Keywords:
avalanche, stone, rock, fall, onix, xaos_wizard, dark_g4nd4lf
Contents

Avalanche (Map)

Reviews
20:28, 8th Dec 2009 TriggerHappy: Review for Spell Coding was good as far as I could see. Effect was cool too. Status Green

Moderator

M

Moderator

20:28, 8th Dec 2009
TriggerHappy:

Review for Spell

Coding was good as far as I could see.
Effect was cool too.

Status

Green
 
Level 19
Joined
Feb 4, 2009
Messages
1,313
JASS:
========================================

          XAOS_WIZARD presents

========================================

               Avalanche

                 v.0.1

========================================


This spell uses indexing two times
One loop for the channeling stuff and the spawning of the stones
And another loop to make the stones fly down, bounce, etc.

If you don't understand everything visit the hiveworkshop
There is a good tutorial section
Some of these things as MUI/Indexing is explained by some spells in the spell section, too
How to detect trees? - Look at my signature

If that didn't help you feel free to ask in the corresponding thread

Instructions:
-Don't modify the human worker
1. Copy all abilitys
2. Copy the Dummy
3. Copy the triggers

A lot of spell data is stored in the ability "Avalanche Stun" so you should watch at it closely
It is not recommended to modify anything but the things with comments unless you know what you are doing of cause
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Avalanche
  • Actions
    • -------- Indexing --------
    • Set Avalanche_Max = (Avalanche_Max + 1)
    • Set Avalanche_Caster[Avalanche_Max] = (Triggering unit)
    • Set Avalanche_Location[Avalanche_Max] = (Target point of ability being cast)
    • Trigger - Turn on AvalancheLoop <gen>
    • -------- Creates a dummy to check if a destructable is a tree --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • harvester Equal to No unit
      • Then - Actions
        • Set loc = (Point(0.00, 0.00))
        • Unit - Create 1 Peasant for Neutral Passive at loc facing Default building facing degrees
        • Custom script: call RemoveLocation( udg_loc )
        • Set harvester = (Last created unit)
        • Unit - Make (Last created unit) Invulnerable
        • Unit - Hide (Last created unit)
      • Else - Actions
  • Events
    • Time - Every 0.03 seconds of game time
  • Conditions
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Avalanche_Max Less than 1
      • Then - Actions
        • Trigger - Turn off (This trigger)
      • Else - Actions
        • For each (Integer i) from 1 to Avalanche_Max, do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Current order of Avalanche_Caster[i]) Equal to (Order(channel))
                • Avalanche_Caster[i] Not equal to No unit
                • (Avalanche_Caster[i] is dead) Equal to False
              • Then - Actions
                • -------- Set 10 to the ammount of stones which will be spawned per second --------
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Random integer number between 1 and 33) Less than 10
                  • Then - Actions
                    • Set Avalanche_Stone_Max = (Avalanche_Stone_Max + 1)
                    • Set loc = (Avalanche_Location[i] offset by (Random real number between 0.00 and 300.00) towards (Random real number between 0.00 and 360.00) degrees)
                    • Unit - Create 1 Avalanche_Dummy for (Owner of Avalanche_Caster[i]) at loc facing (Random real number between 0.00 and 360.00) degrees
                    • Custom script: call RemoveLocation( udg_loc )
                    • Unit - Set level of Avalanche_Stun for (Last created unit) to (Level of Avalanche for Avalanche_Caster[i])
                    • Set Avalanche_Stone_Dummy[Avalanche_Stone_Max] = (Last created unit)
                    • Set Avalanche_Stone_Caster[Avalanche_Stone_Max] = Avalanche_Caster[i]
                    • Set Avalanche_Stone_Instance[Avalanche_Stone_Max] = 0
                    • -------- This is the height from which the stones start falling down --------
                    • Set Avalanche_Stone_Distance[((Avalanche_Stone_Max x 2) + 1)] = 1000.00
                    • -------- This is the start point of the fall --------
                    • -------- It's parabolic movement so it makes sence to set this to 1/2 of the one before --------
                    • Set Avalanche_Stone_Distance[(Avalanche_Stone_Max x 2)] = 500.00
                    • Trigger - Turn on AvalancheStoneLoop <gen>
                  • Else - Actions
              • Else - Actions
                • Custom script: call RemoveLocation( udg_Avalanche_Location[udg_i] )
                • Set Avalanche_Location[i] = Avalanche_Location[Avalanche_Max]
                • Set Avalanche_Caster[i] = Avalanche_Caster[Avalanche_Max]
                • Set Avalanche_Max = (Avalanche_Max - 1)
                • Set i = (i - 1)
  • Events
    • Time - Every 0.03 seconds of game time
  • Conditions
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Avalanche_Stone_Max Less than 1
      • Then - Actions
        • Trigger - Turn off (This trigger)
      • Else - Actions
        • For each (Integer i) from 1 to Avalanche_Stone_Max, do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Avalanche_Stone_Instance[i] Less than 4
              • Then - Actions
                • -------- 10 is the speed at which the stones fall to ground --------
                • Set Avalanche_Stone_Distance[(i x 2)] = (Avalanche_Stone_Distance[(i x 2)] + 10.00)
                • Set u = Avalanche_Stone_Dummy[i]
                • -------- Change flying height --------
                • Animation - Change u flying height to ((((Avalanche_Stone_Distance[((i x 2) + 1)] x 4.00) x Avalanche_Stone_Distance[(i x 2)]) x (Avalanche_Stone_Distance[((i x 2) + 1)] - Avalanche_Stone_Distance[(i x 2)])) / (Avalanche_Stone_Distance[((i x 2) + 1)] x Avalanche_Stone_Distance[((i x 2) + 1)])) at 0.00
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • Avalanche_Stone_Instance[i] Not equal to 0
                  • Then - Actions
                    • -------- 2 is the speed at which the stones move around --------
                    • Custom script: call SetUnitX( udg_u, GetUnitX(udg_u)+CosBJ(GetUnitFacing(udg_u))*2)
                    • Custom script: call SetUnitY( udg_u, GetUnitY(udg_u)+SinBJ(GetUnitFacing(udg_u))*2)
                  • Else - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • Avalanche_Stone_Distance[(i x 2)] Greater than or equal to Avalanche_Stone_Distance[((i x 2) + 1)]
                  • Then - Actions
                    • -------- Change size --------
                    • Animation - Change u's size to ((((Real((5 - Avalanche_Stone_Instance[i]))) x 15.00) + 10.00)%, 100.00%, 100.00%) of its original size
                    • Set Avalanche_Stone_Instance[i] = (Avalanche_Stone_Instance[i] + 1)
                    • Set Avalanche_Stone_Distance[(i x 2)] = 0.00
                    • -------- This is the max height of the next bounce --------
                    • Set Avalanche_Stone_Distance[((i x 2) + 1)] = ((Real((5 - Avalanche_Stone_Instance[i]))) x 100.00)
                    • -------- This deals the damage and stun --------
                    • Unit - Order u to Orc Tauren Chieftain - War Stomp
                    • Set loc = (Position of Avalanche_Stone_Dummy[i])
                    • -------- This destroys all trees in the impact area of 128 --------
                    • Destructible - Pick every destructible within 128.00 of loc and do (Actions)
                      • Loop - Actions
                        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          • If - Conditions
                            • ((Picked destructible) is alive) Equal to True
                          • Then - Actions
                            • Custom script: call SetUnitX(udg_harvester, GetWidgetX(GetEnumDestructable() ))
                            • Custom script: call SetUnitY(udg_harvester, GetWidgetY(GetEnumDestructable() ))
                            • Unit - Order harvester to Harvest (Picked destructible)
                            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                              • If - Conditions
                                • (Current order of harvester) Equal to (Order(harvest))
                              • Then - Actions
                                • Destructible - Kill (Picked destructible)
                              • Else - Actions
                            • Unit - Order harvester to Stop
                          • Else - Actions
                    • Special Effect - Create a special effect at loc using Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl
                    • Special Effect - Destroy (Last created special effect)
                    • -------- Change 30 to the chance for split --------
                    • -------- Of cause you can make it split to more then one new stone --------
                    • -------- Just use a for-loop --------
                    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • (Random integer number between 1 and 100) Less than or equal to 30
                      • Then - Actions
                        • Set Avalanche_Stone_Max = (Avalanche_Stone_Max + 1)
                        • Unit - Create 1 Avalanche_Dummy for (Owner of Avalanche_Stone_Caster[i]) at loc facing (Random real number between 0.00 and 360.00) degrees
                        • Animation - Change (Last created unit)'s size to ((((Real((5 - Avalanche_Stone_Instance[i]))) x 15.00) + 10.00)%, 100.00%, 100.00%) of its original size
                        • Unit - Set level of Avalanche Stun for (Last created unit) to (Level of Avalanche for Avalanche_Stone_Caster[i])
                        • Set Avalanche_Stone_Dummy[Avalanche_Stone_Max] = (Last created unit)
                        • Set Avalanche_Stone_Caster[Avalanche_Stone_Max] = Avalanche_Stone_Caster[i]
                        • Set Avalanche_Stone_Instance[Avalanche_Stone_Max] = Avalanche_Stone_Instance[i]
                        • Set Avalanche_Stone_Distance[((Avalanche_Stone_Max x 2) + 1)] = Avalanche_Stone_Distance[((i x 2) + 1)]
                        • Set Avalanche_Stone_Distance[(Avalanche_Stone_Max x 2)] = 0.00
                        • Trigger - Turn on AvalancheStoneLoop <gen>
                      • Else - Actions
                    • Custom script: call RemoveLocation( udg_loc )
                  • Else - Actions
              • Else - Actions
                • Unit - Remove Avalanche_Stone_Dummy[i] from the game
                • Set Avalanche_Stone_Caster[i] = Avalanche_Stone_Caster[Avalanche_Stone_Max]
                • Set Avalanche_Stone_Dummy[i] = Avalanche_Stone_Dummy[Avalanche_Stone_Max]
                • Set Avalanche_Stone_Instance[i] = Avalanche_Stone_Instance[Avalanche_Stone_Max]
                • Set Avalanche_Stone_Distance[(i x 2)] = Avalanche_Stone_Distance[(Avalanche_Stone_Max x 2)]
                • Set Avalanche_Stone_Distance[((i x 2) + 1)] = Avalanche_Stone_Distance[((Avalanche_Stone_Max x 2) + 1)]
                • Set Avalanche_Stone_Max = (Avalanche_Stone_Max - 1)
                • Set i = (i - 1)
edit: o_O screenshot bugged
edit2: fixed, changed sfx, added option for split chance
 
Last edited:
Level 10
Joined
Sep 21, 2007
Messages
517
Well, what can i say? bravo :p 5/5

also make sure to make the sfx on the units loc isntead of himself, cus it looks fake when hes moving and he calls upon the pebbles to fall :p

i prob will have more suggestions but, here is one, use Sin() and Cos() isntead of SinBJ or CosBJ, kk good spell gotta go now >_<
 
Level 19
Joined
Feb 4, 2009
Messages
1,313
the height could be set into a different variable like a parabola wise, else this looks quite could except as Paladon made a likely one and also wont it be possible to have the two loops into one ?

didn't know about paladons but I bet mine is better somehow xD

but I forgot the page where I looked it up back then (switched to Windows 7 and forgot to backup my bookmarks x)

you can set the height of cause

and it would be possible to combine the loops but I'd need dynamic 2D-Arrays (I won't use hashtables since they are slow) or a fixed 2D-Array with a big size likely to the way I did with my hook spell
imho this is the best way but it is a matter of taste I think

Well, what can i say? bravo :p 5/5

also make sure to make the sfx on the units loc isntead of himself, cus it looks fake when hes moving and he calls upon the pebbles to fall :p

i prob will have more suggestions but, here is one, use Sin() and Cos() isntead of SinBJ or CosBJ, kk good spell gotta go now >_<

imho it does not make any difference if I call

SinBJ(angle)
or
Sin(angle*bj_DEGTORAD)

the sfx on the caster is created by the spell itself
however I should consider to change it or trigger it

thanks this far

edit: checked out paladons spell and I have to say I have seen it before ... I just forgot about it xD
however it uses at least 3 times as many variables as I do and it destroys bridges, traps, elevators and stuff like that
the splitt thing is interesting but since my stones fall from above the screen there is no need for fading
and mine is channeling, too
I'll think about something to make it more unique but I have to write a testpaper tomorow so I won't do it today x)

edit: done
greetings @ Paladon xD
 
Last edited:
Level 30
Joined
Dec 6, 2007
Messages
2,228
didn't know about paladons but I bet mine is better somehow xD

Bet accepted.
however it uses at least 3 times as many variables as I do
Guess why.
I have a huge settings panel in the very beginning.
Users, who have no idea for spell triggering won't be able to edit your spell to their needs.
[...]

Whatever, the spells are different and i don't care at all.

Oh, i just found a effect related bug.
Try to cast the spell and order the hero to move while he's channeling.

I guess i just won the bet.
 
Level 2
Joined
Aug 21, 2008
Messages
13
The spell is not channeling, try it out.
Also its very laggy if the spell is casting 3-4x in the same time or very close in a row.

But the spell looks very nice!!
 
Level 19
Joined
Feb 4, 2009
Messages
1,313
The spell is not channeling, try it out.

of cause I tried out the spell before uploading and it worked fine

Also its very laggy if the spell is casting 3-4x in the same time or very close in a row.

this is a testmap to show that the spell will even work with many many stones
you should downscale the number for your map of cause

But the spell looks very nice!!

thanks :grin:

Couldn't you just make rain of fire use rocks instead of fire rocks?

no 'cause:
-the cause of the comets falling down is the model, not the spell
-they move down with a static speed and don't become faster while falling
-they don't split
-it does not stun
 
Top