Safepos Z min max

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

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

thomasbkdk
Posts: 179
Joined: Wed, 8. Jan 20, 07:34
x4

Safepos Z min max

Post by thomasbkdk »

Can someone tell me if this coding line means a position minimum 6km from player ship plus max 2km on the z axis?

<position object="player.ship" z="6km" max="2km"/>

If not, how do i add some randomness into the position on the z axis?
How would it look if it had to be minimum 6km from playership but maximum 8km on the Z axis?
AMD 3700X|GSKILL 2x32GB 3600C17|MSI X570 UNIFY|MSI RX 6800|SAMSUNG NVME 990 PRO|RAZER TARTARUS PRO|AOC AGON AG273QX 2560x1440@165|STREAM DECK XL+PEDAL|CORSAIR K95 PLATINUM RGB
User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13477
Joined: Sun, 15. Feb 04, 20:12
x4

Re: Safepos Z min max

Post by euclid »

Usually I use create_position as you can set individual (also random) coordinates. For example:

Code: Select all

<create_position name="$pos" space="player.sector" x="[$xmin $xmax].random" y="[$ymin $ymax].random" z="[$zmin $zmax].random"/>
and after that:

Code: Select all

 <position value="$pos"/>
If you want the x and y positions to be the player's ship then use player.ship.position for the corresponding values or set the player's ship as object in the position command.

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786
thomasbkdk
Posts: 179
Joined: Wed, 8. Jan 20, 07:34
x4

Re: Safepos Z min max

Post by thomasbkdk »

I see 'radius' used in some coding.

will something like this work
<position object="player.ship" radius="6km" />

or
<create_position name="$pos" space="player.ship" radius="[3km 5km].random"/>
or just
<create_position name="$pos" space="player.ship" radius="5km"/>
AMD 3700X|GSKILL 2x32GB 3600C17|MSI X570 UNIFY|MSI RX 6800|SAMSUNG NVME 990 PRO|RAZER TARTARUS PRO|AOC AGON AG273QX 2560x1440@165|STREAM DECK XL+PEDAL|CORSAIR K95 PLATINUM RGB
j.harshaw
EGOSOFT
EGOSOFT
Posts: 2148
Joined: Mon, 23. Nov 15, 18:02

Re: Safepos Z min max

Post by j.harshaw »

min/max in this context (as well as get_safepos and create_position) adds a random offset to the defined position.
thomasbkdk wrote: Tue, 28. Jan 25, 08:30 <position object="player.ship" z="6km" max="2km"/>
Not sure what max does by itself (day is done and i'm really trying to not crack open code) but if you also specified min, it would be some random offset in a random direction between min and 2km away from 6km in front of player.ship.

Code: Select all

ship------
           \
            \
            pos

Return to “X4: Foundations - Scripts and Modding”