CodeBrain

April 24th, 2009, 03:47 PM

Anyone who is anyone saw the tutorial for making a "hyper drive" module for a ship/vehicle, which had a lot of chips on it?

In case you didn't, here it is:

SsUlbYMytms

Well, I rewatched that tutorial. I felt it was necessary to "upgrade" it. This time, instead of millions of chips, I said "Let there be Expression!"

So, here is the Expression...

@name CodeBrain's HyperDrive

@inputs GPSx GPSy GPSz GPS2x GPS2y GPS2z

@outputs Jump_X Jump_Y Jump_Z

@persist Sub Sub2 Sub3 Sub4 Mult Mult2 Mult3 Mult4 Mult5 Mult6 Add Div Div2 Div3 SqRt

Sub = GPSx - GPS2x

Sub2 = GPSy - GPS2y

Sub3 = GPSz - GPS2z

Mult = Sub * Sub

Mult2 = Sub2 * Sub2

Mult3 = Sub3 * Sub3

Add = Mult + Mult2 + Mult3

SqRt = sqrt(Add)

Div = Sub / SqRt

Div2 = Sub2 / SqRt

Div3 = Sub3 / SqRt

Mult4 = Div * 2000

Mult5 = Div2 * 2000

Mult6 = Div3 * 2000

Jump_X = Mult4 + GPSx

Jump_Y = Mult5 + GPSy

Jump_Z = Mult6 + GPSz

NOTE:I might of got it wrong, I am currently at school right now. I will update this post when I get back home.

How to wire:

You'll need the following:

2 GPS's

The Expression

HoverDrive Controller

And a Numpad Input.

Tutorial:

1. Place first GPS on the front of your prop (Lets use a 1x1 Tile board.), and the second on the back of the prop. (With SmartSnap, this isn't hard.)

2. Place the Expression somewhere on the 1x1 plate.

3. Place a Numpad Input somewhere on the 1x1 plate.

4. Spawn a HoverDrive Controller, and Easy Weld (Or Easy Precision) it to the 1x1 plate.

5. Wire the GPSx, GPSy, and GPSz inputs to the front GPS.

6. Wire the GPS2x, GPS2y, and the GPS2z inputs to the back GPS.

7. Wire the Target_X on the HoverDrive to the Jump_X output.

8. Wire the Target_Y on the HoverDrive to the Jump_Y output.

9. Wire the Target_Z on the HoverDrive to the Jump_Z output.

10. Finally, wire the SetJumpTarget and Jump on the HoverDrive to the Numpad Input.

Okay, you SHOULD be set. If it does not work, it might be my knowledge on the Hoverdrive. Also it might be the @persist part, I havent checked. I will once I get home.

If you need help, wire 3 screens (Doesn't matter the name) to the Jump Coordinates (Jump_X, Jump_Y, and Jump_Z), and see what they are.

Normally, it should be somewhere in 1000 to 5000. It depends on the map size. If it is higher than normal (Say 20000) then something is wrong. You could also use the Debugger tool instead of the screens, I like the screens though :D

I hope you enjoyed the tutorial!

In case you didn't, here it is:

SsUlbYMytms

Well, I rewatched that tutorial. I felt it was necessary to "upgrade" it. This time, instead of millions of chips, I said "Let there be Expression!"

So, here is the Expression...

@name CodeBrain's HyperDrive

@inputs GPSx GPSy GPSz GPS2x GPS2y GPS2z

@outputs Jump_X Jump_Y Jump_Z

@persist Sub Sub2 Sub3 Sub4 Mult Mult2 Mult3 Mult4 Mult5 Mult6 Add Div Div2 Div3 SqRt

Sub = GPSx - GPS2x

Sub2 = GPSy - GPS2y

Sub3 = GPSz - GPS2z

Mult = Sub * Sub

Mult2 = Sub2 * Sub2

Mult3 = Sub3 * Sub3

Add = Mult + Mult2 + Mult3

SqRt = sqrt(Add)

Div = Sub / SqRt

Div2 = Sub2 / SqRt

Div3 = Sub3 / SqRt

Mult4 = Div * 2000

Mult5 = Div2 * 2000

Mult6 = Div3 * 2000

Jump_X = Mult4 + GPSx

Jump_Y = Mult5 + GPSy

Jump_Z = Mult6 + GPSz

NOTE:I might of got it wrong, I am currently at school right now. I will update this post when I get back home.

How to wire:

You'll need the following:

2 GPS's

The Expression

HoverDrive Controller

And a Numpad Input.

Tutorial:

1. Place first GPS on the front of your prop (Lets use a 1x1 Tile board.), and the second on the back of the prop. (With SmartSnap, this isn't hard.)

2. Place the Expression somewhere on the 1x1 plate.

3. Place a Numpad Input somewhere on the 1x1 plate.

4. Spawn a HoverDrive Controller, and Easy Weld (Or Easy Precision) it to the 1x1 plate.

5. Wire the GPSx, GPSy, and GPSz inputs to the front GPS.

6. Wire the GPS2x, GPS2y, and the GPS2z inputs to the back GPS.

7. Wire the Target_X on the HoverDrive to the Jump_X output.

8. Wire the Target_Y on the HoverDrive to the Jump_Y output.

9. Wire the Target_Z on the HoverDrive to the Jump_Z output.

10. Finally, wire the SetJumpTarget and Jump on the HoverDrive to the Numpad Input.

Okay, you SHOULD be set. If it does not work, it might be my knowledge on the Hoverdrive. Also it might be the @persist part, I havent checked. I will once I get home.

If you need help, wire 3 screens (Doesn't matter the name) to the Jump Coordinates (Jump_X, Jump_Y, and Jump_Z), and see what they are.

Normally, it should be somewhere in 1000 to 5000. It depends on the map size. If it is higher than normal (Say 20000) then something is wrong. You could also use the Debugger tool instead of the screens, I like the screens though :D

I hope you enjoyed the tutorial!