Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: Cobra on July 06, 2010, 09:43:07 pm

Title: Ship-maneuver not working
Post by: Cobra on July 06, 2010, 09:43:07 pm
I'm working on a SEXP that makes the player's go into a flat spin. The SEXP itself seems sound, but when it comes into play nothing happens. The player is under ai control, plays dead so it doesn't attack anything, and the maneuver event fires but the actual rotation doesn't occur.

Code: [Select]
$Formula: ( when
   ( and
      ( < ( hits-left "Zeta 1" ) 10 )
      ( is-event-true-delay
         "Durga Teleports, Pew Pew"
         0
      )
   )
   ( ship-invulnerable "Zeta 1" )
   ( protect-ship "Zeta 1" )
   ( add-goal
      "Rama"
      ( ai-ignore "Zeta 1" 89 )
   )
   ( add-goal
      "Durga"
      ( ai-ignore "Zeta 1" 89 )
   )
   ( add-goal
      "Arjuna"
      ( ai-ignore "Zeta 1" 89 )
   )
   ( add-goal
      "Krishna"
      ( ai-ignore "Zeta 1" 89 )
   )
   ( add-goal
      "Asura"
      ( ai-ignore "Zeta 1" 89 )
   )
   ( add-goal
      "Varuna"
      ( ai-ignore "Zeta 1" 89 )
   )
   ( add-goal
      "Shiva"
      ( ai-ignore "Zeta 1" 89 )
   )
   ( player-use-ai )
   ( add-goal
      "Zeta 1"
      ( ai-play-dead 89 )
   )
   ( sabotage-subsystem
      "Zeta 1"
      "<all engines>"
      95
   )
)
+Name: Player damaged
+Repeat Count: 1
+Interval: 1
+Team: 0

$Formula: ( when
   ( is-event-true-delay
      "Player damaged"
      0
   )
   ( ship-maneuver
      "Zeta 1"
      1000
      0
      0
      100
      ( true )
      0
      0
      100
      ( true )
   )
   ( set-camera-shudder 9000 500 )
   ( training-msg "Spin Debug" )
)
+Name: FLAT SPIN EJECT GOOSE
+Repeat Count: 9999
+Trigger Count: 9999
+Interval: 1
+Team: 0
Title: Re: Ship-maneuver not working
Post by: General Battuta on July 06, 2010, 10:21:36 pm
Won't play dead cause the ship to reject the spin?

Try removing that?
Title: Re: Ship-maneuver not working
Post by: FUBAR-BDHR on July 07, 2010, 12:11:53 am
Not sure about play-dead but not having engines sure will.
Title: Re: Ship-maneuver not working
Post by: Iss Mneur on July 07, 2010, 01:13:08 am
Won't play dead cause the ship to reject the spin?

Try removing that?
It shouldn't reject it.  But it will defiantly not act upon it.

But like FUBAR noted, not having engines will cause the AI to not move at all.

If you want the ship to move without engines (I assume for the visual effect) then I would suggest using the set-object-facing and set-object-position.
Title: Re: Ship-maneuver not working
Post by: Axem on July 07, 2010, 07:30:49 am
Iss Mneur: That wouldn't work for what he's trying to do. You can't bank the fighter with those sexps. What's really odd is that I've gotten this effect to work before! Why its not working now it a total mystery...

The issue with ship-maneuver and AI orders is that the AI will attempt to move with the maneuver, not using play-dead may let the AI react to dynamic orders. The AI may be canceling out the spin through his own "counter maneuver."

Maybe if you set no dynamic goals and then clear orders for Alpha 1 before anything else? An order to Alpha Wing or all fighters is an order that the "player" will carry out if he goes under ai control, and that order will be above 89 priority. So you could try increasing that too.

I'm just shooting in the dark here.
Title: Re: Ship-maneuver not working
Post by: Cobra on July 18, 2010, 09:56:11 pm
Code: [Select]
$Formula: ( when
   ( true )
   ( add-goal
      "Alpha 1"
      ( ai-waypoints-once
         "Waypoint path 1"
         89
      )
   )
)
+Name: Auto start
+Repeat Count: 1
+Interval: 1

$Formula: ( when
   ( is-event-true-delay "Auto start" 1 )
   ( player-not-use-ai )
   ( clear-goals "Alpha 1" )
)
+Name: AI Off
+Repeat Count: 1
+Interval: 1

$Formula: ( when
   ( <
      ( distance
         "Alpha 1"
         "Waypoint path 1:1"
      )
      500
   )
   ( player-use-ai )
)
+Name: Spin Setup
+Repeat Count: 1
+Interval: 1

$Formula: ( when
   ( is-event-true-delay "Spin Setup" 0 )
   ( player-use-ai )
   ( add-goal
      "Alpha 1"
      ( ai-play-dead 100 )
   )
)
+Name: Alpha 1 AI
+Repeat Count: 999
+Trigger Count: 999
+Interval: 1
+Team: 1

$Formula: ( when
   ( is-event-true-delay "Alpha 1 AI" 1 )
   ( ship-maneuver
      "Alpha 1"
      1000
      100
      0
      0
      ( true )
      0
      0
      100
      ( true )
   )
   ( training-msg "EJECT" )
)
+Name: Spinning
+Repeat Count: 999
+Trigger Count: 999
+Interval: 1
+Team: 0

This is what I did in a test mission. It turns, but it turns reeeeeeeeeeaaaaaaaaaaaaaaaaaaallllllllllllllyyyyyyyyyyyyyyy slooooooooooooooowwwwwwwwwwwwwwllllllllllllllyyyyyyyyyy.

[EDIT]On further study at x64 time compression it seems that it just orbits the waypoint.