• 🏆 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] Projectile with collision

Status
Not open for further replies.
Level 1
Joined
Oct 21, 2009
Messages
2
Hey HIVE forums, I developing a small arena based map, and I need help with a spell. Its a basic spell that fires a fast 522+ ms plus projectile in a straight line directly in front of your unit. I managed to trigger most of it myself, but I can't figure out how to give it MUI, and it collides with dead bodies.

Here is a overview of my triggers.

-Detect spell is cast, creates a dummy unit with projectile model in front of you, and instantly uses a knockback system to propel it at the equivalent of 1k ms.
-every .02 seconds, it detects if any other units are within a 200 square radius of the projectile, by making a unit group with all the units in that radius. If their is more then one unit (one for the dummy itself), it destroys the projectile, and deals damage.


Any ideas on how to give it MUI? Currently my MUI works up until collision detection. Or how to make it stop colliding with dead bodies? (I couldn't figure out how to put a "if alive" check in my triggers".

Finally, I want it to damage the closest target inside an area of effect, not the entire effect.

Here is my gui triggers its probably superbad because Im a noob at triggering.

  • Ranged Attack
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to testranged
    • Actions
      • -------- intialsetvar --------
      • Set basicmelee_troll = (Triggering unit)
      • Set basicmelee_player = (Owner of basicmelee_troll)
      • Set basicmelee_point = (Position of basicmelee_troll)
      • Set basicmelee_direction = (Facing of basicmelee_troll)
      • Set rangeddummy_targets02 = rangeddummy_reset
      • -------- setup --------
      • Set basicranged_distance = (basicmelee_point offset by -1500.00 towards basicmelee_direction degrees)
      • Set basicranged_directionarea = (Region centered at basicranged_distance with size (100.00, 100.00))
      • Unit - Create 1 meleedummy02 for basicmelee_player at (basicmelee_point offset by 60.00 towards basicmelee_direction degrees) facing basicmelee_direction degrees
      • Set rangeddummy = (Last created unit)
      • Set rangedummy_location = (Position of rangeddummy)
      • Unit - Add a 1.00 second Generic expiration timer to rangeddummy
      • -------- beginspear --------
      • Set KBA_Caster = rangeddummy
      • Set KBA_TargetUnit = rangeddummy
      • Set KBA_StartingPosition = basicranged_distance
      • Set KBA_Level = 1
      • Set KBA_Speed = 30.00
      • Set KBA_DistancePerLevel = 1500.00
      • Set KBA_DestroyTrees = False
      • Trigger - Run Cast A Knockback <gen> (checking conditions)
      • Trigger - Turn on rangedattackdamage <gen>
  • rangedattackdamage
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Set rangedlocation_02 = (Position of rangeddummy)
        • Set rangeddummy_area = (Region centered at rangedlocation_02 with size (200.00, 200.00))
        • Set rangeddummy_targets02 = (Units in rangeddummy_area)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Number of units in rangeddummy_targets02) Greater than or equal to 1
            • (rangeddummy_area contains basicmelee_troll) Equal to False
          • Then - Actions
            • Unit - Cause rangeddummy to damage circular area after 0.00 seconds of radius 75 at rangedlocation_02, dealing 500.00 damage of attack type Spells and damage type Normal
            • Unit - Remove rangeddummy from the game
            • Trigger - Turn off rangedattackdamage <gen>
          • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (basicranged_directionarea contains rangeddummy) Equal to True
              • Then - Actions
                • Unit - Remove rangeddummy from the game
                • Trigger - Turn off rangedattackdamage <gen>
              • Else - Actions
  • Cast A Knockback
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (KBA_TargetUnit is in KB_KnockbackedUnits) Equal to True
        • Then - Actions
          • Unit Group - Remove KBA_TargetUnit from KB_KnockbackedUnits
          • Set KB_CountBuffs = (KB_CountBuffs - 1)
          • For each (Integer KB_GeneralIntegers[2]) from 1 to KB_TotalKnockUnits, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • KB_Units[KB_GeneralIntegers[1]] Equal to KBA_TargetUnit
                • Then - Actions
                  • Set KB_GeneralIntegers[1] = KB_GeneralIntegers[2]
                  • Set KB_GeneralIntegers[2] = KB_TotalKnockUnits
                • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • KB_TotalKnockUnits Greater than KB_GeneralIntegers[1]
            • Then - Actions
              • Set KB_Levels[KB_GeneralIntegers[1]] = KB_Levels[KB_TotalKnockUnits]
              • Set KB_Units[KB_GeneralIntegers[1]] = KB_Units[KB_TotalKnockUnits]
              • Set KB_Angle[KB_GeneralIntegers[1]] = KB_Angle[KB_TotalKnockUnits]
              • Set KB_MaxDistance[KB_GeneralIntegers[1]] = KB_MaxDistance[KB_TotalKnockUnits]
              • Set KB_ReachedDistance[KB_GeneralIntegers[1]] = KB_ReachedDistance[KB_TotalKnockUnits]
              • Set KB_ReduceSpeedReal[KB_GeneralIntegers[1]] = KB_ReduceSpeedReal[KB_TotalKnockUnits]
              • Set KB_SpecificSpeed[KB_GeneralIntegers[1]] = KB_SpecificSpeed[KB_TotalKnockUnits]
              • Set KB_Effects_1[KB_GeneralIntegers[1]] = KB_Effects_1[KB_TotalKnockUnits]
              • Set KB_Effects_2[KB_GeneralIntegers[1]] = KB_Effects_2[KB_TotalKnockUnits]
              • Set KB_DestroyTrees[KB_GeneralIntegers[1]] = KB_DestroyTrees[KB_TotalKnockUnits]
              • Set KB_EffectCounter[KB_GeneralIntegers[1]] = KB_EffectCounter[KB_TotalKnockUnits]
              • Set KB_EffectCounter2[KB_GeneralIntegers[1]] = KB_EffectCounter2[KB_TotalKnockUnits]
              • Set KB_GeneralIntegers[1] = (KB_GeneralIntegers[1] - 1)
            • Else - Actions
          • Set KB_Units[KB_TotalKnockUnits] = No unit
          • Set KB_TotalKnockUnits = (KB_TotalKnockUnits - 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • KB_CountBuffs Equal to 0
            • Then - Actions
              • Set KB_TotalKnockUnits = 0
              • Trigger - Turn off Get Knockback <gen>
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • KB_CountBuffs Equal to 0
        • Then - Actions
          • Trigger - Turn on Get Knockback <gen>
        • Else - Actions
      • Set KB_CountBuffs = (KB_CountBuffs + 1)
      • Set KB_TotalKnockUnits = (KB_TotalKnockUnits + 1)
      • Set KB_Casters[KB_TotalKnockUnits] = KBA_Caster
      • Set KB_Levels[KB_TotalKnockUnits] = KBA_Level
      • Set KB_Units[KB_TotalKnockUnits] = KBA_TargetUnit
      • Set KB_StartPositions[KB_TotalKnockUnits] = KBA_StartingPosition
      • Set KB_TempPoint[KB_TotalKnockUnits] = (Position of KBA_TargetUnit)
      • Set KB_Angle[KB_TotalKnockUnits] = (Angle from KB_StartPositions[KB_TotalKnockUnits] to KB_TempPoint[KB_TotalKnockUnits])
      • Set KB_MaxDistance[KB_TotalKnockUnits] = (KBA_DistancePerLevel x (Real(KBA_Level)))
      • Set KB_ReachedDistance[KB_TotalKnockUnits] = 0.00
      • Set KB_ReduceSpeedReal[KB_GeneralIntegers[1]] = 0.00
      • Set KB_SpecificSpeed[KB_TotalKnockUnits] = KBA_Speed
      • Set KB_Effects_1[KB_TotalKnockUnits] = KBA_SpecialEffects[1]
      • Set KB_Effects_2[KB_TotalKnockUnits] = KBA_SpecialEffects[2]
      • Set KB_DestroyTrees[KB_TotalKnockUnits] = KBA_DestroyTrees
      • Set KB_EffectCounter[KB_GeneralIntegers[1]] = 0
      • Set KB_EffectCounter2[KB_GeneralIntegers[1]] = 0
      • Unit Group - Add KBA_TargetUnit to KB_KnockbackedUnits
      • Custom script: call RemoveLocation (udg_KBA_StartingPosition)
      • Custom script: call RemoveLocation (udg_KB_TempPoint [udg_KB_TotalKnockUnits] )
      • Custom script: call RemoveLocation (udg_KB_StartPositions [udg_KB_TotalKnockUnits] )
  • Get Knockback
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • For each (Integer KB_GeneralIntegers[1]) from 1 to KB_TotalKnockUnits, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (KB_Units[KB_GeneralIntegers[1]] is in KB_KnockbackedUnits) Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • KB_ReachedDistance[KB_GeneralIntegers[1]] Greater than or equal to KB_MaxDistance[KB_GeneralIntegers[1]]
                • Then - Actions
                  • Unit Group - Remove KB_Units[KB_GeneralIntegers[1]] from KB_KnockbackedUnits
                  • Set KB_CountBuffs = (KB_CountBuffs - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • KB_TotalKnockUnits Greater than KB_GeneralIntegers[1]
                    • Then - Actions
                      • Set KB_Levels[KB_GeneralIntegers[1]] = KB_Levels[KB_TotalKnockUnits]
                      • Set KB_Units[KB_GeneralIntegers[1]] = KB_Units[KB_TotalKnockUnits]
                      • Set KB_Angle[KB_GeneralIntegers[1]] = KB_Angle[KB_TotalKnockUnits]
                      • Set KB_MaxDistance[KB_GeneralIntegers[1]] = KB_MaxDistance[KB_TotalKnockUnits]
                      • Set KB_ReachedDistance[KB_GeneralIntegers[1]] = KB_ReachedDistance[KB_TotalKnockUnits]
                      • Set KB_ReduceSpeedReal[KB_GeneralIntegers[1]] = KB_ReduceSpeedReal[KB_TotalKnockUnits]
                      • Set KB_SpecificSpeed[KB_GeneralIntegers[1]] = KB_SpecificSpeed[KB_TotalKnockUnits]
                      • Set KB_Effects_1[KB_GeneralIntegers[1]] = KB_Effects_1[KB_TotalKnockUnits]
                      • Set KB_Effects_2[KB_GeneralIntegers[1]] = KB_Effects_2[KB_TotalKnockUnits]
                      • Set KB_DestroyTrees[KB_GeneralIntegers[1]] = KB_DestroyTrees[KB_TotalKnockUnits]
                      • Set KB_EffectCounter[KB_GeneralIntegers[1]] = KB_EffectCounter[KB_TotalKnockUnits]
                      • Set KB_EffectCounter2[KB_GeneralIntegers[1]] = KB_EffectCounter2[KB_TotalKnockUnits]
                      • Set KB_GeneralIntegers[1] = (KB_GeneralIntegers[1] - 1)
                    • Else - Actions
                  • Set KB_Units[KB_TotalKnockUnits] = No unit
                  • Set KB_TotalKnockUnits = (KB_TotalKnockUnits - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • KB_CountBuffs Equal to 0
                    • Then - Actions
                      • Set KB_TotalKnockUnits = 0
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                • Else - Actions
                  • Set KB_ReducedReal = ((KB_SpecificSpeed[KB_GeneralIntegers[1]] / KB_MaxDistance[KB_GeneralIntegers[1]]) x KB_ReachedDistance[KB_GeneralIntegers[1]])
                  • Set KB_ReduceSpeedReal[KB_GeneralIntegers[1]] = (KB_ReducedReal - (KB_ReduceSpeedReal[KB_GeneralIntegers[1]] x 0.10))
                  • Set KB_TempReal = ((KB_SpecificSpeed[KB_GeneralIntegers[1]] - KB_ReduceSpeedReal[KB_GeneralIntegers[1]]) x 2.00)
                  • Set KB_TempPoint[1] = (Position of KB_Units[KB_GeneralIntegers[1]])
                  • Set KB_TempPoint[2] = (KB_TempPoint[1] offset by KB_TempReal towards KB_Angle[KB_GeneralIntegers[1]] degrees)
                  • Set KB_EffectCounter[KB_GeneralIntegers[1]] = (KB_EffectCounter[KB_GeneralIntegers[1]] + 1)
                  • Set KB_EffectCounter2[KB_GeneralIntegers[1]] = (KB_EffectCounter2[KB_GeneralIntegers[1]] + 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • KB_DestroyTrees[KB_GeneralIntegers[1]] Equal to True
                    • Then - Actions
                      • Destructible - Pick every destructible within 200.00 of KB_TempPoint[2] and do (Actions)
                        • Loop - Actions
                          • Destructible - Kill (Picked destructible)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • KB_EffectCounter[KB_GeneralIntegers[1]] Equal to 6
                    • Then - Actions
                      • Set KB_EffectCounter[KB_GeneralIntegers[1]] = 0
                      • Special Effect - Create a special effect at KB_TempPoint[1] using KB_Effects_1[KB_GeneralIntegers[1]]
                      • Special Effect - Destroy (Last created special effect)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • KB_EffectCounter2[KB_GeneralIntegers[1]] Equal to 8
                    • Then - Actions
                      • Set KB_EffectCounter2[KB_GeneralIntegers[1]] = 0
                      • Special Effect - Create a special effect at KB_TempPoint[1] using KB_Effects_2[KB_GeneralIntegers[1]]
                      • Special Effect - Destroy (Last created special effect)
                    • Else - Actions
                  • Unit - Move KB_Units[KB_GeneralIntegers[1]] instantly to KB_TempPoint[2]
                  • Custom script: call RemoveLocation (udg_KB_TempPoint[1])
                  • Custom script: call RemoveLocation (udg_KB_TempPoint[2])
                  • Set KB_ReachedDistance[KB_GeneralIntegers[1]] = (KB_ReachedDistance[KB_GeneralIntegers[1]] + KB_TempReal)
            • Else - Actions
I think due to my inexperience Im probably using the most convoluted and pointless way of doing this So if my current framework is so f'ed up that It cant even be made MUI, any suggestions?
 
Last edited:
Status
Not open for further replies.
Top