• 🏆 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] Making a spell MUI

Status
Not open for further replies.
Level 7
Joined
Jul 9, 2008
Messages
253
I need help with making the following spell MUI.

Trigger 1 (Cast):

  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Darkness Arrow
  • Actions
    • Set Caster = (Casting unit)
    • Set Target = (Target unit of ability being cast)
    • Set Point1 = (Position of Caster)
    • Set Point2 = (Position of Target)
    • Unit - Create 1 Dummy - Focus Shot for (Owner of Caster) at Point1 facing (Position of Target)
    • Set Dummy = (Last created unit)
    • Trigger - Turn on Darkness Arrow Move 1 <gen>
    • Custom script: call RemoveLocation(udg_Point1)
    • Custom script: call RemoveLocation(udg_Point2)
Trigger 2 (Movement):

  • Events
    • Time - Every 0.03 seconds of game time
  • Actions
    • Set Point2 = (Position of Target)
    • Set Point3 = (Position of Dummy)
    • Special Effect - Create a special effect at Point3 using Abilities\Spells\Other\BlackArrow\BlackArrowMissile.mdl
    • Special Effect - Destroy (Last created special effect)
    • Set Point4 = (Point3 offset by ((Distance between Point3 and Point2) / 5.00) towards (Angle from Point3 to Point2) degrees)
    • Unit - Move Dummy instantly to Point4, facing Point2
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Distance between Point3 and Point2) Less than or equal to 30.00
      • Then - Actions
        • Trigger - Turn off (This trigger)
        • Unit - Remove Dummy from the game
        • Special Effect - Create a special effect at Point3 using Abilities\Spells\Undead\OrbOfDeath\AnnihilationMissile.mdl
        • Special Effect - Destroy (Last created special effect)
        • Unit - Cause Caster to damage Target, dealing (5.00 x (Real((Agility of Caster (Include bonuses))))) damage of attack type Chaos and damage type Normal
      • Else - Actions
    • Custom script: call RemoveLocation(udg_Point2)
    • Custom script: call RemoveLocation(udg_Point3)
    • Custom script: call RemoveLocation(udg_Point4)
If there is a way to make this MUI I'd love to hear it.

Thanks in advance, Quetzalcotl
 
Level 17
Joined
Mar 17, 2009
Messages
1,349
  • Main Trigger
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Ability being cast) Equal to Animate Dead
    • Actions
      • -------- ------------------------------------------------------------------------------------------------------------- --------
      • -------- Ok to start with, let me explain a bit --------
      • -------- Index[1] doesn't do anything other than check how may instances of the spell is running --------
      • -------- if Index[1] equal to 0, then no one is using the spell, if it's 1, then there's one unit --------
      • -------- if it's equal to n then there are n units using the abilities --------
      • -------- ------------------------------------------------------------------------------------------------------------- --------
      • -------- Since all the units here are using the same Loop Trigger (the point of MUI) we make a condition --------
      • -------- if Index[1] is originally zero, which means that no unit was using the ability which mean the Loop was off --------
      • -------- we make a condition to check if Index[1] equal to zero --------
      • -------- if it returns true then we turn on the Loop Trigger --------
      • -------- ------------------------------------------------------------------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DT_Index[1] Equal to 0
        • Then - Actions
          • Trigger - Turn on Loop Trigger <gen>
        • Else - Actions
      • -------- ------------------------------------------------------------------------------------------------------------- --------
      • -------- Now to announce the number of units using the spell, we keep track of that by adding 1 to the value of Index[1] --------
      • -------- Suppose there were no units using the ability, now there's one, so this makes the value of Index[1] to 1 --------
      • -------- ------------------------------------------------------------------------------------------------------------- --------
      • Set DT_Index[1] = (DT_Index[1] + 1)
      • -------- ------------------------------------------------------------------------------------------------------------- --------
      • -------- Now, to make the whole thing MUI, we are going to use a different array for each unit --------
      • -------- Which is exactly like using a different variable --------
      • -------- So we using another index, Index[2] --------
      • -------- This is gonna hold a different number for each instance so that each unit has his own array and thus his own variables --------
      • -------- Let's say the value of Index[2] is already 3 units using the ability, it'll become 4 for this intance --------
      • -------- ------------------------------------------------------------------------------------------------------------- --------
      • Set DT_Index[2] = (DT_Index[2] + 1)
      • -------- ------------------------------------------------------------------------------------------------------------- --------
      • -------- This is a Boolean, which checks if the Loop Trigger should be running for that specific unit --------
      • -------- since the Loop might be running for different units having the ability, we don't want it to affect the unit who has it done --------
      • -------- it will be used as a condition in the Loop Trigger --------
      • -------- having it True announces that the unit is using the Loop Trigger and so it will get affected by the Loop Trigger --------
      • -------- As you see, it's indexed, and thus it's specific for each unit --------
      • -------- ------------------------------------------------------------------------------------------------------------- --------
      • Set DT_LoopIsOn[DT_Index[2]] = True
      • -------- ------------------------------------------------------------------------------------------------------------- --------
      • -------- Now in the main trigger we use Index[2] as an array for all variables with no exceptions (unless it's a universal variable which holds the same info for all the units) --------
      • -------- here go all your actions prior to the Looping --------
      • -------- ------------------------------------------------------------------------------------------------------------- --------
      • Set DT_VariableExamplePoint[DT_Index[2]] = (Position of (Triggering unit))
      • Unit - Create 1 Footman for (Owner of (Triggering unit)) at DT_VariableExamplePoint[DT_Index[2]] facing Default building facing degrees
      • Set DT_VariableExampleUnit[DT_Index[2]] = (Last created unit)
      • Custom script: call RemoveLocation(udg_DT_VariableExamplePoint[udg_DT_Index[2]])
  • Loop Trigger
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • -------- ------------------------------------------------------------------------------------------------------------- --------
      • -------- here we work slightly different --------
      • -------- to have the same Loop Trigger to run for all the units seperatly, we use a Loop actions :) --------
      • -------- this Loop Action uses Index[3] as it's integer, which is basically a different variabel then Index[1] and Index[2] --------
      • -------- This Loop runs from integer 1 (which is the minimal possible array number possible for Index[2]) to Index[2] (which is the highest number possible) --------
      • -------- Thus all the units using the spell whose Index[2] varies from 1 to n, will have their actions running in variables with the same specific array integer used in the Main Trigger for each unit --------
      • -------- ------------------------------------------------------------------------------------------------------------- --------
      • For each (Integer DT_Index[3]) from 1 to DT_Index[2], do (Actions)
        • Loop - Actions
          • -------- ------------------------------------------------------------------------------------------------------------- --------
          • -------- now Index[3] is used for all the arrays instead of Index[2] --------
          • -------- ------------------------------------------------------------------------------------------------------------- --------
          • -------- This condition checks whether the Boolean is true or false, if it's true, it'll run for that specific unit --------
          • -------- If it's false, then it'll skip the actions for this specific array number and move on to the other array number and so on --------
          • -------- ------------------------------------------------------------------------------------------------------------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DT_LoopIsOn[DT_Index[3]] Equal to True
            • Then - Actions
              • -------- ------------------------------------------------------------------------------------------------------------- --------
              • -------- The WaitCounter which counts how long the loop has been running --------
              • -------- You can see the number which I add is equal to the timer event --------
              • -------- ------------------------------------------------------------------------------------------------------------- --------
              • Set DT_WaitCounter[DT_Index[3]] = (DT_WaitCounter[DT_Index[3]] + 0.03)
              • -------- ------------------------------------------------------------------------------------------------------------- --------
              • -------- Condition to check your counter and all your actions --------
              • -------- ------------------------------------------------------------------------------------------------------------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DT_WaitCounter[DT_Index[3]] Less than 10.00
                • Then - Actions
                  • -------- the actionss --------
                  • Unit - Make DT_VariableExampleUnit[DT_Index[3]] face Default building facing over 0.00 seconds
                  • -------- the actionss --------
                • Else - Actions
                  • -------- ------------------------------------------------------------------------------------------------------------- --------
                  • -------- Now the counter exceeded the time you specified so we reset the counter and announce that we're done of this instance --------
                  • -------- We also destroy whatever has to be destroyed or removed --------
                  • -------- ------------------------------------------------------------------------------------------------------------- --------
                  • Unit - Add a 0.01 second Generic expiration timer to DT_VariableExampleUnit[DT_Index[3]]
                  • Set DT_WaitCounter[DT_Index[3]] = 0.00
                  • -------- ------------------------------------------------------------------------------------------------------------- --------
                  • -------- We announce that this unit is done of it's actions by setting the Boolean to False --------
                  • -------- ------------------------------------------------------------------------------------------------------------- --------
                  • Set DT_LoopIsOn[DT_Index[3]] = False
                  • -------- ------------------------------------------------------------------------------------------------------------- --------
                  • -------- We subtract the value of Index[1] by 1 since one instance is done, and as we've said, Index[1] records the number of INSTANCES RUNNING only --------
                  • -------- ------------------------------------------------------------------------------------------------------------- --------
                  • Set DT_Index[1] = (DT_Index[1] - 1)
                  • -------- ------------------------------------------------------------------------------------------------------------- --------
                  • -------- Now this condition checks if there are no more instance running --------
                  • -------- So, if Index[1] is zero, that implies that there are no instance running --------
                  • -------- in that case, we set the value of Index[2] back to zero (a sort of recycling method so that the value doesn't keep on summing up to a high value) --------
                  • -------- and then since there are no instance running and using the Loop (all the Booleans would be False in that case) --------
                  • -------- we turn the trigger off for the sake of efficiency --------
                  • -------- ------------------------------------------------------------------------------------------------------------- --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • DT_Index[1] Equal to 0
                    • Then - Actions
                      • Set DT_Index[2] = 0
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
            • Else - Actions
DT is just a short for my nickname, you can use anything... :p
Hope this is what you need :)
 
Level 7
Joined
Jul 9, 2008
Messages
253
Thanks for your reply, I'll test it right away! Shouldn't the event be unit casts a spell and condition be darkness arrow? :p

Darkness Arrow is targeted spell
 
Level 7
Joined
Jul 9, 2008
Messages
253
riiiiiggghtt...... There might be a big chance that I would get it working at all :p

EDIT: Ok I think I totally made it wrong because it's not working :p, is there a chance that you could help me with it?
 
Status
Not open for further replies.
Top