I'm still learning by reading codes other people have made.
In the one I am working on now, I am trying to create a station (an object, actually) which I want to appear a few sectors behind the player ship.
Below, is as close as I have gotten.
This code will place a station 5 sectors in front of the player ship:
(block (newStation)
(setq obj (sysCreateStation &stCrateFunCrate; (sysVectorPolarOffset gPlayerShip (shpGetDirection gplayership) 5)))
)
I have searched for other codes to try to figure out how to select the angle behind the ship, but can't really understand what I am seeing. I have plugged numerous things in, but always get errors.
The thruster mod code seems closest to showing me how to find the angle behind the ship, but nothing I have tried so far works.
This is the thruster code for reversing direction of the ship from Prophet:
http://xelerus.de/index.php?s=mod&id=738
;; BRAKES
(and (leq (sysVectorSpeed (objGetVel gSource)) (shpGetMaxSpeed gSource)) (eq aWeaponType &itThrustReverse;))
(block Nil
(setq newAngle (add (shpGetDirection gSource) 180))
(objIncVel gSource (sysVectorPolarVelocity newangle 1))
(sysCreateWeaponFire
&vtThrusterExhaust;
gSource
(sysVectorPolarOffset (objGetPos gSource) (add 180 newAngle) 1)
newAngle
(multiply (sysVectorSpeed (objGetVel gSource)) -1)
Nil
)
)
)
)
;;;;;;;;;;;;;;;
So, this is probably easy for you guys - but difficult for me, but how do I write the code to place the station behind the ship instead of in front of it?
create station behind ship
-
- Fleet Admiral
- Posts: 2876
- Joined: Thu Feb 03, 2011 5:21 am
- Location: Hmm... I'm confused. Anybody have a starmap to the Core?
Try adding 180 degrees so that it faces the other way? :S
Code: Select all
(block (newStation)
(setq obj (sysCreateStation &stCrateFunCrate; (sysVectorPolarOffset gPlayerShip (add(shpGetDirection gplayership)180) 5)))
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat


Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
Get on Discord for mod help and general chat


Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.