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

[Solved] Help with lifting AoE spell

Status
Not open for further replies.
Level 2
Joined
Dec 19, 2016
Messages
8
I've tried to make this spell lift the units in front of the hero, then damage them and put them back down. But instead of putting them back down, they just floated up, paused, and stayed there. Any help?

  • Untitled Trigger 020
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to [G]ravity Trap
    • Actions
      • Set GT_caster = (Casting unit)
      • Animation - Play GT_caster's spell animation
      • Set GT_Loc = (Position of GT_caster)
      • Set GT_Real_1 = (Facing of GT_caster)
      • Set GT_Group = (Units within 800.00 of GT_Loc matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of GT_caster)) Equal to True)))
      • Unit Group - Pick every unit in GT_Group and do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in GT_Group and do (Actions)
            • Loop - Actions
              • Set GT_Loc2 = (Position of (Picked unit))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Cos((GT_Real_1 - (Angle from GT_Loc2 to GT_Loc)))) Greater than (Cos(90.00))
                  • ((Attacked unit) is in Immune) Equal to False
                • Then - Actions
                  • Trigger - Turn on Untitled Trigger 016 <gen>
                  • Unit - Pause (Picked unit)
                  • Unit - Add Crow Form to (Picked unit)
                  • Unit - Remove Crow Form from (Picked unit)
                  • Animation - Change (Picked unit) flying height to 120.00 at 160.00
                  • Countdown Timer - Start GT_time as a One-shot timer that will expire in 1.00 seconds
                  • Trigger - Turn on Untitled Trigger 021 <gen>
                • Else - Actions
              • Unit Group - Remove (Picked unit) from GT_Group
              • Custom script: call RemoveLocation(udg_GT_Loc)
      • Wait 2.00 seconds
      • Custom script: call RemoveLocation(udg_GT_Loc)
      • Custom script: call DestroyGroup(udg_GT_Group)
  • Untitled Trigger 021
    • Events
      • Time - GT_time expires
    • Conditions
    • Actions
      • Unit Group - Pick every unit in GT_Group and do (Actions)
        • Loop - Actions
          • Unit - Cause GT_caster to damage (Picked unit), dealing 5000.00 damage of attack type Hero and damage type Normal
          • Unit - Add Crow Form to (Picked unit)
          • Unit - Remove Crow Form from (Picked unit)
          • Animation - Change (Picked unit) flying height to 0.00 at 1500.00
          • Countdown Timer - Start GT_time2 as a One-shot timer that will expire in 0.50 seconds
          • Trigger - Turn off (This trigger)
  • Untitled Trigger 022
    • Events
      • Time - GT_time2 expires
    • Conditions
    • Actions
      • Unit Group - Pick every unit in GT_Group and do (Actions)
        • Loop - Actions
          • Unit - Cause GT_caster to damage (Picked unit), dealing 8000.00 damage of attack type Hero and damage type Normal
          • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Human\Thunderclap\ThunderClapCaster.mdl
          • Special Effect - Destroy (Last created special effect)
          • Unit - Unpause (Picked unit)
          • Trigger - Turn off Untitled Trigger 016 <gen>
          • Trigger - Turn off (This trigger)
  • Untitled Trigger 016
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • Special Effect - Create a special effect at GT_Loc using Abilities\Spells\Human\FlameStrike\FlameStrikeTarget.mdl
      • Special Effect - Destroy (Last created special effect)
 
Level 11
Joined
May 16, 2016
Messages
730
I've tried to make this spell lift the units in front of the hero, then damage them and put them back down. But instead of putting them back down, they just floated up, paused, and stayed there. Any help?
First. Start Timer must be outside picking units because it's general timer and it's not individual for each picked unit.
Second. Watch on your remove Picked unit from GT_group action in the first trigger. it doesn't stay in "Else" section. Put this action under Else action or you wouldn't get any effect, because the group is empty after the first trigger run.
Third. Turn off trigger also must stay outside pick unit trigger.
fourth. I think special effects wouldn't showed up because you destroyed it right after creating.
 
Level 2
Joined
Dec 19, 2016
Messages
8
First. Start Timer must be outside picking units because it's general timer and it's not individual for each picked unit.
Nope, it works inside...
Second. Watch on your remove Picked unit from GT_group action in the first trigger. it doesn't stay in "Else" section. Put this action under Else action or you wouldn't get any effect, because the group is empty after the first trigger run.
This turns out to be the only problem! I thank you so much for this three sentences! Just because of this, now my triggers work! +rep
Third. Turn off trigger also must stay outside pick unit trigger.
This also turns out to be fine,
Fourth. I think special effects wouldn't showed up because you destroyed it right after creating.
It still showed up, as long as it's an explosion of some sort and not a projectile.
 
Level 39
Joined
Feb 27, 2007
Messages
5,013
1. Creating and then immediately destroying a special effect will play its death animation if it has one. For models that have no animations it will show the default (stand) animation for 1 loop. If it has animations but not death it will not show anything.

2. Fruit Forest is right about moving those 2 lines outside of the group loop. It's very bad coding practice to do something X times when it only needs to be done once. Just because it works doesn't mean it's been done properly. The trigger is being turned on multiple times and the timer is being started multiple times for no reason. In your case I would instead add a boolean variable = false at the top of the trigger. Inside that if block in the group loop instead of turning on the trigger and starting the timer, set the boolean to true. After the loop, check the boolean with another if block and if true then start the timer and turn on the trigger.

3. You have a group loop inside of a group loop, with both iterating over the same group (your first trigger). This is unnecessary and adds a LOT (N^2 vs N where N=# units in group) runs of the innermost loop. Removethe outermost group loop.

4. This spell is wildly non-MUI. Multiple units trying to cast it at once will break the whole thing. If you would like it to be MUI it will take a little bit of work to alter.

5. Name your triggers so you know what they are and what they do!
 
Status
Not open for further replies.
Top