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

Rock Dance

Rock Dance v1.5
by LeoNguyen112


Description

Creates a rock that jumps forwardly. When to rock hit the ground, it deals damage to nearby enemy units.
The rock travels for 1200 range and then jump back to where it started. Damage is dealt twice.

Level 1- 180 total damage.
Level 2 - 240 total damage.
Level 3 - 300 total damage.
Level 4 - 360 total damage.


Installing

This spell requires Unit Indexer by Bribe
  1. Open your map, open this map.
  2. Go to File -> Preferences -> Make sure you had checked Automatically create unknown variables while
    pasting trigger data
    .
  3. Install Unit Indexer to your map
  4. Copy trigger Rock Setting into your map.
  5. Copy trigger Rock Creating into your map.
  6. Copy trigger Rock Loop into your map.
  7. Create a rock dummy.
  8. Create a custom spell.
  9. Go to trigger Rock Setting, edit these actions to what you want:
    • Set RD_Dummy = Rock
    • Set RD_Effect[1] = Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
    • Set RD_Effect[2] = Abilities\Spells\Other\Volcano\VolcanoDeath.mdl
    • Set RD_Effect[3] = Abilities\Spells\Other\Volcano\VolcanoMissile.mdl
    • Set RD_JumpHeight = 55.00
    • Set RD_JumpTimes = 4
    • Set RD_JumpDistance = 300.00
    • Set RD_DamageBase = 60
    • Set RD_DamagePerLevel = 30
    • Set RD_JumpSpeed = 20.00
    • Set RD_AOE = 175.00
  10. Changed the conditions of trigger Rock Creating into:
    • (Ability being cast) Equal to YourSpell
  11. It is installed.

Please give me credit if you use this spell in your map.
Special Thanks To

