Author Topic: Movements-SEXPs, capship useful (v2.7)  (Read 26809 times)

0 Members and 1 Guest are viewing this topic.

Offline wookieejedi

  • 29
  • Intensify Forward Firepower
Re: Release of Movements-SEXPs, capship useful (v1.5 May 17, 2020)
Updated to Version 1.5 which provides a very important bug fix for doing the automatic rotation time calculation. Also re configured script to run in $Simulation Hook per m!m's suggestion.

 

Offline wookieejedi

  • 29
  • Intensify Forward Firepower
Re: Release of Movements-SEXPs, capship useful (v1.5 May 17, 2020)
Updated to version 1.6 which correctly calculates the default distance for ship tracking if the value was not specified. Thanks for EatThePath for catching this!

 

Offline wookieejedi

  • 29
  • Intensify Forward Firepower
Re: Release of Movements-SEXPs, capship useful (v1.7 June 10, 2021)
Updated to version 1.7, which adds safety checks to ensure these scripts do not run in multiplayer. Also added to sexp descriptions that custom sexps will not work in multiplayer.

 

Offline wookieejedi

  • 29
  • Intensify Forward Firepower
Re: Movements-SEXPs, capship useful (v1.7)
Updated to version 1.8 which includes two new custom sexps:

"set-bank-constant"
Sets the bank constant of a given ship. Bank constant is the amount of roll (bank) a ship does when turning (yawing).

"set-deceleration-time"
Sets the deceleration time of a given ship. Setting this to 0 will ensure that ships stop precisely at waypoints. Note, stopping may look a bit rigid if the ship is going very fast.

Also changed the "play-dead-persistent" order to be disabled by default.

 

Offline wookieejedi

  • 29
  • Intensify Forward Firepower
Re: Movements-SEXPs, capship useful (v2.0)
Updated to version 2.0, which fulfills a long-term goal for default ship rotation--that the scripted rotations look identical to regular ship rotations (including momentum and damping). 

Important! You need an FSO build of August 24, 2022 or newer for these to work.

If you were using default values for rotation times for the custom sexps `rotate-to-orientation` or `add-ai-goal-track-ship` then this update will allow those rotations to look far more natural. 

Previously, this script set ship rotations based on a linear scale for all situations. This was fine if a precise rotation time was needed, but looked a bit rigid and unnatural if a default rotation time was desired. This update adds a new method for using the default rotation time. The overall amount of time the rotation takes is nearly the same, but the rotation looks much more smooth comparatively. This update also keeps the previous behavior and option for precise, specified rotations.

There are use cases for both.
  • Using specifying precise rotation times works on player ships too and can allow FREDers to manually time rotations to specific components of missions, such as music or other timed events.
  • Using the default rotation time (ie, not specifying a precise time and just using the ships normal, tabled values) only works for AI ships, but looks more natural.
 
« Last Edit: August 24, 2022, 09:50:54 am by wookieejedi »

 

Offline wookieejedi

  • 29
  • Intensify Forward Firepower
Re: Movements-SEXPs, capship useful (v2.0)
EDIT: updated with hot-fix for folks who use `continuous-orientation-check` with relatively small distances.

 

Offline wookieejedi

  • 29
  • Intensify Forward Firepower
Re: Movements-SEXPs, capship useful (v2.0)
Updated to version 2.1, which fulfills another long-term goal: Whether or not the ship should stop moving if it is about to hit something large. If set to true the ship will pause the current waypoint order and not resume again until the path is clear. Default value is false (no stopping for obstacles), so current implementation of sexps is still compatible.

Important! You need an FSO build of August 27, 2022 or newer for these to work.

 

Offline wookieejedi

  • 29
  • Intensify Forward Firepower
Re: Movements-SEXPs, capship useful (v2.1)
Updated to version 2.2 which includes a new sexp and adds more functionality to another existing sexp.

Added `move-to-face-object` which has all the bells and whistles of `move-to-orientation` but is for rotating to face a ship or waypoint, not a specific orientation. Useful if you want one or more cap ships to rotate naturally to face a specific point or another ship. You might say, hey how is this different from the existing sexp 'set-object-facing'? With that sexp you have to call it every frame, and it is difficult to manually tune how long a rotation should take. With this new sexp, set it all once (including a delay, specific rotation time, or default natural rotation time) and let the sexp do the rest of the work for you.

Updated `add-waypoint-track-ship` sexp to now also be able to track another waypoint. The name remains the same for backwards compatibility, though the help text has been updated accordingly. This is useful if you want your waypoints to track other waypoints instead of just ships.


 

