[Help] move command

The place to discuss scripting and game modifications for X4: Foundations.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

morbideth
Posts: 391
Joined: Sun, 9. Nov 08, 03:07
x3tc

[Help] move command

Post by morbideth »

I'm having some trouble with getting my ship to move where I want it via a script. More accurately, it is getting the y right and the x and z wrong, and I have not been able to figure out why. Maybe some fresh eyes will spot my problem.

The data looks like:

Code: Select all

Pegasus Sentinel (TQD-056) is moving to position.[35654.218750m, 1100.586060m, -24439.523438m].
74289.153: Pegasus Sentinel (TQD-056) at position.[-15742.507813m, 1100.586060m, 23883.460938m]
Pegasus Sentinel (TQD-056) is moving to position.[11134.281250m, -759.224243m, 35420.347656m].
74321.99: Pegasus Sentinel (TQD-056) at position.[-40408.703125m, -759.224243m, -18120.613281m]
Pegasus Sentinel (TQD-056) is moving to position.[-18625.869141m, -5158.534180m, -27362.205078m].
74354.863: Pegasus Sentinel (TQD-056) at position.[32854.804688m, -5158.534180m, -17948.884766m]
Pegasus Sentinel (TQD-056) is moving to position.[-39564.859375m, 354.646973m, 1243.002075m].
74377.931: Pegasus Sentinel (TQD-056) at position.[11915.816406m, 354.646973m, 10656.322266m]
Pegasus Sentinel (TQD-056) is moving to position.[-40221.234375m, -16.266968m, 24412.121094m].
74398.031: Pegasus Sentinel (TQD-056) at position.[11259.441406m, -16.266968m, 33825.441406m]
Same result whether I use <move_to object="this.ship" destination="this.sector"> or <run_script name="'move.generic'">
Position passed is created by <create_position name="$position" x="$x.average" y="$y.average" z="$z.average" space="this.sector"/>
please help :cry:
j.harshaw
EGOSOFT
EGOSOFT
Posts: 2203
Joined: Mon, 23. Nov 15, 18:02

Re: [Help] move command

Post by j.harshaw »

Hi,

$object.position defaults to returning the position relative to the object's zone, and it looks like you're telling your ship to move to those coordinates relative to the object's sector? The zones probably just happened to be aligned with the sector's ecliptic, hence the ship ending up at the correct position along the y-axis.

To convert zone coordinates to sector coordinates, i like to use the create_position action:

<create_position name="$sectorpos" space="this.sector" value="this.ship.position" object="this.zone"/>

then print out $sectorpos.
morbideth
Posts: 391
Joined: Sun, 9. Nov 08, 03:07
x3tc

Re: [Help] move command

Post by morbideth »

j.harshaw wrote: Fri, 14. Dec 18, 23:27 Hi,

$object.position defaults to returning the position relative to the object's zone, and it looks like you're telling your ship to move to those coordinates relative to the object's sector? The zones probably just happened to be aligned with the sector's ecliptic, hence the ship ending up at the correct position along the y-axis.

To convert zone coordinates to sector coordinates, i like to use the create_position action:

<create_position name="$sectorpos" space="this.sector" value="this.ship.position" object="this.zone"/>

then print out $sectorpos.
Thanks!

Return to “X4: Foundations - Scripts and Modding”