• 🏆 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!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

My First Mui spell need a check

Status
Not open for further replies.
Level 5
Joined
Jun 13, 2017
Messages
83
I just made my first mui spell, and its working very well at least as far as i know about triggering.
Here is what i want to know:


Edit: only these is what i need
1- if there is anything still need a fix or make it better.
2- better spell to use for dummy. Channel ability like life drain but without any animation.

Edit: Changed both triggers to make them better based on the points you gave me, and this is what i got.

  • Thunder Grip Set
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Dummy
    • Actions
      • -------- Base Setting --------
      • Set TG_Index = (TG_Index + 1)
      • -------- - --------
      • -------- Caster/Target --------
      • Set TG_Caster[TG_Index] = (Triggering unit)
      • Set TG_Target[TG_Index] = (Target unit of ability being cast)
      • -------- - --------
      • -------- Locations --------
      • Set TG_CasterLoc[TG_Index] = (Position of TG_Caster[TG_Index])
      • -------- - --------
      • -------- Effect Time --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (TG_Target[TG_Index] is A Hero) Equal to True
        • Then - Actions
          • Set TG_Counter[TG_Index] = 3
        • Else - Actions
          • Set TG_Counter[TG_Index] = 15
      • -------- - --------
      • -------- Start Effect --------
      • Unit - Pause TG_Caster[TG_Index]
      • Unit - Pause TG_Target[TG_Index]
      • Unit - Create 1 TG_Dummy for (Owner of TG_Caster[TG_Index]) at TG_CasterLoc[TG_Index] facing TG_CasterLoc[TG_Index]
      • Set TG_Dummy[TG_Index] = (Last created unit)
      • Unit - Add a 3.00 second Generic expiration timer to TG_Dummy[TG_Index]
      • Unit - Order TG_Dummy[TG_Index] to Neutral Dark Ranger - Life Drain TG_Target[TG_Index]
      • -------- - --------
      • -------- Damage trigger on --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TG_Index Equal to 1
        • Then - Actions
          • Trigger - Turn on Thunder Grip Pull and Damage <gen>
        • Else - Actions
      • Custom script: call RemoveLocation(udg_TG_CasterLoc[udg_TG_Index])


For some reason if i didn't order the caster to stop after unpause in the second trigger, they will cast the spell again and again, so had to order to stop and it fixed it.

  • Thunder Grip Pull and Damage
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • For each (Integer TG_Loop) from 1 to TG_Index, do (Actions)
        • Loop - Actions
          • -------- Locations --------
          • Set TG_CasterLoc[TG_Loop] = (Position of TG_Dummy[TG_Loop])
          • Set TG_TargetLoc[TG_Loop] = (Position of TG_Target[TG_Loop])
          • -------- - --------
          • -------- Distance and moving --------
          • Set TG_Angle[TG_Loop] = (Angle from TG_TargetLoc[TG_Loop] to TG_CasterLoc[TG_Loop])
          • Set TG_Distance[TG_Loop] = ((Distance between TG_CasterLoc[TG_Loop] and TG_TargetLoc[TG_Loop]) / 10.00)
          • Unit - Move TG_Target[TG_Loop] instantly to (TG_TargetLoc[TG_Loop] offset by TG_Distance[TG_Loop] towards TG_Angle[TG_Loop] degrees)
          • -------- - --------
          • -------- Timer to know when ability end --------
          • Set TG_Counter[TG_Loop] = (TG_Counter[TG_Loop] - 1)
          • -------- - --------
          • Custom script: call RemoveLocation(udg_TG_CasterLoc[udg_TG_Loop])
          • Custom script: call RemoveLocation(udg_TG_TargetLoc[udg_TG_Loop])
          • -------- - --------
          • -------- Check if unit is alive while in effect --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (TG_Caster[TG_Loop] is alive) Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TG_Counter[TG_Loop] Equal to 0
                • Then - Actions
                  • -------- Special Effect and Damage --------
                  • Special Effect - Create a special effect attached to the origin of TG_Target[TG_Loop] using Abilities\Weapons\ChimaeraLightningMissile\ChimaeraLightningMissile.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (TG_Target[TG_Loop] is A Hero) Equal to True
                    • Then - Actions
                      • Unit - Cause TG_Caster[TG_Loop] to damage TG_Target[TG_Loop], dealing 100.00 damage of attack type Normal and damage type Normal
                    • Else - Actions
                      • Unit - Cause TG_Caster[TG_Loop] to damage TG_Target[TG_Loop], dealing 50.00 damage of attack type Normal and damage type Normal
                  • Set TG_End = True
                • Else - Actions
              • -------- - --------
            • Else - Actions
              • Set TG_End = True
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TG_End Equal to True
            • Then - Actions
              • -------- Check trigger description --------
              • -------- End --------
              • Unit - Unpause TG_Caster[TG_Loop]
              • Unit - Order TG_Caster[TG_Loop] to Stop
              • Unit - Unpause TG_Target[TG_Loop]
              • Unit - Remove TG_Dummy[TG_Loop] from the game
              • Set TG_Dummy[TG_Loop] = TG_Dummy[TG_Index]
              • Set TG_Counter[TG_Loop] = TG_Counter[TG_Index]
              • Set TG_Caster[TG_Loop] = TG_Caster[TG_Index]
              • Set TG_Target[TG_Loop] = TG_Target[TG_Index]
              • Set TG_CasterLoc[TG_Loop] = TG_CasterLoc[TG_Index]
              • Set TG_TargetLoc[TG_Loop] = TG_TargetLoc[TG_Index]
              • Set TG_Distance[TG_Loop] = TG_Distance[TG_Index]
              • Set TG_Index = (TG_Index - 1)
              • Set TG_Loop = (TG_Loop - 1)
              • Set TG_End = False
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TG_Index Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
 
