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

[Trigger] Spell problem

Status
Not open for further replies.
Level 16
Joined
Jun 24, 2009
Messages
1,409
Before anyone mention that I miss the event and the condition, I'm using a system that calls the spell most efficiently. The system works perfectly, all other spells work.

The spell should summon 5 phoenixes around the hero in a range and height then move them closer to the hero.

The spell not work at all :S the phoenixes disappears.

  • Phoenix Spiral
    • Events
    • Conditions
    • Actions
      • Set TempInt = (Player number of (Triggering player))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • PSHas[PSLastRecycled] Equal to True
        • Then - Actions
          • Set PSMax = (PSMax + 1)
          • Set PSLastRecycled = PSMax
          • Set PSIndex = PSLastRecycled
          • Set PSLastRecycled = PSRecycledList[PSLastRecycled]
        • Else - Actions
          • Set PSIndex = PSLastRecycled
          • Set PSLastRecycled = PSRecycledList[PSLastRecycled]
      • Set PSCaster[PSIndex] = (Triggering unit)
      • Set PSTimer[PSIndex] = (9.00 + (Real((Level of Phoenix Spiral for PSCaster[PSIndex]))))
      • Set PSHas[PSIndex] = True
      • Set PSReached[PSIndex] = False
      • Set PSCount = (PSCount + 1)
      • Set PSHeight[PSInteger] = 1500.00
      • Set TempInt2 = (Level of Phoenix Spiral for PSCaster[PSIndex])
      • Custom script: set udg_PSPhoenixGroup[udg_PSIndex] = CreateGroup()
      • Set TempLoc = (Position of (Triggering unit))
      • For each (Integer A) from 1 to 5, do (Actions)
        • Loop - Actions
          • Set TempLoc2 = (TempLoc offset by 700.00 towards (72.00 x (Real((Integer A)))) degrees)
          • Unit - Create 1 Phoenix Dummy for (Triggering player) at TempLoc2 facing ((Angle from TempLoc to TempLoc2) - 90.00) degrees
          • Set TempUnit = (Last created unit)
          • Unit - Add Phoenix Spiral Ignite to TempUnit
          • Unit Group - Add TempUnit to PSPhoenixGroup[PSIndex]
          • Animation - Change TempUnit flying height to PSHeight[PSIndex] at 0.00
          • Animation - Change TempUnit's size to (50.00%, 50.00%, 50.00%) of its original size
          • Unit - Set level of Phoenix Spiral Ignite for TempUnit to TempInt2
          • Custom script: call RemoveLocation (udg_TempLoc2)
      • Custom script: call RemoveLocation (udg_TempLoc)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Phoenix Spiral Loop <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on Phoenix Spiral Loop <gen>
        • Else - Actions
  • Phoenix Spiral Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer PSInteger) from 0 to PSMax, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • PSHas[PSInteger] Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • PSReached[PSInteger] Equal to False
                • Then - Actions
                  • Set TempLoc = (Position of PSCaster[PSInteger])
                  • Set PSHeight[PSInteger] = (PSHeight[PSInteger] - 140.00)
                  • Unit Group - Pick every unit in PSPhoenixGroup[PSInteger] and do (Actions)
                    • Loop - Actions
                      • Set TempUnit = (Picked unit)
                      • Set TempReal2 = ((Angle from TempLoc to TempLoc2) + 5.00)
                      • Set TempReal = ((Distance between TempLoc and TempLoc2) - 60.00)
                      • Set TempLoc2 = (Position of TempUnit)
                      • Set TempLoc3 = (TempLoc offset by TempReal towards TempReal2 degrees)
                      • Unit - Move TempUnit instantly to TempLoc3, facing (TempReal2 + 90.00) degrees
                      • Animation - Change TempUnit flying height to PSHeight[PSInteger] at 0.00
                      • Custom script: call RemoveLocation (udg_TempLoc2)
                  • Custom script: call RemoveLocation (udg_TempLoc)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • TempReal Less than 101.00
                    • Then - Actions
                      • Set PSReached[PSInteger] = True
                    • Else - Actions
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • PSTimer[PSInteger] Greater than 0.00
                    • Then - Actions
                      • Set PSTimer[PSInteger] = (PSTimer[PSInteger] - 0.03)
                      • Set TempLoc = (Position of PSCaster[PSInteger])
                      • Unit Group - Pick every unit in PSPhoenixGroup[PSInteger] and do (Actions)
                        • Loop - Actions
                          • Set TempUnit = (Picked unit)
                          • Set TempLoc2 = (Position of TempUnit)
                          • Set TempReal = ((Angle from TempLoc to TempLoc2) + 5.00)
                          • Set TempLoc3 = (TempLoc offset by 100.00 towards TempReal degrees)
                          • Unit - Move TempUnit instantly to TempLoc3, facing (TempReal + 90.00) degrees
                          • Custom script: call RemoveLocation (udg_TempLoc2)
                      • Custom script: call RemoveLocation (udg_TempLoc)
                    • Else - Actions
                      • Unit Group - Pick every unit in PSPhoenixGroup[PSInteger] and do (Unit - Kill (Picked unit))
                      • Custom script: call DestroyGroup (udg_PSPhoenixGroup[udg_PSInteger])
                      • Set PSCount = (PSCount - 1)
                      • Set PSHas[PSInteger] = False
                      • Set PSRecycledList[PSInteger] = PSLastRecycled
                      • Set PSLastRecycled = PSInteger
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • PSCount Equal to 0
                        • Then - Actions
                          • Trigger - Turn off (This trigger)
                        • Else - Actions
            • Else - Actions
 
Level 16
Joined
Jul 4, 2008
Messages
1,106
Guide to indexing;
  • Init
  • Actions
  • If (All Conditions are True) then do (Then actions) else do (Else actions)
    • If - Conditions
      • MainIndex Equal to 0
    • Then - Actions
      • Trigger - Turn on (The loop trigger)
    • Else - Actions
  • Set MainIndex = MainIndex + 1
  • Set Index = Index + 1
  • Set Thing[ Index ] = Something
  • Loop
  • Actions
  • For each (Integer Loop) from 0 to Index, do (Actions)
    • Loop - Actions
      • Custom script: // Some actions
 
Level 16
Joined
Jul 4, 2008
Messages
1,106
"The problem is with the movement"
Finally you came up with some more info, that really helps to figure out the location of the problem.

Now then, checking for the movement issue you have pointed out.

1; For first you could possibly try decreasing the value, 100 with 0.03 is quite damn fast, I normally go only with 7-14.
2; Also, check that the paths are correct. You might have angle/distance set up wrongly.
 
Level 16
Joined
Jun 24, 2009
Messages
1,409
Lol, I thought I found all of these misplaces.Thanks.
Edit: Now there is an other problem. Only somtimes spawn the dummies in a height, the other times they are on the ground. Also when I summon them they move around the hero in a circle, that's right, but when I move with the hero they change positions stick to each other.
The height problem solved.
 
Level 16
Joined
Jul 4, 2008
Messages
1,106
It is probably because you are using a unit group, and the phoenixes basically do not have a saved angle on which they should be going on, therefore as the hero's angle chances, the other phoenixes try to move to where they were, but because the angle and locations get messed up, they stack.
You are also leaking.
 
Status
Not open for further replies.
Top