Offline wookieejedi

  • 29
  • Intensify Forward Firepower
Re: Movements-SEXPs, capship useful (v2.3)
Updated to version 2.3:

Added new `get-waypoint-speed-cap` lua sexp.
Returns the current waypoint speed cap of a given ship (the speed that is set with the sexp 'cap-waypoint-speed'). Will return cap speed value if a cap is set, -1 if no cap is set, and 0 if ship is invalid.

Added new `set-pos-to-rand-pos-on-hull` lua sexp.
Chooses a random point on the hull of a given ship and sets the position of the given object to that point.

Updated with minor optimizations and code cleanup.
« Last Edit: January 16, 2023, 09:58:30 pm by wookieejedi »

 
Re: Movements-SEXPs, capship useful (v2.1)
Added `move-to-face-object` which has all the bells and whistles of `move-to-orientation` but is for rotating to face a ship or waypoint, not a specific orientation. Useful if you want one or more cap ships to rotate naturally to face a specific point or another ship. You might say, hey how is this different from the existing sexp 'set-object-facing'? With that sexp you have to call it every frame, and it is difficult to manually tune how long a rotation should take. With this new sexp, set it all once (including a delay, specific rotation time, or default natural rotation time) and let the sexp do the rest of the work for you.

This sounds utterly lovely!

 

Offline Darius

  • 211
Re: Movements-SEXPs, capship useful (v2.3)
The entire package has been a godsend  :yes:

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Re: Movements-SEXPs, capship useful (v2.3)
Hmmmm

`set-pos-to-rand-pos-on-hull`

Can that work on waypoints?
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.

 

Offline wookieejedi

  • 29
  • Intensify Forward Firepower
Re: Movements-SEXPs, capship useful (v2.3)
Yes, that's the main reason I made it actually  :)
(Behind the scenes reason is that I added repair droids to FotG, and wanted a way for them to pick a random position on a ships hull to fly to, so I set the waypoint position with this sexp, then order them to go to the waypoint).

 

Offline wookieejedi

  • 29
  • Intensify Forward Firepower
Re: Movements-SEXPs, capship useful (v2.4)
Very glad to have it be so useful for folks!


Another quick small update, per request of MjN for an additional sexp.

v2.4:

Added new `set-pos-to-rand-pos-in-b-box` lua sexp.
Chooses a random position within the bounding box of a given ship and sets the position of the given object to that point. Note, the randomly selected position by be inside the ship geometry.

 

Offline wookieejedi

  • 29
  • Intensify Forward Firepower
Re: Movements-SEXPs, capship useful (v2.5)
Updated script to version 2.5 which includes some internal cleanup along with extra error checking to prevent edge case script warnings in-game.

 

Offline wookieejedi

  • 29
  • Intensify Forward Firepower
Re: Movements-SEXPs, capship useful (v2.5)
Updated script to version 2.6 which includes a new sexp `set-acceleration-time`, which sets the acceleration time of a given ship (in milliseconds). Setting this to the same value on a group of ships can be useful to ensure consistent movement.

This new sexp and the `set-deceleration-time` sexp have also been updated to allow resetting the values to the tabled values by using an argument that is negative.

Also updated the script with some internal cleanup.

 

Offline wookieejedi

  • 29
  • Intensify Forward Firepower
Re: Movements-SEXPs, capship useful (v2.7)
Updated script to version 2.7 which includes the following:

Added 'pause-ai-goal-track-waypoint'. This new SEXP pauses a custom `add-ai-goal-track-waypoint` goal, which is very useful if you want to pause a ship-track-waypoint or ship-track-ship order without removing it and then having to re-add it will all options again. The specified ship will stop moving along the waypoint path and remain still (though it will still hold it's goal). The sexp pauses any custom order for that ship, even if there are more than one. Additionally, this pause will only work if the ship retains a `add-ai-goal-track-waypoint` goal. If the ship orders are cleared or the custom `remove-ai-goal-track-waypoint` sexp is used then this sexp will do nothing. True will trigger a pause, stopping ship movement. False will remove the triggered pause and the ship will resume using the waypoint logic it was using before. Note, this sexp only has to be called once.

Slightly improved the 'smart-stop' collision detection in close-quarters situations. Previously, the 'smart-stop' option only used a ray-trace from a ship's center to see what collisions might occur, but now there is an additional option that also checks for radius overlap at close ranges. This helps fix the issue where two large ships might be moving to the same waypoint and thus would have previously collided, now they will detect they are in each others radii and the 'smart-stop' will be triggered early enough to ideally avoid collision.

Slightly optimized script for cases where 'smart-stop` was not being used.