• 🏆 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] How to make this MUI

Status
Not open for further replies.
  • SerpentStingLoop1
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • Set SS_TargetLocation = (Position of SS_Target)
      • Set SS_DummyLocation = (Position of SS_Dummy)
      • Unit - Move SS_Dummy instantly to (SS_DummyLocation offset by 10.00 towards (Facing of SS_Dummy) degrees), facing SS_TargetLocation
      • Set SS_Distance = (Distance between SS_TargetLocation and SS_DummyLocation)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SS_Distance Less than or equal to 15.00
        • Then - Actions
          • Unit - Remove SS_Dummy from the game
          • Unit - Create 1 Serpent Sting for (Owner of SS_Caster) at SS_TargetLocation facing (Facing of SS_Target) degrees
          • Unit - Order (Last created unit) to Undead Necromancer - Cripple SS_Target
          • Unit - Add a 0.30 second Generic expiration timer to (Last created unit)
          • Unit Group - Add SS_Target to SS_Group
        • Else - Actions
In this trigger an arrow is shot but when i shoot an other one while this one is still in flight it stops. Please help
 
Basically makes them into array variables.
This creates the arrows and sets your variables for future use.
  • Create Arrow
    • Events
    • Conditions
    • Actions
      • -------- You MUST copy these without changing --------
      • Trigger - Turn on Move Arrow <gen>
      • Set SS_NumofArrows = (SS_NumofArrows + 1)
      • -------- Set your variables, make sure they are arrays, and set their indeces to SS_NumofArrows. --------
      • -------- Of course, you can set your variables the way you want --------
      • -------- Set them as if without arrays eg. the last created unit is a dummy, so set is as the dummy --------
      • Set SS_Dummy[SS_NumofArrows] = (Last created unit)
      • Set SS_Target[SS_NumofArrows] = (Attacked unit)
This moves your arrow into the direction you want.
  • Move Arrow
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • -------- You MUST copy these without changing --------
      • For each (Integer SS_Integer) from 1 to SS_NumofArrows, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SS_ReachedDistance[SS_Integer] Greater than or equal to 15.00
            • Then - Actions
              • -------- Add your actions IF the distance is reached, like kill the dummy --------
              • -------- Don't touch the things below --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • SS_Integer Less than SS_NumofArrows
                • Then - Actions
                  • Set SS_Dummy[SS_Integer] = SS_Dummy[SS_NumofArrows]
                  • Set SS_Target[SS_Integer] = SS_Dummy[SS_NumofArrows]
                  • Set SS_ReachedDistance[SS_Integer] = SS_ReachedDistance[SS_NumofArrows]
                  • Set SS_Integer = (SS_Integer - 1)
                • Else - Actions
              • Set SS_Dummy[SS_NumofArrows] = No unit
              • Set SS_Target[SS_NumofArrows] = No unit
              • Set SS_NumofArrows = (SS_NumofArrows - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • SS_NumofArrows Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
              • -------- Add your actions IF the distance has not reached, like moving the dummy --------
              • -------- Make sure you use SS_Integer as the index for your variables eg. --------
              • Set SS_TargetLocation[SS_Integer] = (Position of SS_Target[SS_Integer])
              • Set SS_TempPoint[1] = (Position of SS_Dummy[SS_Integer])
              • Set SS_TempPoint[2] = (SS_TempPoint[1] offset by 10.00 towards (Facing of SS_Dummy[SS_Integer]) degrees)
              • Unit - Move SS_Dummy[SS_Integer] instantly to SS_TempPoint[2]
              • -------- Records the distance travelled --------
              • Set SS_ReachedDistance[SS_Integer] = (SS_ReachedDistance[SS_Integer] - 10.00)
              • Custom script: call RemoveLocation (udg_SS_TempPoint[1])
              • Custom script: call RemoveLocation (udg_SS_TempPoint[2])
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,467
Unit - Move SS_Dummy instantly to (SS_DummyLocation offset by 10.00 towards (Facing of SS_Dummy) degrees)

Leaks.

(SS_DummyLocation offset by 10.00 towards (Facing of SS_Dummy)
Should be stored in a variable and then removed. And I don't see you removing any of the other locations.

0.01 is very fast for a system. 0.03 or 0.04 are better times to use.

To make this MUI you would have to use arrays. SS_Dummy would be an array, SS_Target would be an array.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,467
I was still typing what I wrote when you made that post.

He should still be aware of memory leaks, timer situations and exactly what parts of the code the problem is found in. Giving someone a solution rarely teaches, but enabling someone to fix their own problem means they'll be less likely to keep making the same mistakes.
 
Okay, but usually when someone posts a system or spell, a user should be able to decipher it, find out the difference in their code and his, and then use it to his preferences, like if you download a Damage floating text thing and it only shows for spell damage, you can change the events and variables to Is Attacked and Attacked Unit, or whatever(shit example).
 
Status
Not open for further replies.
Top