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

Weird Spell Trigger Problem

Status
Not open for further replies.
Level 19
Joined
Feb 25, 2009
Messages
2,004
I've recently recovered some of my old spells which are unfinished so I decided to re-make some of them and share them here.

But I ran into a very weird problem with one of them.

Here are the triggers:


  • SD Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Slice and Dice
    • Actions
      • Set SD_Caster[SD_MUI1] = (Triggering unit)
      • Set SD_cPoint[SD_MUI1] = (Position of SD_Caster[SD_MUI1])
      • Set SD_tPoint[SD_MUI1] = (Target point of ability being cast)
      • Set SD_Targets[SD_MUI1] = (Units within 300.00 of SD_tPoint[SD_MUI1] matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is A flying unit) Equal to False) and (((Matching unit) belongs to an enemy of (Owner
      • Unit - Create 1 Projectile Dummy for (Owner of SD_Caster[SD_MUI1]) at SD_cPoint[SD_MUI1] facing SD_tPoint[SD_MUI1]
      • Set SD_Dummy[SD_MUI1] = (Last created unit)
      • Special Effect - Create a special effect attached to the origin of SD_Dummy[SD_MUI1] using units\orc\Hellscream\Hellscream.mdl
      • Set SD_DummyModel[SD_MUI1] = (Last created special effect)
      • Animation - Change SD_Dummy[SD_MUI1]'s vertex coloring to (100.00%, 100.00%, 100.00%) with 50.00% transparency
      • Animation - Change SD_Dummy[SD_MUI1]'s animation speed to 0.00% of its original speed
      • Animation - Change SD_Caster[SD_MUI1]'s vertex coloring to (100.00%, 100.00%, 100.00%) with 50.00% transparency
      • Unit - Add Maximum Attack Speed to SD_Caster[SD_MUI1]
      • Unit - Add Bonus Damage to SD_Caster[SD_MUI1]
      • Unit - Turn collision for SD_Caster[SD_MUI1] Off
      • Unit - Make SD_Caster[SD_MUI1] Invulnerable
      • Custom script: call RemoveLocation (udg_SD_tPoint[udg_SD_MUI1])
      • Game - Display to (All players) the text: (String((Number of units in SD_Targets[SD_MUI1])))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SD_MUI1 Equal to 0
        • Then - Actions
          • Trigger - Turn on SD Loop <gen>
        • Else - Actions
      • Set SD_MUI1 = (SD_MUI1 + 1)
  • SD Loop
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • For each (Integer SD_MUI2) from 0 to (SD_MUI1 - 1), do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in SD_Targets[SD_MUI2] and do (Actions)
            • Loop - Actions
              • Custom script: set udg_X = GetUnitX(GetEnumUnit())
              • Custom script: set udg_Y = GetUnitY(GetEnumUnit())
              • Special Effect - Create a special effect attached to the origin of SD_Caster[SD_MUI2] using Abilities\Spells\NightElf\Blink\BlinkCaster.mdl
              • Special Effect - Destroy (Last created special effect)
              • Custom script: call SetUnitPosition (udg_SD_Caster[udg_SD_MUI2], udg_X, udg_Y)
              • Unit - Order SD_Caster[SD_MUI2] to Attack (Picked unit)
              • Unit Group - Remove (Picked unit) from SD_Targets[SD_MUI2]
              • Unit - Order SD_Caster[SD_MUI2] to Stop
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in SD_Targets[SD_MUI2]) Equal to 0
            • Then - Actions
              • Set SD_MUI1 = (SD_MUI1 - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • SD_MUI1 Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
              • Unit - Remove SD_Dummy[SD_MUI2] from the game
              • Special Effect - Destroy SD_DummyModel[SD_MUI2]
              • Set SD_Dummy[SD_MUI2] = No unit
              • Set SD_Dummy[SD_MUI2] = SD_Dummy[SD_MUI1]
              • Set SD_DummyModel[SD_MUI2] = SD_DummyModel[SD_MUI1]
              • Unit - Move SD_Caster[SD_MUI2] instantly to SD_cPoint[SD_MUI2]
              • Unit - Remove Bonus Damage from SD_Caster[SD_MUI2]
              • Unit - Remove Maximum Attack Speed from SD_Caster[SD_MUI2]
              • Unit - Turn collision for SD_Caster[SD_MUI2] On
              • Unit - Make SD_Caster[SD_MUI2] Vulnerable
              • Animation - Change SD_Caster[SD_MUI2]'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
              • Set SD_Caster[SD_MUI2] = No unit
              • Set SD_Caster[SD_MUI2] = SD_Caster[SD_MUI1]
              • Custom script: call DestroyGroup (udg_SD_Targets[udg_SD_MUI2])
              • Set SD_Targets[SD_MUI2] = SD_Targets[SD_MUI1]
              • Custom script: call RemoveLocation (udg_SD_cPoint[udg_SD_MUI2])
              • Set SD_cPoint[SD_MUI2] = SD_cPoint[SD_MUI1]
              • Game - Display to (All players) the text: Spell ended
              • Set SD_MUI2 = (SD_MUI2 - 1)
            • Else - Actions


The spell should first pick all enemy units from the target point, then move the caster to each of them and order him to attack them, using base attacks (melee) and having maximum attack speed with the demolish ability for bonus damage.

The only problem is, it doesn't seem to happen the way it should. It does pick the targets and all that, but the caster NEVER moves to them and attack. All other actions from above work perfectly well..

I can't seem to find the problem anywhere, even though I used like an our to debug every single part of it... even using coordinates (X/Y) doesn't seem to work..

So, please help me out with this one.

Thanks in advance.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
1) You should set target = random unit from group[MUI]
2) SetUnitPosition = move unit instantly -> stop order
3) You order stop right after the attack order
4) The loop time is so low that the unit might noth have enough time to complete the attack animation before it gets new order
5) 0 anim speed?
6) Attack speed can be modified by maximum of 800%
 
Level 19
Joined
Feb 25, 2009
Messages
2,004
1. Fixes moving
2. Isn't SetUnitPosition using coordinates which prevents canceling (using Stop order)?
3. Forgot to remove that one
4. The problem is I want players to actually see how the hero moves, even though with 0.03 timer it doesn't attacks the targets
5. No, I'm certain it is 100
6. Upon cast the Hero receives a passive ability that gives 999999 attack speed
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
2. Isn't SetUnitPosition using coordinates which prevents canceling (using Stop order)?

SetUnitPosition orders stop and checks pathing. SetUnitX and SetUnitY don't order stop or check pathing.

4. The problem is I want players to actually see how the hero moves, even though with 0.03 timer it doesn't attacks the targets

The interval is actually too rapid, there is propably not enough time for the unit to perform the attack.

6. Upon cast the Hero receives a passive ability that gives 999999 attack speed

Yeah, but it still works like 800% boost.
 
Level 19
Joined
Feb 25, 2009
Messages
2,004

  • SD Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Slice and Dice
    • Actions
      • Set SD_Caster[SD_MUI1] = (Triggering unit)
      • Set SD_cPoint[SD_MUI1] = (Position of SD_Caster[SD_MUI1])
      • Set SD_tPoint[SD_MUI1] = (Target point of ability being cast)
      • Set SD_Targets[SD_MUI1] = (Units within 300.00 of SD_tPoint[SD_MUI1] matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is A flying unit) Equal to False) and (((Matching unit) belongs to an enemy of (Owner
      • Unit - Create 1 Projectile Dummy for (Owner of SD_Caster[SD_MUI1]) at SD_cPoint[SD_MUI1] facing SD_tPoint[SD_MUI1]
      • Set SD_Dummy[SD_MUI1] = (Last created unit)
      • Special Effect - Create a special effect attached to the origin of SD_Dummy[SD_MUI1] using units\orc\Hellscream\Hellscream.mdl
      • Set SD_DummyModel[SD_MUI1] = (Last created special effect)
      • Animation - Change SD_Dummy[SD_MUI1]'s vertex coloring to (100.00%, 100.00%, 100.00%) with 50.00% transparency
      • Animation - Change SD_Dummy[SD_MUI1]'s animation speed to 0.00% of its original speed
      • Animation - Change SD_Caster[SD_MUI1]'s vertex coloring to (100.00%, 100.00%, 100.00%) with 50.00% transparency
      • Unit - Add Maximum Attack Speed to SD_Caster[SD_MUI1]
      • Unit - Add Bonus Damage to SD_Caster[SD_MUI1]
      • Unit - Turn collision for SD_Caster[SD_MUI1] Off
      • Unit - Make SD_Caster[SD_MUI1] Invulnerable
      • Custom script: call RemoveLocation (udg_SD_tPoint[udg_SD_MUI1])
      • Game - Display to (All players) the text: (String((Number of units in SD_Targets[SD_MUI1])))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SD_MUI1 Equal to 0
        • Then - Actions
          • Trigger - Turn on SD Loop <gen>
        • Else - Actions
      • Set SD_MUI1 = (SD_MUI1 + 1)
  • SD Loop
    • Events
      • Time - Every 0.22 seconds of game time
    • Conditions
    • Actions
      • For each (Integer SD_MUI2) from 0 to (SD_MUI1 - 1), do (Actions)
        • Loop - Actions
          • Set SD_Target = (Random unit from SD_Targets[SD_MUI2])
          • Special Effect - Create a special effect attached to the origin of SD_Caster[SD_MUI2] using Abilities\Spells\NightElf\Blink\BlinkCaster.mdl
          • Special Effect - Destroy (Last created special effect)
          • Custom script: call SetUnitX( udg_SD_Caster[udg_SD_MUI2] , GetUnitX(udg_SD_Target))
          • Custom script: call SetUnitY( udg_SD_Caster[udg_SD_MUI2] , GetUnitY(udg_SD_Target))
          • Unit - Order SD_Caster[SD_MUI2] to Attack Once SD_Target
          • Unit Group - Remove SD_Target from SD_Targets[SD_MUI2]
          • Set SD_Target = No unit
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in SD_Targets[SD_MUI2]) Equal to 0
            • Then - Actions
              • Set SD_MUI1 = (SD_MUI1 - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • SD_MUI1 Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
              • Unit - Remove SD_Dummy[SD_MUI2] from the game
              • Special Effect - Destroy SD_DummyModel[SD_MUI2]
              • Set SD_Dummy[SD_MUI2] = No unit
              • Set SD_Dummy[SD_MUI2] = SD_Dummy[SD_MUI1]
              • Set SD_DummyModel[SD_MUI2] = SD_DummyModel[SD_MUI1]
              • Unit - Move SD_Caster[SD_MUI2] instantly to SD_cPoint[SD_MUI2]
              • Unit - Remove Bonus Damage from SD_Caster[SD_MUI2]
              • Unit - Remove Maximum Attack Speed from SD_Caster[SD_MUI2]
              • Unit - Turn collision for SD_Caster[SD_MUI2] On
              • Unit - Make SD_Caster[SD_MUI2] Vulnerable
              • Animation - Change SD_Caster[SD_MUI2]'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
              • Set SD_Caster[SD_MUI2] = No unit
              • Set SD_Caster[SD_MUI2] = SD_Caster[SD_MUI1]
              • Custom script: call DestroyGroup (udg_SD_Targets[udg_SD_MUI2])
              • Set SD_Targets[SD_MUI2] = SD_Targets[SD_MUI1]
              • Custom script: call RemoveLocation (udg_SD_cPoint[udg_SD_MUI2])
              • Set SD_cPoint[SD_MUI2] = SD_cPoint[SD_MUI1]
              • Set SD_MUI2 = (SD_MUI2 - 1)
            • Else - Actions


Still can't get it to work, but I made the Hero move properly to all targets.
The only problem that remains is that he doesn't have enough time to perform the Attack order (or at least hits only 1 target at maximum)

Any suggestions? I tried a lot of timer settings but none seemed to work correctly...
 
Status
Not open for further replies.
Top