Ads keep us online. Without them, we wouldn't exist. We don't have paywalls or sell mods - we never will. But every month we have large bills and running ads is our only way to cover them. Please consider unblocking us. Thank you from GameBanana <3

How To Make A New Character With Mechanics?

A Question for Baldi's Basics

No ads for members. Membership is 100% free. Sign up!

Question Solved

This Question was answered and a solution was chosen.

I need some help with this, please!

Hello! I am wondering how do you make a new character in decompiles and give them a mechanic, such as doing something to you if they see you, or running away from the player? If someone knows how to do this, I would like to know. (Below is what I want some new characters I want to add to do)

Character 1:
Mechanic - They will randomly wander around the halls, like the other characters do, and when they touch you, you will get stuck in place for 5 seconds (or 5-10 seconds if its possible to make it a random number between two numbers).

Character 2:
Mechanic - They will randomly wander around the halls, and when they touch you, they give you an item that you can only get from them once, and after getting it from them, they dissapear and don't appear again for the rest of the game

Character 3:
Mechanic - They wander randomly around the halls, and when you get close to them, they rush at you and when they touch you they teleport you to a random location on the map and dissapear for the rest of the game. They also only appear once the player has gotten 4 notebooks. (kinda similar to arts and crafters, but only warps you once and doesn't appear until 4 notebooks)

If someone knows how to make at least one of these character mechanics, I would appreciate if you also showed me the code.
Sign up to access this!
  • RealT5mpler avatar
    RealT5mpler Joined 8mo ago
    Not on right ok
    412 points Ranked 47313rd
    15 medals 3 rare
    • Returned 1000 times Medal icon
    • 25 posts awarded Exemplary Feedback Medal icon
    • Submitted 15 Tutorials Medal icon
    • One month a member Medal icon
    • Returned 100 times Medal icon
    • 1 post awarded Exemplary Feedback Medal icon
    access_time 2mo edit 2mo
    Mechanic 1:
    Make a OnTriggerEnter or Stay and also make 2 variables, a boolean and a timer. For the timer set it to a number in the OnTriggerEnter and also set the boolean to true. Then also in the update method put
    if (timer > 0)
    {
    this.timer -= Time.deltaTine;
    }
    else
    {
    if (boolean)
    {
    This.boolean = false;
    }
    And the code for the OntriggerEnter 

    {
    if (other.tag == "Player")
    {
    this.timer = 5f;
    this.boolean = true;
    }
    }
    Now in the PlayerScript, reference your new characterScript with a variable and in the Run if statement put if (!this.cs.boolean)
    {
    (Code for Running & walking)
    }

    Mechanic 2
    Copy this in your OnTriggerEnter/Stay

    {
    If (other.tag == "Player")
    {
    int id = Mathf.RoundToInt(UnityEngine.Random.Range(0,10)
    this.gc.CollectItem(id);
    this.newcharcter.SetActive(false);

    Mechanic 3
    Make a NavMeshAgent to control the character speed , make sure to reference it
    Again make an OnTriggerEnter/Stay and have this:

    {
    if (other.tag == "Player")
    {
    if (this.gc.notebooks == 4)
    {
    this.agent.speed = (higher speed);
    (Use the teleporting tutorial i have for the teleporting stuff)
    }
    else
    {
    this.newcharacter.SetActive(false);
    }
    }

    Note: Make sure your new character is a GameObject so you can use the .SetActive() method
    Never Give up on what you want avatar
    Mantra
    Never Give up on what you want
    URL to post:

Embed

Share banner
Image URL
HTML embed code
BB embed code
Markdown embed code

Asker

Prob. At School
1,542 points Ranked 21867th
25 medals 2 legendary 4 rare
  • 2019 Top Contributor Medal icon
  • Returned 5000 times Medal icon
  • Returned 1000 times Medal icon
  • 10 submissions featured Medal icon
  • Reached 50 subscribers Medal icon
  • Received thanks 50 times Medal icon
JohnsterSpaceProgram Johnster Space Studio Flag
Affiliation
Johnster Space Studio

Sign up to access this!
Sign up to access this!
Sign up to access this!

Game

Sign up to access this!

Category

Share

  • Share on Reddit
  • Share on Twitter
  • Share on Facebook
  • 0
  • 475
  • 5
  • 2mo
  • 2mo

More from Submitter

WiPs by Submitter

More Decompile Help Questions