Tank-Commander for helping me with the code.

  • Rock Setting
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Set RD_Dummy = Rock
      • Set RD_Effect[1] = Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
      • Set RD_Effect[2] = Abilities\Spells\Other\Volcano\VolcanoDeath.mdl
      • Set RD_Effect[3] = Abilities\Spells\Other\Volcano\VolcanoMissile.mdl
      • Set RD_JumpHeight = 55.00
      • Set RD_JumpTimes = 4
      • Set RD_JumpDistance = 300.00
      • Set RD_DamageBase = 60.00
      • Set RD_DamagePerLevel = 30.00
      • Set RD_JumpSpeed = 20.00
      • Set RD_AOE = 175.00
  • Rock Creating
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Rock Dance
    • Actions
      • Set RD_Caster[0] = (Triggering unit)
      • Set RD_Point[1] = (Position of RD_Caster[0])
      • Set RD_Point[2] = (Target point of ability being cast)
      • Unit - Create 1 RD_Dummy for (Owner of RD_Caster[0]) at RD_Point[1] facing (Angle from RD_Point[1] to RD_Point[2]) degrees
      • Set RD_ID = (Custom value of (Last created unit))
      • Unit Group - Add (Last created unit) to RD_DummyGroup
      • Unit - Add Crow Form to (Last created unit)
      • Unit - Remove Crow Form from (Last created unit)
      • Animation - Play (Last created unit)'s birth animation
      • Set RD_CasterPoint[RD_ID] = (Position of RD_Caster[0])
      • Set RD_TargetPoint[RD_ID] = (RD_Point[1] offset by (RD_JumpDistance x (Real(RD_JumpTimes))) towards (Angle from RD_Point[1] to RD_Point[2]) degrees)
      • Set RD_TempPoint[RD_ID] = (RD_Point[1] offset by RD_JumpDistance towards (Angle from RD_Point[1] to RD_TargetPoint[RD_ID]) degrees)
      • Set RD_Damage[RD_ID] = (RD_DamageBase + (RD_DamagePerLevel x (Real((Level of (Ability being cast) for RD_Caster[0])))))
      • Set RD_Caster[RD_ID] = RD_Caster[0]
      • Set RD_Check[RD_ID] = False
      • Custom script: call RemoveLocation(udg_RD_Point[1])
      • Custom script: call RemoveLocation(udg_RD_Point[2])
      • Trigger - Turn on Rock Loop <gen>
  • Rock Loop
    • 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
          • (Number of units in RD_DummyGroup) Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Unit Group - Pick every unit in RD_DummyGroup and do (Actions)
            • Loop - Actions
              • Set RD_TempUnit = (Picked unit)
              • Set RD_Index = (Custom value of RD_TempUnit)
              • Set RD_Point[1] = (Position of RD_TempUnit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Distance between RD_Point[1] and RD_CasterPoint[RD_Index]) Less than or equal to (RD_JumpSpeed / 2.00)
                  • RD_Check[RD_Index] Equal to True
                • Then - Actions
                  • For each (Integer A) from 1 to 20, do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • RD_Effect[(Integer A)] Not equal to Empty String
                        • Then - Actions
                          • Special Effect - Create a special effect at RD_Point[1] using RD_Effect[(Integer A)]
                          • Special Effect - Destroy (Last created special effect)
                        • Else - Actions
                  • Custom script: call RemoveLocation(udg_RD_TargetPoint[udg_RD_Index])
                  • Custom script: call RemoveLocation(udg_RD_TempPoint[udg_RD_Index])
                  • Custom script: call RemoveLocation(udg_RD_CasterPoint[udg_RD_Index])
                  • Custom script: call RemoveLocation(udg_RD_Point[1])
                  • Unit - Remove RD_TempUnit from the game
                • Else - Actions
                  • Set RD_Point[0] = (RD_TempPoint[RD_Index] offset by (RD_JumpDistance / 2.00) towards (Angle from RD_TempPoint[RD_Index] to RD_Point[1]) degrees)
                  • Set RD_Height = (((Distance between RD_Point[1] and RD_Point[0]) / (RD_JumpDistance / 2.00)) x RD_JumpHeight)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Distance between RD_Point[1] and RD_TempPoint[RD_Index]) Greater than or equal to (RD_JumpDistance / 2.00)
                    • Then - Actions
                      • Animation - Change RD_TempUnit flying height to ((Current flying height of RD_TempUnit) + RD_Height) at 0.00
                    • Else - Actions
                      • Animation - Change RD_TempUnit flying height to ((Current flying height of RD_TempUnit) - RD_Height) at 0.00
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Distance between RD_Point[1] and RD_TargetPoint[RD_Index]) Less than (RD_JumpSpeed / 2.00)
                      • RD_Check[RD_Index] Equal to False
                    • Then - Actions
                      • Custom script: call RemoveLocation(udg_RD_TargetPoint[udg_RD_Index])
                      • Set RD_TargetPoint[RD_Index] = RD_CasterPoint[RD_Index]
                      • Set RD_Check[RD_Index] = True
                      • Unit - Make RD_TempUnit face RD_TargetPoint[RD_Index] over 0.00 seconds
                      • Unit Group - Remove all units from RD_TargetGroup[RD_Index]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Distance between RD_Point[1] and RD_TempPoint[RD_Index]) Less than (RD_JumpSpeed / 2.00)
                    • Then - Actions
                      • Set RD_TempPoint[RD_Index] = (RD_Point[1] offset by RD_JumpDistance towards (Angle from RD_Point[1] to RD_TargetPoint[RD_Index]) degrees)
                      • For each (Integer A) from 1 to 20, do (Actions)
                        • Loop - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • RD_Effect[(Integer A)] Not equal to Empty String
                            • Then - Actions
                              • Special Effect - Create a special effect at RD_Point[1] using RD_Effect[(Integer A)]
                              • Special Effect - Destroy (Last created special effect)
                            • Else - Actions
                      • Set RD_TargetGroup[0] = (Units within RD_AOE of RD_Point[1])
                      • Unit Group - Pick every unit in RD_TargetGroup[0] and do (Actions)
                        • Loop - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • ((Picked unit) is A structure) Equal to False
                              • ((Picked unit) is Mechanical) Equal to False
                              • ((Picked unit) is Magic Immune) Equal to False
                              • ((Picked unit) is alive) Equal to True
                              • ((Picked unit) belongs to an enemy of (Owner of RD_Caster[RD_Index])) Equal to True
                              • ((Picked unit) is in RD_TargetGroup[RD_Index]) Equal to False
                            • Then - Actions
                              • Unit - Cause RD_Caster[RD_Index] to damage (Picked unit), dealing RD_Damage[RD_Index] damage of attack type Magic and damage type Magic
                              • Unit Group - Add (Picked unit) to RD_TargetGroup[RD_Index]
                            • Else - Actions
                      • Custom script: call DestroyGroup(udg_RD_TargetGroup[0])
                    • Else - Actions
                  • Set RD_Point[2] = (RD_Point[1] offset by RD_JumpSpeed towards (Angle from RD_Point[1] to RD_TempPoint[RD_Index]) degrees)
                  • Unit - Move RD_TempUnit instantly to RD_Point[2]
                  • Custom script: call RemoveLocation(udg_RD_Point[0])
                  • Custom script: call RemoveLocation(udg_RD_Point[1])
                  • Custom script: call RemoveLocation(udg_RD_Point[2])

Ver1.0

- First upload spell.
Ver 1.1

- Remake allmost code.
- Edit special effect (add volcano effect).
Ver 1.2

- Rewrited description.
- Fixed bug the jumped rock occasionally isn't removed.
- Improved jump code, from now the rock jump smoother.
- Used variable RD_Loop instead of Integer A
- Added turn off code to turn off loop trigger when there is no rock.
- Added volcano missile effect.
- Increased slam AoE from 150 to 175.
Ver 1.3

