[Trigger] Bladestorm 1.0 (need help fixing it)

Status
Not open for further replies.
Level 2
Joined
Nov 20, 2009
Messages
4
View attachment Bladestorm v1.0.w3x

my first time noob spell..need help fixing it..
-crush after cast many times.:goblin_cry:

  • Bladestorm1
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Bladestorm
    • Actions
      • Set Bladestorm[(Player number of (Triggering player))] = (Casting unit)
      • Set Bladestorm_Caster_Loc[(Player number of (Triggering player))] = (Position of Bladestorm[(Player number of (Triggering player))])
      • Animation - Change Bladestorm[(Player number of (Triggering player))]'s animation speed to 130.00% of its original speed
      • For each (Integer A) from 0 to 12, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Bladestorm (Standing Blade) for (Owner of Bladestorm[(Player number of (Triggering player))]) at (Bladestorm_Caster_Loc[(Player number of (Triggering player))] offset by 500.00 towards ((Real((Integer A))) x 36.00) degrees) facing Default building facing degrees
          • Unit Group - Add (Last created unit) to Bladestorm_Dummy_Group1[(Player number of (Triggering player))]
      • For each (Integer A) from 0 to 12, do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in Bladestorm_Dummy_Group1[(Player number of (Triggering player))] and do (Actions)
            • Loop - Actions
              • Animation - Change (Picked unit) flying height to ((Current flying height of (Picked unit)) - 50.00) at 200.00
              • Unit - Create 1 Bladestorm Dummy for (Owner of Bladestorm[(Player number of (Triggering player))]) at (Position of (Picked unit)) facing Default building facing degrees
              • Unit Group - Add (Last created unit) to Bladestorm_Dummy_Group3[(Player number of (Triggering player))]
              • Unit - Add a 2.50 second Generic expiration timer to (Picked unit)

  • Bladestorm2
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Bladestorm
    • Actions
      • Unit Group - Pick every unit in Bladestorm_Dummy_Group1[(Player number of (Triggering player))] and do (Actions)
        • Loop - Actions
          • Unit - Remove (Picked unit) from the game
      • For each (Integer A) from 0 to 12, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Bladestorm (Standing Blade up) for (Owner of Bladestorm[(Player number of (Triggering player))]) at (Bladestorm_Caster_Loc[(Player number of (Triggering player))] offset by 500.00 towards ((Real((Integer A))) x 36.00) degrees) facing Default building facing degrees
          • Unit Group - Add (Last created unit) to Bladestorm_Dummy_Group2[(Player number of (Triggering player))]
      • For each (Integer A) from 0 to 12, do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in Bladestorm_Dummy_Group2[(Player number of (Triggering player))] and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Current flying height of (Picked unit)) Less than 200.00
                • Then - Actions
                  • Animation - Change (Picked unit) flying height to ((Current flying height of (Picked unit)) + 50.00) at 250.00
                  • Animation - Change (Picked unit)'s vertex coloring to (100.00%, 0.00%, 0.00%) with 55.00% transparency
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Current flying height of (Picked unit)) Greater than or equal to 200.00
                • Then - Actions
                  • Set Bladestorm_Timer = 0
                  • Trigger - Turn on Bladestorm GEN <gen>
                • Else - Actions
  • Bladestorm GEN
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Animation - Change Bladestorm[(Player number of (Triggering player))]'s animation speed to 100.00% of its original speed
      • Set Bladestorm_Timer = (Bladestorm_Timer + 1)
      • Set Bladestorm_Random[(Player number of (Triggering player))] = (Random unit from Bladestorm_Dummy_Group2[(Player number of (Triggering player))])
      • Set Bladestorm_Enemy_Group[(Player number of (Triggering player))] = (Units within 525.00 of Bladestorm_Caster_Loc[(Player number of (Triggering player))] matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) belongs to an enemy of (Owner of Bladestorm[(Player number of (Triggering player))])) Equa
      • Set Bladestorm_Damage = ((Real((Agility of Bladestorm[(Player number of (Triggering player))] (Include bonuses)))) x (Random real number between (4.00 + (0.25 x (Real((Level of Bladestorm for Bladestorm[(Player number of (Triggering player))]))))) and (6.00 + (0.25 x (Real((Level o
      • Set Bladestorm_Damage_Multiplier = (Bladestorm_Damage x (Random real number between 2.00 and 2.25))
      • Set Blade_Dance_Chance[(Player number of (Triggering player))] = (Random real number between 1.00 and 100.00)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Bladestorm_Timer Less than (30 + (10 x (Level of Bladestorm for Bladestorm[(Player number of (Triggering player))])))
        • Then - Actions
          • Unit Group - Pick every unit in Bladestorm_Enemy_Group[(Player number of (Triggering player))] and do (Actions)
            • Loop - Actions
              • Unit - Set level of Bladestorm Dummy for Bladestorm_Random[(Player number of (Triggering player))] to (Level of Bladestorm for Bladestorm[(Player number of (Triggering player))])
              • Unit - Order Bladestorm_Random[(Player number of (Triggering player))] to Neutral Pandaren Brewmaster - Drunken Haze (Picked unit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Blade_Dance_Chance[(Player number of (Triggering player))] Less than or equal to (10.00 + (3.00 x (Real((Level of Blade Dance for Bladestorm[(Player number of (Triggering player))])))))
                • Then - Actions
                  • Unit - Cause Bladestorm[(Player number of (Triggering player))] to damage (Picked unit), dealing Bladestorm_Damage_Multiplier damage of attack type Hero and damage type Normal
                  • Floating Text - Create floating text that reads (|cffFF0000 + ((String((Integer(Bladestorm_Damage_Multiplier)))) + !)) above Bladestorm_Random[(Player number of (Triggering player))] with Z offset -90.00, using font size 10.50, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                  • Set Bladestorm_Text = (Last created floating text)
                  • Floating Text - Change Bladestorm_Text: Disable permanence
                  • Floating Text - Set the velocity of Bladestorm_Text to 80.00 towards (Random real number between 80.00 and 90.00) degrees
                  • Floating Text - Change the lifespan of Bladestorm_Text to 4.00 seconds
                  • Floating Text - Change the fading age of Bladestorm_Text to 2.50 seconds
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Blade_Dance_Chance[(Player number of (Triggering player))] Greater than (10.00 + (3.00 x (Real((Level of Blade Dance for Bladestorm[(Player number of (Triggering player))])))))
                • Then - Actions
                  • Unit - Cause Bladestorm[(Player number of (Triggering player))] to damage (Picked unit), dealing Bladestorm_Damage damage of attack type Hero and damage type Normal
                • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Bladestorm_Timer Greater than or equal to (30 + (10 x (Level of Bladestorm for Bladestorm[(Player number of (Triggering player))])))
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Unit Group - Pick every unit in Bladestorm_Dummy_Group3[(Player number of (Triggering player))] and do (Actions)
            • Loop - Actions
              • Unit - Remove (Picked unit) from the game
          • Unit Group - Pick every unit in Bladestorm_Dummy_Group2[(Player number of (Triggering player))] and do (Actions)
            • Loop - Actions
              • Unit - Remove (Picked unit) from the game
        • Else - Actions
 
Last edited:
Hello, I can see a bit of a MUI attempt. (multiple unit instanceability)
But it's done not correctly.
It's not the shortets tutoral, but really worth to read it! Dynamic Indexing
This shows a method how to achieve MUI for your spells, so it can be casted by multiple units from multiple players at very same time.
Basicly you will switch from (NumberOf(TriggeringPlayer)) to a unit unit index.

What I also quickly could spot is that you use Group[array].
[array] has size of 8192 (with 0), and GUI does not create automatically
8192 groups at map initialization for you, but only 2.
So after map init Group[0] and Group[1] already exist, but others don't.
You need to create them frirst via custom script before you can take usage of it.
If you want for example use group 3, just use this custom script before:
  • Custom script: if udg_Group[3] == null then
  • Custom script: set udg_Group[3] = CreateGroup()
  • Custom script: endif
If you want use Group[Index], then replace the "3" with the Index integer.

Next point.
Code will get some cleader and more readable (also more efficient) if you store function responses
into temp variables.
For example you use (TriggeringPlayer) very often, so you could store it in a variable and then use the variable intsead.
And you could make this more otfen, like also for (Picked Unit) for example.

Also a very important is memory leaks.
You really need to prevent from leak memory. http://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/
Spells, or anything with periodic leaks can get dangerous for your game otherwise.

There is maybe also 1 or 2 other issues in spell code itself,
but if you want my advice.. first try to get into dynamic indexing
and basic spell structure. Try it keep as simple as possible, and then
slowly add the spell specific aspects, one by one, so the code grows.

Imo it is very important for a spell maker to know all these things,
and a must have for all spells submitted here on workshop.
But if you only want to create a spell and don't think too much about structure,
then you also can try out a system from databse: http://www.hiveworkshop.com/forums/spells-569/gui-spell-system-v1-2-3-1-a-273415/
The purpose of the system is to simplify it for users to make spells.
 
Status
Not open for further replies.
Top