• 🏆 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] Beam spell not working

Status
Not open for further replies.
Level 8
Joined
Jul 10, 2018
Messages
383
  • Beam of light
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Beam of Light
    • Actions
      • Set LightCaster = (Triggering unit)
      • Unit - Create 1 Beamy for Neutral Passive at ((Position of LightCaster) offset by 150.00 towards 0.00 degrees) facing Default building facing degrees
      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 512.00 of ((Position of LightCaster) offset by 800.00 towards (Angle from (Position of LightCaster) to (Position of (Target unit of ability being cast))) degrees) matching (((Matching unit) belongs to an enemy of Player 1 (Red)) Equal to True)) and do (Actions)
        • Loop - Actions
          • Unit - Cause LightCaster to damage (Picked unit), dealing 345345.00 damage of attack type Spells and damage type Normal
The Beam dummy isn't showing in the correct direction and sometimes it doesn't show

and the damage is not applied.
 
Level 28
Joined
Feb 18, 2014
Messages
3,579
What do you mean it's not showing in the correct direction? I don't see anything wrong with your trigger except that you are leaking two points : Position of caster and Position of target.
  • Beam of light
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Beam of Light
    • Actions
      • Set LightCaster = (Triggering unit)
      • Set LightPoint = Position of LightCaster
      • Set TargetPoint = Position of (Target unit of ability being cast)
      • Unit - Create 1 Beamy for Neutral Passive at LightPoint offset by 150.00 towards 0.00 degrees) facing Default building facing degrees
      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 512.00 of LightPoint offset by 800.00 towards (Angle from LightPoint to TargetPoint degrees) matching (((Matching unit) belongs to an enemy of (Owner of LightCaster) Equal to True)) and do (Actions)
        • Loop - Actions
          • Unit - Cause LightCaster to damage (Picked unit), dealing 345345.00 damage of attack type Spells and damage type Normal
      • Custom script : call RemoveLocation (udg_LightPoint)
      • Custom script : call RemoveLocation (udg_TargetPoint)
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
The dummy is created facing Default building degrees (270 degrees). So it'll always be facing 270 degrees.

You should begin your trigger by getting the angle between Light Point and Target Point. Do this by setting a Real variable as the Angle between these points. Then create the Dummy facing this Real. You can also reference this Real in the Pick every unit function so you don't have to get the angle between the 2 points again.

The only reasons that units wouldn't take damage
1) They're not enemies of Player 1
2) They're not within 512 range of "LightPoint offset by 800 towards Angle"

And do what Warseeker said about the leaks. You're also leaking a Point when you do "LightPoint offset by 800", you should set this as a Point variable too.
 
Last edited:
Level 8
Joined
Jul 10, 2018
Messages
383
The dummy is created facing Default building degrees (270 degrees). So it'll always be facing 270 degrees.

You should begin your trigger by getting the angle between Light Point and Target Point. Do this by setting a Real variable as the Angle between these points. Then create the Dummy facing this Real. You can also reference this Real in the Pick every unit function so you don't have to get the angle between the 2 points again.

The only reasons that units wouldn't take damage
1) They're not enemies of Player 1
2) They're not within 512 range of "LightPoint offset by 800 towards Angle"

And do what Warseeker said about the leaks. You're also leaking a Point when you do "LightPoint offset by 800", you should this as a Point variable too.
Well the real variable isn't working with the dummy's direction.
 
Level 8
Joined
Jul 10, 2018
Messages
383
Post your trigger
  • Beam of light
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Beam of Light
    • Actions
      • Set LightCaster = (Triggering unit)
      • Set Direction = (Angle from ((Position of (Triggering unit)) offset by 150.00 towards (Facing of LightTarget) degrees) to (Target point of ability being cast))
      • Unit - Create 1 Beamy for Neutral Passive at (Position of LightCaster) facing Direction degrees
      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 512.00 of ((Position of LightCaster) offset by 800.00 towards (Angle from (Position of LightCaster) to (Position of (Target unit of ability being cast))) degrees) matching (((Matching unit) belongs to an enemy of Player 1 (Red)) Equal to True)) and do (Actions)
        • Loop - Actions
          • Unit - Cause LightCaster to damage (Picked unit), dealing 345345.00 damage of attack type Spells and damage type Normal
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
Does the ability target a unit or a point? Also, have you tested to see if the Beam model even works when you rotate it?

