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

Kamehameha Spell Effects Problem

Status
Not open for further replies.
Level 11
Joined
Aug 6, 2009
Messages
697
I made a kamehameha spell and for some reason the main two dummy units gets ahead of the rest of the group, but then the rest of the dummy units catch up to the main dummy units later in the spell.


Ahead of the rest.
35i3pdt.jpg

Catching Up
aayhyc.jpg



  • Kamehameha
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Kamehameha
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • KH_CurrentIndex Equal to 0
        • Then - Actions
          • Trigger - Turn on KamehamehaLoop <gen>
        • Else - Actions
      • Set KH_CurrentIndex = (KH_CurrentIndex + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • KH_CurrentIndex Greater than KH_IndexMax
        • Then - Actions
          • Set KH_Index[KH_CurrentIndex] = KH_CurrentIndex
          • Set KH_IndexMax = KH_CurrentIndex
        • Else - Actions
      • Set Tempint = KH_Index[KH_CurrentIndex]
      • Set KH_Caster[Tempint] = (Triggering unit)
      • Set KH_Point = (Position of KH_Caster[Tempint])
      • Set KH_Point2 = (Target point of ability being cast)
      • Set KH_Angle[Tempint] = (Angle from KH_Point to KH_Point2)
      • Set KH_Point3 = (KH_Point offset by 35.00 towards KH_Angle[Tempint] degrees)
      • Set KH_Duration[Tempint] = 1.50
      • Custom script: if udg_KH_UGroup[udg_Tempint] == null then
      • Custom script: set udg_KH_UGroup[udg_Tempint] = CreateGroup()
      • Custom script: endif
      • -------- Two units added for a better effect. --------
      • Unit - Create 1 KameDummyUnit for (Owner of KH_Caster[Tempint]) at KH_Point3 facing Default building facing degrees
      • Set KH_DummyUnit[Tempint] = (Last created unit)
      • Unit - Create 1 KameDummyUnit for (Owner of KH_Caster[Tempint]) at KH_Point3 facing Default building facing degrees
      • Set KH_DummyUnit2[Tempint] = (Last created unit)
      • Unit - Pause KH_Caster[Tempint]
      • Custom script: call RemoveLocation (udg_KH_Point)
      • Custom script: call RemoveLocation (udg_KH_Point2)
      • Custom script: call RemoveLocation (udg_KH_Point3)

  • KamehamehaLoop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Game - Display to (All players) the text: on
      • For each (Integer KH_Loop) from 1 to KH_CurrentIndex, do (Actions)
        • Loop - Actions
          • Set Tempint = KH_Index[KH_Loop]
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • KH_Duration[Tempint] Greater than 0.00
            • Then - Actions
              • Game - Display to (All players) the text: (Current Kamehameha Index + (String(KH_CurrentIndex)))
              • Set KH_Point = (Position of KH_DummyUnit[Tempint])
              • Set KH_Point2 = (KH_Point offset by 35.00 towards KH_Angle[Tempint] degrees)
              • Set KH_Duration[Tempint] = (KH_Duration[Tempint] - 0.03)
              • Unit - Create 1 KameDummyUnit for (Owner of KH_Caster[Tempint]) at KH_Point facing KH_Angle[Tempint] degrees
              • Unit Group - Add (Last created unit) to KH_UGroup[Tempint]
              • Unit - Move KH_DummyUnit[Tempint] instantly to KH_Point2
              • Unit - Move KH_DummyUnit2[Tempint] instantly to KH_Point2
              • Custom script: set bj_wantDestroyGroup = true
              • Unit Group - Pick every unit in (Units within 160.00 of KH_Point matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of KH_Caster[Tempint])) Equal to True) and (((Matching unit) has and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Picked unit) Not equal to No unit
                    • Then - Actions
                      • Set KH_Duration[Tempint] = 0.00
                      • Unit Group - Pick every unit in (Units within 300.00 of KH_Point matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of KH_Caster[Tempint])) Equal to True) and (((Matching unit) has and do (Actions)
                        • Loop - Actions
                          • Unit - Cause KH_Caster[Tempint] to damage (Picked unit), dealing (250.00 x (Real((Level of Kamehameha for KH_Caster[Tempint])))) damage of attack type Spells and damage type Normal
                    • Else - Actions
            • Else - Actions
              • Set KH_Index[KH_Loop] = KH_Index[KH_CurrentIndex]
              • Set KH_Index[KH_CurrentIndex] = Tempint
              • Set KH_CurrentIndex = (KH_CurrentIndex - 1)
              • Set KH_Loop = (KH_Loop - 1)
              • Set KH_Point = (Position of KH_DummyUnit[Tempint])
              • Unit - Create 1 KameDummyExplosion for (Owner of KH_Caster[Tempint]) at KH_Point facing KH_Angle[Tempint] degrees
              • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
              • Unit - Remove KH_DummyUnit[Tempint] from the game
              • Unit - Remove KH_DummyUnit2[Tempint] from the game
              • Unit Group - Pick every unit in KH_UGroup[Tempint] and do (Unit - Remove (Picked unit) from the game)
              • Unit Group - Remove all units of KH_UGroup[Tempint] from KH_UGroup[Tempint]
              • Unit - Unpause KH_Caster[Tempint]
              • Custom script: call RemoveLocation (udg_KH_Point)
          • Custom script: call RemoveLocation (udg_KH_Point)
          • Custom script: call RemoveLocation (udg_KH_Point2)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • KH_CurrentIndex Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Skip remaining actions
        • Else - Actions
Does anyone have any idea why this happens and how to fix it?
 
Last edited by a moderator:
Level 29
Joined
Oct 24, 2012
Messages
6,543
this is less efficient because it uses more variables. also the names of ur variables are misleading. currentIndex should be the current index not the maxIndex.

they are not the same thus the name difference.
the difference is in the way that u index and de-index.
dynamic indexing keeps the indexes in order. arrayed indexing does not. that is the main difference. but with a lot of the spells a person makes the order doesnt matter. when it does u simply use a counter when using arrayed indexing.

arrayed indexing is a lot easier to read and write. and less likely to make mistakes because of that reason.

You should explain or link him then.
i said were it was and how to get to it. plz read everything b4 posting
 
Less efficient because it uses more variables...? Remake this spell with your method of indexing then I would believe you.

Hmm.... What do you mean by that the current index is the max? I see it as the current while the max increases to how high the current goes too.

Well both use arrays while yours is quite similar just looks a bit better. Even though most people use dynamic indexing your way is better? I have seen no proof how it is better in any way. In order would be better then random selection wouldn't it?

The link thing was because I have signatures turned off because they just annoy me and clump up the pages. However you still never explained the differences so yes read before posting. All you typed was that it is "easier". No proof of anything until you remake this spell so I can see which would be better.

EDIT: By the way you messed up in your tutorial.

A unit begins casting an ability should be replaced with a unit starts the effect of an ability.
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
Less efficient because it uses more variables...? Remake this spell with your method of indexing then I would believe you.

Hmm.... What do you mean by that the current index is the max? I see it as the current while the max increases to how high the current goes too.

Well both use arrays while yours is quite similar just looks a bit better. Even though most people use dynamic indexing your way is better? I have seen no proof how it is better in any way. In order would be better then random selection wouldn't it?

The link thing was because I have signatures turned off because they just annoy me and clump up the pages. However you still never explained the differences so yes read before posting. All you typed was that it is "easier". No proof of anything until you remake this spell so I can see which would be better.

im not remaking someone elses spell.
pay attention to the variable names the maxIndex is supposed to be the highest index that is used. he uses the current index.
its not my way. they both have there pros and cons. in the case that order doesnt matter then arrayed indexing is better. in the case that order is needed then u can go either way.

lol thats ur problem if u have it turned off not mine. i said the link was in my sig. i dont have to have proof. im a good GUIer JASSer and vJasser. so yes ik what im tlking about. if u need proof then look for it on other posts. it is the TO's choice to change his spell not urs or mine. i was giving him an easier alternative since i believe the problem is in the indexing.

EDIT: By the way you messed up in your tutorial.

A unit begins casting an ability should be replaced with a unit starts the effect of an ability.
that doesnt bother me. it was just an example of how to index
 
Status
Not open for further replies.
Top