Last edited:
Level 41
Joined
Feb 27, 2007
Messages
5,229
In general it looks pretty good! Some notes:
  • You still have a couple Last created unit and Target unit of ability being cast references in the first trigger that could use their respective variables instead.

  • There's no need to set TG_Time every time in the cast trigger; you can either set it once in a map init trigger or give it a default value of 0.10 in the Variable Editor. In general I would instead recommend using an integer variable to count down the number of 'loops' of the periodic trigger a particular instance should be active for. Instead of TG_Counter[TG_Loop] = TG_Counter[TG_Loop] + TG_Time and checking when it's >= 0.30... set it = 3 or 15 at the start (depending on hero or unit target), do TG_Counter[TG_Loop] = TG_Counter[TG_Loop] - 1, and check when it's <= 0.

  • The target unit isn't paused or stunned (that I can see) so it will be able to react and move away from the dummy caster as it's channeling. Maybe you intended this, maybe you didn't?

  • It only moves the target 10% of the remaining distance to the dummy every time the loop runs, but since this distance gets shorter when you move the unit, it moves in a diminishing fashion and will never actually reach the target. Again, maybe you intended this. Using the Unit - Move action also takes collision and pathing into account. If you want the unit to be able to be dragged over obstacles and through other units properly I would suggest you use some Custom script calls to the jass functions SetUnitX() and SetUnitY().

  • You have some repeated code to handle when the spell should 'end' in three different places. You can create some better code flow by putting all of the 'same' actions in their own separate if block that you decide if you should do with some sort of a boolean flag variable. You can also combine your unit/hero target damage into one if you're counting down to 0 instead of up to 0.3 or 1.5. Something like this:

    • Lightning Grip Pull and Damage
      • Events
        • Time - Every 0.10 seconds of game time
      • Conditions
      • Actions
        • For each (Integer TG_Loop) from 1 to TG_Index, do (Actions)
          • Loop - Actions
            • Set EndInstance = False
            • Set TG_CasterLoc[TG_Loop] = (Position of TG_Dummy[TG_Loop])
            • Set TG_TargetLoc[TG_Loop] = (Position of TG_Target[TG_Loop])
            • Set TG_Angle[TG_Loop] = (Angle from TG_TargetLoc[TG_Loop] to TG_CasterLoc[TG_Loop])
            • Set TG_Distance[TG_Loop] = ((Distance between TG_CasterLoc[TG_Loop] and TG_TargetLoc[TG_Loop]) / 10.00)
            • Unit - Move TG_Target[TG_Loop] instantly to (TG_TargetLoc[TG_Loop] offset by TG_Distance[TG_Loop] towards TG_Angle[TG_Loop] degrees)
            • Set TG_Counter[TG_Loop] = (TG_Counter[TG_Loop] + TG_Time)
            • Custom script: call RemoveLocation(udg_TG_CasterLoc[udg_TG_Loop])
            • Custom script: call RemoveLocation(udg_TG_TargetLoc[udg_TG_Loop])
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (TG_Caster[TG_Loop] is alive) Equal to True
              • Then - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • TG_Counter[TG_Loop] Less than or equal to 0
                  • Then - Actions
                    • Special Effect - Create a special effect attached to the origin of TG_Target[TG_Loop] using Abilities\Weapons\ChimaeraLightningMissile\ChimaeraLightningMissile.mdl
                    • Special Effect - Destroy (Last created special effect)
                    • Unit - Cause TG_Caster[TG_Loop] to damage TG_Target[TG_Loop], dealing 500.00 damage of attack type Spells and damage type Normal
                    • Set EndInstance = True
                  • Else - Actions
              • Else - Actions
                • Set EndInstance = True
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • EndInstance Equal to True
              • Then - Actions
                • Unit - Remove TG_Dummy[TG_Loop] from the game
                • Set TG_Dummy[TG_Loop] = TG_Dummy[TG_Index]
                • Set TG_Counter[TG_Loop] = TG_Counter[TG_Index]
                • Set TG_Caster[TG_Loop] = TG_Caster[TG_Index]
                • Set TG_Target[TG_Loop] = TG_Target[TG_Index]
                • Set TG_CasterLoc[TG_Loop] = TG_CasterLoc[TG_Index]
                • Set TG_TargetLoc[TG_Loop] = TG_TargetLoc[TG_Index]
                • Set TG_Distance[TG_Loop] = TG_Distance[TG_Index]
                • Set TG_Index = (TG_Index - 1)
                • Set TG_Loop = (TG_Loop - 1)
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • TG_Index Equal to 0
                  • Then - Actions
                    • Trigger - Turn off (This trigger)
                  • Else - Actions
              • Else - Actions
 
Level 5
Joined
Jun 13, 2017
Messages
83
Edited the triggers in the first post.

As for the 10% move so far it bring them close enough, and i don't want them to move through obstacles, so i will keep it like this for now.
When i put the trigger in my map later, and test it very well, then i might change it if needed.


Thanks for the help :)
 
Status
Not open for further replies.
Top