Problem with a Dash spell

Mr. Reez

New Member
Reaction score
0
Hello everyone,
I need somebody's help. I created a dash spell using loops (to be honest, I copied it with consent), but being new to the Trigger type spells I stumbled upon a problem:
Dashing to a location works fine, but let's say I move away from there, then I use the spell again, it takes back to where the last spell ended and moves to the same direction and distance pointed but from the wrong place
 

Mr. Reez

New Member
Reaction score
0
Dash Cast
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Dash
Actions
Set Caster = (Triggering unit)
Set Point[0] = (Position of Caster)
Set Point[1] = (Target point of ability being cast)
Set Distance = (Distance between (Position of Caster) and Point[1])
Set Increment = 35.00
Set Angle = (Angle from (Position of Caster) to Point[1])
Custom script: call RemoveLocation(udg_Point[0])
Custom script: call RemoveLocation(udg_Point[1])
Trigger - Turn on Dash Loop <gen>


Dash Loop
Events
Time - Every 0.04 seconds of game time
Conditions
Actions
Set Distance = (Distance - Increment)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Distance Greater than 0.00
Then - Actions
Set Point[2] = (Position of Caster)
Set Point[3] = (Point[3] offset by Increment towards Angle degrees)
Unit - Move Caster instantly to Point[3]
Special Effect - Create a special effect at Point[3] using Abilities\Spells\Other\Monsoon\MonsoonBoltTarget.mdl
Special Effect - Destroy (Last created special effect)
Custom script: call RemoveLocation(udg_Point[2])
Else - Actions
Custom script: call RemoveLocation(udg_Point[2])
I would copy it the way it really looks (which is more like a list of options) but I don't know how.
 

Imp Midna

Active Member
Reaction score
52
to make your trigger look like the we's GUI, copy the text between [ wc3] [ /wc3] tags (without the whitespaces).

I will, at this point, asume its some kind of proof-of-concept and ignore any kind of useless lesson about insignificant memory leak

Your problem is this line:
Trigger:
  • Set Point[3] = (Point[3] offset by Increment towards Angle degrees)

You mostlikely wanted to calculate the new point from where the caster currently is (Point[2]) but accidently took point[3] instead. Since Point[3] is mostlikely initialised with (0|0), you will alyways dash from the same point.

Btw, in the else-block of your if in the loop-trigger, consider writing
Trigger:
  • Trigger - Turn off (This trigger)

instead. Else, the game would constantly execute the trigger 25 times a second which is some kind of waste ;)
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
You also leak locations in both triggers.
In the first one you create a point variable Point[0] and set it to be (Position of Caster) but then later you dont use it but use (Position of Caster) directly instead.

In the second trigger you create Set Point[2] and Point[3] but only remove point 2 at the end.

Another tip is not to use "move caster instantly" but the jass line to set a units X and Y directly.
This way your caster would not be stunned while charging and you could still give him orders, possibly stopping the charge if given any other order in the meantime.
 

Mr. Reez

New Member
Reaction score
0
Thank you! Really!
I have no idea how to use Jass yet, I am trying to learn... I didn't know one could mix both together.
I hope I am not asking too much, but what would the Jass line look like?
I really appreciate the help.
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
I dont know for sure anymore. I didnt work with the editor now for quite some time but it was something along the lines of:
SetUnitX(<UNIT>, <(int) VALUE>)
and to get the x value of the point it was something like:
GetLocationX(<Location>)

So the complete part would be something like:
Code:
set Temp_Point = Position of ...
set Temp_Unit = Triggering Unit
custom script: SetUnitX( udg_Temp_Unit, GetLocationX( udg_Temp_Point ) )
and of course another line for the Y axis just with X substituted by Y.

But as i said, the syntax might be off, i havent used it for a long time now.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top