Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: CommanderDJ on September 21, 2010, 08:28:39 am

Title: Making the player face a ship
Post by: CommanderDJ on September 21, 2010, 08:28:39 am
Hello all,
I once again ask for your assistance in a FREDding matter. At one point in a mission, I want the player to turn to face a specific ship in the area (rather quickly, think of turning your head to look at a flicker of movement in the corner of your vision). The player would obviously need to be under AI control at that point, but I'm rather confuzzled as to how to bring that about. Any help greatly appreciated.

CommanderDJ
Title: Re: Making the player face a ship
Post by: The E on September 21, 2010, 08:31:55 am
Use set-object-facing-object for great success.
Title: Re: Making the player face a ship
Post by: Dilmah G on September 21, 2010, 08:33:53 am
There's also a player use ai sexp lying around for your ai player control needs.
Title: Re: Making the player face a ship
Post by: CommanderDJ on September 21, 2010, 08:34:19 am
Use set-object-facing-object for great success.

But wouldn't that make the player instantly face the ship? Me wantz turning motion.
Title: Re: Making the player face a ship
Post by: The E on September 21, 2010, 08:35:38 am
Please take a closer look at the sexp.
Code: [Select]
set-object-facing-object
Sets an object's orientation to face the specified object. Takes 2 arguments...
1: The name of an object.
2: The object to face.
3: Turn time in milliseconds (optional)
4: Bank (optional)

I wonder what those optional arguments do....
Title: Re: Making the player face a ship
Post by: Dilmah G on September 21, 2010, 08:38:58 am
Don't worry, I've done the same thing before. (assumed a sexp does what it sounds like it does without reading the box in FRED and having an epiphany).
Title: Re: Making the player face a ship
Post by: CommanderDJ on September 21, 2010, 08:43:30 am
Please take a closer look at the sexp.
Code: [Select]
set-object-facing-object
Sets an object's orientation to face the specified object. Takes 2 arguments...
1: The name of an object.
2: The object to face.
3: Turn time in milliseconds (optional)
4: Bank (optional)

I wonder what those optional arguments do....

CommanderDJ feels pwnage and wrath of The E. My n00bness has been revealed once again.

What's the bank thing do? Does it make much difference?

Don't worry, I've done the same thing before. (assumed a sexp does what it sounds like it does without reading the box in FRED and having an epiphany).

Yeah. That's exactly what I did.
Title: Re: Making the player face a ship
Post by: Dilmah G on September 21, 2010, 08:47:25 am
I assume the bank thing will bank the player ship as the turn executes, to perhaps emulate turning in atmospheric conditions. I dunno, best way to learn is to try it yourself! :)
Title: Re: Making the player face a ship
Post by: ReeNoiP on September 21, 2010, 08:59:18 am
IIRC bank is a toggle. Either the ship is allowed to bank as much as it wants, or not at all.
Title: Re: Making the player face a ship
Post by: CommanderDJ on September 23, 2010, 02:07:11 am
Hey guys,
I'm having problems with this. I've got

Code: [Select]
set-object-facing
      Alpha 1
      get-object-x
             ship-here
      get-object-y
             ship-here
      get-object-z
             ship-here
      1000

But all that happens is the player ship does a tiny turn in the general direction of the ship, which never comes into view at all. What am I doing wrong?
Title: Re: Making the player face a ship
Post by: FUBAR-BDHR on September 23, 2010, 02:12:44 am
Been awhile since I tried it but I believe you have to make it a repeating event until it's facing the ship. 
Title: Re: Making the player face a ship
Post by: Colonol Dekker on September 23, 2010, 03:20:19 am
Open a mission from a campaign that features it and peek at how it's done ;D
Title: Re: Making the player face a ship
Post by: CommanderDJ on September 23, 2010, 04:43:16 am
Been awhile since I tried it but I believe you have to make it a repeating event until it's facing the ship. 

What do you mean by a repeating event? As you can tell, I'm a FREDding n00b.

Open a mission from a campaign that features it and peek at how it's done ;D

1. I can't think of any campaigns off the top of my head that do that that I have accessible.
2. If I wanted to do that, I wouldn't have asked for help here.
Title: Re: Making the player face a ship
Post by: General Battuta on September 23, 2010, 07:04:54 am
Been awhile since I tried it but I believe you have to make it a repeating event until it's facing the ship. 

What do you mean by a repeating event? As you can tell, I'm a FREDding n00b.

Increase the event's trigger or repeat counts (repeat is apropos here I believe) in the boxes to the right of the events list.
Title: Re: Making the player face a ship
Post by: FreeSpaceFreak on September 23, 2010, 10:54:38 am
Use set-object-facing-object for great success.