Lightning Shield Push

Mike889

New Member
Reaction score
15
Hello guys =D
Can you help me with this?
I'm having trouble with this spell:
Lightning Shield. It is supposed to push every melee unit that atttack the unit with the shield. However, somehow the melee attacker is not being pushed.
Code:
Lightning Shield New
	Events
		Unit - A unit Is attacked
	Conditions
		((Triggering unit) has buff  (Thorde) Dummy ) Equal to (==) True
	Actions
		-------- This set the main variables: points; units; skill levels. --------
		Set PushRange[1] = -175.00
		Set PushRange[2] = -225.00
		Set PushRange[3] = -275.00
		Set PushRange[4] = -325.00
		 Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
			If - Conditions
				(Attacker is A melee attacker) Equal to (==) True
			Then - Actions
				Set Attacker = (Attacking unit)
				Set Victim = (Triggering unit)
				Set TempPoint = (Position of Attacker)
				-------- This choses wich push level will be taken. --------
				 Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
					If - Conditions
						(Victim has buff  (Thorde)) Equal to (==) True
					Then - Actions
						Set TempInteger = 1
					Else - Actions

Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
					 If - Conditions
			  (Victim has buff  (Thorde) 2 ) Equal to (==) True
							Then - Actions
								Set TempInteger = 2
							Else - Actions
								
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
								 If - Conditions
				(Victim has buff  (Thorde) 3 ) Equal to (==) True
									Then - Actions
								Set TempInteger = 3
									Else - Actions    

Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
										If - Conditions
												(Victim has buff  (Thorde) 4 ) Equal to (==) True
										Then - Actions
									Set TempInteger = 1
										Else - Actions
				-------- This pushes the unit --------
				Set TempPoint2 = (TempPoint offset by PushRange[TempInteger] towards (Facing of Attacker) degrees)
				Unit - Move Attacker instantly to TempPoint2
				Point - Remove TempPoint
				Point - Remove TempPoint2
			Else - Actions
 

Azylaminaz

Vox Populi
Reaction score
91
What editor are you using? Or are you using a version that isn't in English? o_o

Is your triggering even going off every time?

Try using (Level of Thorde for (Triggering unit)) instead of the level of buffs.
Should also be (Facing of Attacker + 180), if you want to push the unit back.

Right click the trigger header (the trigger name that appears above the Events) and select Copy As Text. Paste it here, easier to read. :p
 

FireBladesX

Eating my wings!
Reaction score
123
Not facing + 180, because they are negative values. So instead of making the unit move (Facing offset by X), moving it forward, it would be (Facing offset by -X), moving the unit backward. If it were ((Facing + 180) offset by -X), then it would move the unit forward.


Set PushRange[1] = -175.00
Set PushRange[2] = -225.00
Set PushRange[3] = -275.00
Set PushRange[4] = -325.00

For greater clarity.
 

THE_X

New Member
Reaction score
49
Should also be (Facing of Attacker + 180), if you want to push the unit back.

Right click the trigger header (the trigger name that appears above the Events) and select Copy As Text. Paste it here, easier to read. :p

This is correct, hes trying to move the attacker the facing angle of him, witch is forward, if you add 180 or deduct 180 it does not matter because there are only 360 degrees in a circle and 180 either way is 1/2
 

FireBladesX

Eating my wings!
Reaction score
123
But then the units are facing outwards instead of inwards.... Eeeh never mind anyways.
 

Azylaminaz

Vox Populi
Reaction score
91
Plus or subtract 180, would make it so it moves out in the opposite way it is facing.
PushRange[X] is distance, not angles...

+180 and -180 do the exact same thing. 539° is read exactly the same as -541°.
 

Mike889

New Member
Reaction score
15
I'm using Jass newgen, it's english o_O
Well, do you think changing the angle will correct it? I'll try so...
But anyway, I'll remake somethings to get rid of those conditionals.
It REALLY destroys readability xD
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top