- From now, user can customize this spell by editting trigger
Rock Setting, there are editable values:
  • Model of the rock
  • Damage
  • Area of effect
  • Special effect (max is 20 effect)
  • Jump speed
  • Jump height
  • Number of jump times
  • Range of each jump
- Changed type of variable RD_Off from Integer to Boolean.
Ver 1.4

- Used 2 variables to set damage instead of 1.
- Used RD_Caster[0] instead of Triggering Unit.
Ver 1.5
- Changed the way of making it MUI by using Unit Indexer.

Keywords:
rock, dance, earth, stone, jump, orc, leonguyen112, bounce
Contents

Spell - Rock Dance (Map)

Reviews
Magtheridon96: Approved. Your current handling of the locations is pretty ugly :/ Still, I read through it and found no leaks. The triggers are okay. Just a tip, in the cast trigger, since you're repeating the angle calculation, you might as...

Moderator

M

Moderator

Magtheridon96:
Approved.

Your current handling of the locations is pretty ugly :/
Still, I read through it and found no leaks.
The triggers are okay.

Just a tip, in the cast trigger, since you're repeating the angle calculation, you might as well cache it into a variable and reuse it.
Also, instead of using those location arrays, use normal variables.

Also, use Map initialization instead of the 0 second game time event.

160036-albums4747-picture55861.png

Moderator: Pharaoh_
Date: 03:47, 24th Apr 2012

Review
Fix your indexing. Use Hanky's or Bribe's templates, located here, in the Spells section.

29 Oct 2011
Bribe: Use Hanky's Dynamic Indexing. Looping 1-50 is "MUI" but the logic you're using via that method is absolutely terrible and the load on the CPU is way higher than necessary.

http://www.hiveworkshop.com/forums/spells-569/gui-dynamic-indexing-template-144325
 
Level 12
Joined
Apr 16, 2010
Messages
584
Suggestions

- don't use Unit - A unit Begins casting an ability, instead of that use
Unit - A unit Starts the effect of an ability;
- don't use custom value of unit;
- the way you make it MUI isn't to good (use better indexing system), also the loop trigger is always on;
- instead of Casting unit use Triggering unit;
- remove Point Value from dummy in OE;
- create another variable for Target point of ability being cast;
- you don't remove TempPoint2 in Rock Dance;
- use parabola equation to make the flying of ball smooth;
- in action where you change Height you use 1000000000.00 value use 0;
- in second trigger in TempGroup you pick dead units;
- tutorial how to improve your spell: [self="http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/multi-instancible-gui-spell-making-34393/"]MUI[/self]
- when the ball must die you first remove him then kill, why? Better kill him;
- i also don't understand what is with that RD_TargetGroup and you never destroy it;
- why you use those actions
  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Distance between TempPoint and RD_TargetPoint[TempValue]) Less than or equal to (<=) 10.00
    • Then - Actions
      • Set RD_TargetPoint[TempValue] = RD_CasterPoint[TempValue]
      • Unit Group - Remove all units from RD_TargetGroup[TempValue]
    • Else - Actions
if you already have same action at beginning of loop? Just clear the RD_TargetGroup in first If/Then/Else, where you should turn off loop.
I guess that's all, and btw this spell is very similar to mine... So you could something that mine doesn't have so it would be more original idea.
Voting

3/5 Haven't decided for what to vote, for now
 
Suggestions

- don't use Unit - A unit Begins casting an ability, instead of that use
Unit - A unit Starts the effect of an ability;
- don't use custom value of unit;
- the way you make it MUI isn't to good (use better indexing system), also the loop trigger is always on;
- instead of Casting unit use Triggering unit;
- remove Point Value from dummy in OE;
- create another variable for Target point of ability being cast;
- you don't remove TempPoint2 in Rock Dance;
- use parabola equation to make the flying of ball smooth;
- in action where you change Height you use 1000000000.00 value use 0;
- in second trigger in TempGroup you pick dead units;
- tutorial how to improve your spell: [self="http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/multi-instancible-gui-spell-making-34393/"]MUI[/self]
- when the ball must die you first remove him then kill, why? Better kill him;
- i also don't understand what is with that RD_TargetGroup and you never destroy it;
- why you use those actions
  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Distance between TempPoint and RD_TargetPoint[TempValue]) Less than or equal to (<=) 10.00
    • Then - Actions
      • Set RD_TargetPoint[TempValue] = RD_CasterPoint[TempValue]
      • Unit Group - Remove all units from RD_TargetGroup[TempValue]
    • Else - Actions