If you could link me the beam model that'd be nice. Also, how do you want it to work exactly? I'm assuming you want it so the beam fires outward from the position of the caster towards the target point.

And with how you have it setup now the damage might not work the way you want. Look at the picture I attached for a better understanding of how the damage radius is currently setup.
 

Attachments

  • aoe example.png
    aoe example.png
    14.9 KB · Views: 30
Last edited:
Level 8
Joined
Jul 10, 2018
Messages
383
Does the ability target a unit or a point? Also, have you tested to see if the Beam model even works when you rotate it?

If you could link me the beam model that'd be nice. Also, how do you want it to work exactly? I'm assuming you want it so the beam fires outward from the position of the caster towards the target point.

And with how you have it setup now the damage might not work the way you want. Look at the picture I attached for a better understanding of how the damage radius is currently setup.
ohh thats how the damage works well how do i make it only in a line? becuz im having this problem alot and also the Beam is perfect is fires in the right direction but the damage im concered about..
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
It's the only way to do it. It's not that confusing once you understand it.

Step 1:
Set LSE_Loc_1 = Point A and Set LSE_Loc_2 = Point B. In other words, these are the start points and end points of the line.

Step 2:
Set LSE_Offset to the radius of the Line. This will make your Beam have a bigger Area of Effect.

Step 3:
Run LSE_GetUnits. This adds all of the units within LSE_Offset range of your Line to the unit group LSE_Group.
  • Trigger - Run LSE_GetUnits (ignoring conditions)
Step 4:
Now that each unit within LSE_Offset range of the line is added to LSE_Group, you can easily pick through the units and do whatever you want from there.
  • Unit Group - Pick every unit in LSE_Group and do (Actions)
    • Loop - Actions
Here's an example of the Beam ability using the system:
  • Beam
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Beam
    • Actions
      • -------- You must use the LSE variables for the Line Segment System to work --------
      • -------- LSE_Loc_1 = Start point, LSE_Loc_2 = End point, LSE_Offset = Radius, LSE_Group = Units inside the radius (hit by the beam) --------
      • -------- --------
      • Set VariableSet LSE_Loc_1 = (Position of (Triggering unit))
      • Set VariableSet TempPoints[1] = (Target point of ability being cast)
      • -------- --------
      • -------- Beam Angle --------
      • Set VariableSet Angle = (Angle from LSE_Loc_1 to TempPoints[1])
      • -------- --------
      • -------- Loc_2 = The end point of the line --------
      • Set VariableSet LSE_Loc_2 = (LSE_Loc_1 offset by 800.00 towards Angle degrees.)
      • -------- --------
      • -------- Offset = Radius of the line (for dealing damage) --------
      • Set VariableSet LSE_Offset = 200.00
      • -------- --------
      • -------- Beam Create Offset --------
      • Set VariableSet TempPoints[2] = (TempPoints[1] offset by 150.00 towards Angle degrees.)
      • -------- --------
      • Unit - Create 1 Dummy for (Triggering player) at TempPoints[2] facing Angle degrees
      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
      • -------- --------
      • -------- You need to Run LSE_GetUnits before referencing LSE_Group. This will find each unit within Offset range of the Line and add them to LSE_Group. --------
      • Trigger - Run LSE_GetUnits (ignoring conditions)
      • Unit Group - Pick every unit in LSE_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an enemy of (Triggering player).) Equal to True
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) is A structure) Equal to False
            • Then - Actions
              • Unit - Cause (Triggering unit) to damage (Picked unit), dealing 150.00 damage of attack type Spells and damage type Normal
            • Else - Actions
      • -------- --------
      • Custom script: call RemoveLocation(udg_LSE_Loc_1)
      • Custom script: call RemoveLocation(udg_LSE_Loc_2)
      • Custom script: call RemoveLocation(udg_TempPoints[1])
      • Custom script: call RemoveLocation(udg_TempPoints[2])
 

Attachments

  • Beam Example.w3m
    31.1 KB · Views: 21
Last edited:
Status
Not open for further replies.
Top