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

Help - Projectile System GUI/Triggers

Status
Not open for further replies.
Level 2
Joined
Aug 9, 2016
Messages
9
Hi, I need some tips and advices, this is my first projectile system and decided do it with the new special effects natives. For now I think it works properly, but it only takes the xy point of the FXs, needs to change the height and the pitch angle too, so could you guys help me with the formula? I know doing it with custom scripts ( when I'm using a dummy unit) is faster but how do I do that with effects? (I mean SetUnitXY)

Here are the triggers.

The cast event:
  • Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Projectile
    • Actions
      • Set Index = (Index + 1)
      • Set Caster[Index] = (Casting unit)
      • Set Target[Index] = (Target unit of ability being cast)
      • Set TempPoint = (Position of Caster[Index])
      • Set TempPoint2 = (Position of Target[Index])
      • Set AngleXY[Index] = (Angle from TempPoint to TempPoint2)
      • -------- ------------------------------------------------------ --------
      • Custom script: call RemoveLocation(udg_TempPoint2)
      • Set TempPoint2 = (TempPoint offset by 60.00 towards AngleXY[Index] degrees)
      • -------- ------------------------------------------------------ --------
      • Special Effect - Create a special effect at TempPoint2 using Abilities\Weapons\LordofFlameMissile\LordofFlameMissile.mdl
      • Set SpecialFX[Index] = (Last created special effect)
      • Special Effect - Set Position - Z of SpecialFX[Index] to 75.00
      • -------- ------------------------------------------------------ --------
      • Special Effect - Create a special effect at TempPoint2 using Abilities\Weapons\RedDragonBreath\RedDragonMissile.mdl
      • Set SpecialFX2[Index] = (Last created special effect)
      • Special Effect - Set Position - Z of SpecialFX2[Index] to 75.00
      • -------- ------------------------------------------------------ --------
      • Special Effect - Create a special effect at TempPoint2 using Abilities\Weapons\PhoenixMissile\Phoenix_Missile.mdl
      • Set SpecialFX3[Index] = (Last created special effect)
      • Special Effect - Set Position - Z of SpecialFX3[Index] to 75.00
      • -------- ------------------------------------------------------ --------
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Custom script: call RemoveLocation(udg_TempPoint2)
      • -------- ------------------------------------------------------ --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Index Greater than 0
        • Then - Actions
          • Trigger - Turn on Loop <gen>
        • Else - Actions
Loop:
  • Loop
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Loop) from 1 to Index, do (Actions)
        • Loop - Actions
          • Set TempPoint = (Position of Target[Loop])
          • Set EffectX[Loop] = (Position - X of SpecialFX[Loop])
          • Set EffectY[Loop] = (Position - Y of SpecialFX[Loop])
          • Set TempPoint2 = (Point(EffectX[Loop], EffectY[Loop]))
          • Set AngleXY[Loop] = ((Angle from TempPoint to TempPoint2) - 180.00)
          • Set TempPoint3 = (TempPoint2 offset by 20.00 towards AngleXY[Loop] degrees)
          • -------- ------------------------------------------------------ --------
          • Special Effect - Set Position of SpecialFX[Loop] to x: (X of TempPoint3), y: (Y of TempPoint3), z: 75.00
          • Special Effect - Set Roll of SpecialFX[Loop] to: (Radians(AngleXY[Loop]))
          • -------- ------------------------------------------------------ --------
          • Special Effect - Set Position of SpecialFX2[Loop] to x: (X of TempPoint3), y: (Y of TempPoint3), z: 75.00
          • Special Effect - Set Roll of SpecialFX2[Loop] to: (Radians(AngleXY[Loop]))
          • -------- ------------------------------------------------------ --------
          • Special Effect - Set Position of SpecialFX3[Loop] to x: (X of TempPoint3), y: (Y of TempPoint3), z: 75.00
          • Special Effect - Set Roll of SpecialFX3[Loop] to: (Radians(AngleXY[Loop]))
          • -------- ------------------------------------------------------ --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Distance between TempPoint and TempPoint2) Less than or equal to 50.00
                  • (Target[Loop] is dead) Equal to True
            • Then - Actions
              • Special Effect - Destroy SpecialFX[Loop]
              • Special Effect - Destroy SpecialFX2[Loop]
              • Special Effect - Destroy SpecialFX3[Loop]
              • -------- ------------------------------------------------------ --------
              • Set Caster[Loop] = Caster[Index]
              • Set Target[Loop] = Target[Index]
              • Set AngleXY[Loop] = AngleXY[Index]
              • Set EffectX[Loop] = EffectX[Index]
              • Set EffectY[Loop] = EffectY[Index]
              • Set SpecialFX[Loop] = SpecialFX[Index]
              • Set SpecialFX2[Loop] = SpecialFX2[Index]
              • Set SpecialFX3[Loop] = SpecialFX3[Index]
              • Set Loop = (Loop - 1)
              • Set Index = (Index - 1)
              • -------- ------------------------------------------------------ --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Index Equal to 0
                • Then - Actions
                  • Trigger - Turn off Loop <gen>
                • Else - Actions
            • Else - Actions
          • -------- ------------------------------------------------------ --------
          • Custom script: call RemoveLocation(udg_TempPoint)
          • Custom script: call RemoveLocation(udg_TempPoint2)
          • Custom script: call RemoveLocation(udg_TempPoint3)