if you already have same action at beginning of loop? Just clear the RD_TargetGroup in first If/Then/Else, where you should turn off loop.
I guess that's all, and btw this spell is very similar to mine... So you could something that mine doesn't have so it would be more original idea.
Voting

3/5 Haven't decided for what to vote, for now
Ah, my bad, I have fixed it. But somethings you said I don't understand (sorry because my bad English, I'm VietNamese) I'll keep learning, thanks for your help. :)
 
Level 7
Joined
Dec 19, 2009
Messages
249
RD_Group don't leak because you haven't set it... so you don't need to destroy it.

in "Rock Dance Move" trigger, would be nice if you could put "picked unit" into a variable.

In the first trigger , you set two times the positions of triggering unit when only one could do the job

In the first trigger , you set this but you never use it...
  • Set RD_Unit[MUI] = (Last created unit)
 
Level 11
Joined
Jan 25, 2009
Messages
572
The first thing I see in your code that can be better is the RD_TempPoint1/2/3. To make your spell as small in bytes as possible, you should make the RD_TempPoint into one variable with Array to store the Locafions into. Also, it's easier to work with less Triggers if you or someone else want to modify it in the future.

Secondly, you shall avoid changing Custom Values of units because thats not the right way to handle with a 'bunch' of units. Instead of using this Custom Value you should create another Variable (Integer) and do as other people do it MUI.

Now I cant see anything more than that u should place every action in all the (If/Then/Else) with the condition "If Distace between 'variable1' and 'variable2' is less than or equal to 10.00" into ONE (If/Then/Else). Otherwise you check the same thing over and over again when u dont need to.

Now I'm dine here. I wrote all this from my iPhone 4 so I hope that you really appreciate it. Have a good day/night fella'!
 
Level 5
Joined
Oct 13, 2010
Messages
84
An array variable would take more space than 3 non-array?

@MortAr; tjordell:
GUI array allows you change the size. But this size is used for initiating default values. In the fact, the array of variable RD_TempPoint is still 8192
~ Then the answer is YES.

jass array is a other situation, if creating like this: udg_RD_TempPoint[3]
~ Then the answer is that they are no different. They take the same space

You should know that even you not use, it will take some space after the initiation
 
Your jump damage modification in the config won't actually work for levelling, considering it'll be set once (i.e. the level of the ability of triggering unit == 0) and thus regardless of if the ability is level 3 it'll be the same strength as level 1 (60 damage) even though level 1 should deal 90 and level 3 should deal 150
I'd suggest having two variables of the each configurable: One for BASE stat, and one for PER LEVEL stats, I.e. Jump_Damage_Base = 60, Jump_Damage_Per_Level = 30 and then do the calculation for it at the start of the spell being run:
  • Set RD_Damage[RD_MUI] = RD_Jump_Damage_Base + (Jump_Damage_Per_Level * (Level of Ability for (Triggering unit)))
Repeat the process for all the other configurables as well (even if the Per_Level version is 0.00/0 so that it gives a greater freedom to all the users of the spell, this'd be in your case, AOE, Jump Times and prehaps jump speed) as the others there is no purpose in having them change per level to increase/decrease the overall power of the spell.

EDIT: you should also use that Caster Variable in your casting trigger to replace all the (Triggering Unit) brackets which'll appear if you do that formula I gave above for all your configurations
 
^ I don't think so. There is still one trigger named Rock Setting that I didn't post. That trigger have event "Unit begin casting an ability". I mean every time the unit cast spell, trigger will set damage = 60 + 30 x current level of spell. So, the damage is updated every casting times.

EDIT: you should also use that Caster Variable in your casting trigger to replace all the (Triggering Unit) brackets which'll appear if you do that formula I gave above for all your configurations

I'll do this.
 
um, that really should not be how you set up a configuration, the configuration should be set-up on map initialisation and /never/ change, considering with the current setup if one is "starts casting" and "starts the effect of" then there is a small window for creating bugs, of course since only damage is the one which changes between levels, it'd be harder to notice, but still existent - i.e. this'd make it possible for a level 3 spell to be equally powerful as a level 1 spell if they casted it at the right time (and vice versa)

Setting the variables to alter for the unit should be done /in the same trigger/ as "starts the effect of" and those should only be using configurables and the level of the ability, it's not good to see configurables being set at the same place, as it takes up unecessary processing to run the set variable script when it's trying to change it to the exact same thing.
 
Level 13
Joined
May 10, 2009
Messages
868
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • RD_Effect[(Integer A)] Not equal to Unknown
    • Then - Actions
    • Else - Actions
Or:
JASS:
if ( not ( udg_RD_Effect[GetForLoopIndexA()] != Error ) ) then

"Comparing two variables of differents primitive types (except real and integer) is not allowed"

I think that condition is useless though. Why anyone wouldn't put effects? People cannot import your spell into their map.
 
Top