Advertisement
SeenWonderAlex

Baldi's Basics Script Changes For Beans Tutorial

May 3rd, 2020 (edited)
4,747
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.81 KB | None | 0 0
  1. /*
  2. Since GameBanana doesn't let me post the script, I have to post this in this website.
  3.  
  4. Remember, I don't use these scripts. If you have any bugs, tell me or BaldiaBsicsFan.
  5.  
  6. Follow directions from the comments. Comments begin with //
  7. */
  8.  
  9. // For the BsodaEffectScript
  10. // Add this on the OnTriggerStay function
  11. if (other.name == "Gum" & gameObject.name != "Beans")
  12. {
  13.     if (other.transform.position.y <= 0f)
  14.     {
  15.        other.transform.position = new Vector3(transform.position.x, 0f, transform.position.z);
  16.        return;
  17.     }
  18.     other.GetComponentInChildren<SpriteRenderer>().sprite = BeansScript.spriteNPCGum;
  19.     other.GetComponent<BsodaSparyScript>().speed = 0f;
  20.     UnityEngine.Object.FindObjectOfType<BeansScript>().SorryNPC();
  21.     other.transform.position = new Vector3(transform.position.x, 0f, transform.position.z);
  22.     otherVelocity = base.transform.forward * agent.speed * 0.05f;
  23.     Object.Destroy(other.gameObject, 10f);
  24.     inBsoda = true;
  25.     failSave = 10f;
  26. }
  27.  
  28. // For the PlayerScript
  29. // Add this on the OnTriggerStay function
  30. if (other.name == "Gum" && other.GetComponentInChildren<SpriteRenderer>().sprite != BeansScript.spriteNPCGum)
  31. {
  32.     StartCoroutine(Stucked());
  33.     Object.Destroy(other.gameObject, 0f);
  34.     UnityEngine.Object.FindObjectOfType<BeansScript>().SorryPlayer();
  35. }
  36. // End of the OnTriggerStay function
  37.  
  38. // Add this variable to the script
  39. public GameObject gumScreen; // The gum on the hud when hit.
  40.  
  41. // Make sure System.Collections is defined, then add this.
  42. private IEnumerator Stucked()
  43. {
  44.     gumScreen.SetActive(true);
  45.     walkSpeed -= 8f;
  46.     runSpeed -= 8f;
  47.     playerSpeed = walkSpeed;
  48.     yield return new WaitForSeconds(10f);
  49.     walkSpeed += 8f;
  50.     runSpeed += 8f;
  51.     playerSpeed = walkSpeed;
  52.     gumScreen.SetActive(false);
  53.     yield break;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement