Offset is being... odd.

Monsterous

In the Shadows, Lurking.
Reaction score
99
What i want is a unit to keep moving past the target point.
Now, the easiest way i can think of is using an Offset, which i've done. However, the moving unit always moves to the side of the point. However, if i remove the offset, the moving unit goes exactly to the point.
Its strange, because the offset is directed towards that point, so surely the unit would go past the point, as the offset is directed on the unit to the point?

Code:
Unit - Order (Last created unit) to ( Move targeting (ShipPoint offset by 50.0 towards (Point((X of ShipPoint), (Y of ShipPoint))))) (Replace Existing Orders)
I've tried the angle between the two points, and other methods. The unit simply just goes to the offset, disregarding the position of the ship, the angle between two points, or the degree it is moving.

Basically, can anyone give me another way as to how to make a unit target a point, and go past it in the direction its going? Offsets arent working here for unknown reasons to me. Or if anyone can tell me why my action is wrong.
 

Frozenwind

System maker
Reaction score
99
I'm sorry to disapoint you, but the offset behaves as I expect it to behave ;)


What goes wrong?
Basically, what you do is the following:

You order the unit to move to the point (allow me to call it X), with an offset of 50.0 towards the very same point X. However, how can a unit move to point X with an offset of 50.0 towards point X? To translate it:
Code:
Move unit to point X
Offset 50.0
Angle from point X to point X (will most-likely return 0 = east)
An angle between one point doesn't exist. An angle will always be determined by two different points, as it requires two dimensions (or more of course).
I hope the thing between code-tags will explain why it doesn't work.

(Small edit: Actually, it requires any amount of dimensions (in 1 dimension you simply only have 2 angles: left or right (0° and 1°? xD)), but it does require 2 or 3 points. 3 points would be a "math angle", with 2 lines drawn (AB and BC) giving the angle between those 2 lines. Whereas 2 points would be the angle from A to B - which is used in programming - which is now. Technically, this is the same as with 3 points, but one point is imaginary on the x-axis, having the same Y-coördinate as point A)


How to fix it?
I assume you want the ship to move straight over the point? Then I recommend you do this:
[not at home, so I typed it]
Code:
Unit - Order (Last created unit) to ( Move targeting (TargetPoint offset by 50.0 towards (Angle from (Position of (Last Created unit)) to (TargetPoint)))) (Replace Existing Orders)


The (Point(X,Y)) function
One more thing, rather off-topic:
Code:
Unit - Order (Last created unit) to ( Move targeting (ShipPoint offset by 50.0 towards ([COLOR="Green"]Point((X of ShipPoint), (Y of ShipPoint))[/COLOR]))) (Replace Existing Orders)
The green part equals the following:
Code:
(ShipPoint)
 

Monsterous

In the Shadows, Lurking.
Reaction score
99
Very informative.
However, if what you say is true, why wouldnt this work?
Code:
Unit - Order (Last created unit) to ( Move targeting ((Position of Your Ship) offset by 30.0 towards (Angle from (Position of (Last created unit)) to (Position of Your Ship)) degrees)) (Replace Existing Orders)

I tried this, this contains 2 different points, yet the unit goes to the offset, not in a line towards the ship and going past it.
Unless im reading it wrong, the unit should go to an offset of 30 at an angle of the direction of the unit to the ship, which would be its normal movement line, thus it should just move towards the point, and go on its offset.
 

Frozenwind

System maker
Reaction score
99
Few questions:
- Is the "last created unit" on top of the ship (cos then the 2 different points are the same)? --> this will break his "normal movement line" and force him to go to "0°" = east.
- When is the function called? Since if you call it before it passes the ship (makes him move over) and after he passes the ship (makes him move over again - which is backwards), he'll be stacked on top of the ship.
 

Monsterous

In the Shadows, Lurking.
Reaction score
99
Its a seperate unit firing at the ship, so the unit will move towards the ship.
The function is called instantly as the unit is made.
 

Frozenwind

System maker
Reaction score
99
Then it should work, unless:

- Your last created unit isn't created yet (impossible as there always is a last created unit - unless it's your first call - besides that, it responds)
- Is "Your Ship" declared?

If not.. Mind posting your trigger?
 

Monsterous

In the Shadows, Lurking.
Reaction score
99
Amazingly, it now works. I had to recreate it as i had deleted it previously, tested it, and amazingly, it now works even though i did the same thing as i always had.

I thank you for help, and holding my hand trying to find a way to fix my problem.
I've +rep you, and i'd +rep again for your tremendous amount of help, but unfortunately i cant yet :(
 
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