Created
October 17, 2019 07:35
-
-
Save modelmat/73d65568300fb9cebbbf47377c4ad38f to your computer and use it in GitHub Desktop.
Ravenfield Landable Planes Script. Tested through to EA12, may work in newer versions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
1. Create a bool `down` in the Plane script class. | |
2. Insert the below code in the methods in the Plane class. | |
*/ | |
void Update() { | |
// Insert at the end | |
if (Input.GetKeyDown(KeyCode.Z) && this.seats[0].IsOccupied() && !this.seats[0].occupant.aiControlled) | |
{ | |
if (this.down) { | |
this.down = false; | |
} else { | |
this.down = true; | |
} | |
this.animator.SetBool("landing gears", this.down); | |
} | |
} | |
void FixedUpdate() { | |
// Replace `this.rigidbody.AddForce(...)` with this. | |
if (this.animator.GetBool("landing gears") && !this.isAirborne && vector.z < 10f && this.seats[0].IsOccupied() && !this.seats[0].occupant.aiControlled) | |
{ | |
this.rigidbody.drag = 1.5f; | |
this.engine.enabled = false; | |
} | |
if (SteelInput.GetAxis(SteelInput.Inputs.PlaneThrottle) < 0f && this.seats[0].IsOccupied() && !this.seats[0].occupant.aiControlled) | |
{ | |
this.rigidbody.AddForce(force * 0.3f, ForceMode.Acceleration); | |
} | |
else | |
{ | |
if (this.seats[0].IsOccupied() && !this.seats[0].occupant.aiControlled) | |
{ | |
this.engine.enabled = true; | |
} | |
this.rigidbody.drag = 0.12f; | |
this.rigidbody.AddForce(force, ForceMode.Acceleration); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment