Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: MetalDestroyer on August 23, 2009, 06:01:21 pm

Title: Making AI ship going backward forever
Post by: MetalDestroyer on August 23, 2009, 06:01:21 pm
Hi all,

I'm wondering if it is possible to make an AI ship going backward indefinitely ?
I found out in the ships.tbl, the '$Rear speed' option with his value. But I found nothing in SEXP which let me use this.

There is the "set-object-speed-z" command, but whatever negative value I give, the ship doesn't go backward.

Here the SEXP:
Quote
$Formula: ( every-time
   ( true )
   ( set-object-speed-z
      "My Ship"
      -50
   )
)
Title: Re: Making AI ship going backward forever
Post by: Colonol Dekker on August 23, 2009, 06:24:22 pm
Every time what is true?
Title: Re: Making AI ship going backward forever
Post by: Galemp on August 23, 2009, 06:33:12 pm
You don't want 'every-time' you just want 'when'.
Title: Re: Making AI ship going backward forever
Post by: MetalDestroyer on August 24, 2009, 01:18:15 am
I tryed with the When condition and nothing happened. :/
Title: Re: Making AI ship going backward forever
Post by: chief1983 on August 24, 2009, 11:58:30 am
Is a negative speed considered backwards or is it a combination of a positive speed and a negative thrust modifier that you really need?
Title: Re: Making AI ship going backward forever
Post by: Colonol Dekker on August 24, 2009, 12:06:11 pm
You can't just use a when, try using a has time elapsed.
Title: Re: Making AI ship going backward forever
Post by: Axem on August 24, 2009, 12:38:00 pm
He's not just using a when, he's using

when
-> true

evaluates to true on the first frame. It's valid and I use it all the time.  ;)

Also in my experience set-object-speed-xyz just acts as an impulse. It will only set that speed for 1 frame and the game's physics will slow/speed it down/up right after.

I have used set-object-speed with some effect before, I'll have a looksie when I get home today.
Title: Re: Making AI ship going backward forever
Post by: MetalDestroyer on August 24, 2009, 05:12:17 pm
It seems the engine doesn't do anything when the speed has a negative value.

Edit: I've just notice something interesting. We can make a ship go backward without using any SEXP. Just put a negative value on $Max Velocity.
In FRED, set a default velocity to the ship you want to go backward. Execute the mission, the ship go backward until it reach 0. His speed is totally exponantial.

SEXP doesn't recognize negative value.

:/