Some questions I have:

Leaks? If so how do I clear it?
  • Set EffectX[Loop] = (Position - X of SpecialFX[Loop])
  • Set EffectY[Loop] = (Position - Y of SpecialFX[Loop])
I can't figure why I have to put the angle -180 for the projectile go in the right direction.
  • Set AngleXY[Loop] = ((Angle from TempPoint to TempPoint2) - 180.00)
Maybe my mistake messing with a variable. Sry if so.

Besides the performance/lag, why most of projectiles systems use 0.03 in their loops? I saw people saying it makes no diference cuz we can't see any diference at all, I personaly see a lot of diference when puting a 0.01 and 0.02 periodic event, it makes the projectile/missile movement more smooth (mantaining the same speed), of course slowing down the performance when multiple instances are on.

So... 0.02 or 0.03? I'm preteding to use this on my map and there will be just a few casts at the same time.

Any tips and advices for what I'm doing wrong and what I should be doing, are welcome. Also help me with the formulas :p
 

Wrda

Spell Reviewer
Level 25
Joined
Nov 18, 2012
Messages
1,870
Some questions I have:

Leaks? If so how do I clear it?
  • Set EffectX[Loop] = (Position - X of SpecialFX[Loop])
  • Set EffectY[Loop] = (Position - Y of SpecialFX[Loop])
This is just a real? No need to do anything more.
I can't figure why I have to put the angle -180 for the projectile go in the right direction.
  • Set AngleXY[Loop] = ((Angle from TempPoint to TempPoint2) - 180.00)
Maybe my mistake messing with a variable. Sry if so.
Thats because you're setting TempPoint to the position of the target and TempPoint2 as position of projectile, switch them and remove the -180 and you're fine.[/QUOTE]
Besides the performance/lag, why most of projectiles systems use 0.03 in their loops? I saw people saying it makes no diference cuz we can't see any diference at all, I personaly see a lot of diference when puting a 0.01 and 0.02 periodic event, it makes the projectile/missile movement more smooth (mantaining the same speed), of course slowing down the performance when multiple instances are on.

So... 0.02 or 0.03? I'm preteding to use this on my map and there will be just a few casts at the same time.
Because they are speed freaks, :D they care about performance to the point where it is irrelevant, just like they say to the 0.03 or 0.02, it makes no difference, so does performance being 0.0001 a bit better than 0.0005. You can even make your periodic as 0.01 or even 0.001 and have 0 lag and still good performance if you made your triggers effectively. Still, stick to 0.01~0.03. They'll probably grant you more control on the projectile speed.
 
Status
Not open for further replies.
Top