Forum begins after the advertisement:


adding additional animal steps to follow

Home Forums Video Game Tutorial Series Creating a Farming RPG in Unity adding additional animal steps to follow

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #13538
    mika machaine
    Level 11
    Participant
    Helpful?
    Up
    0
    ::

    hello I want to add cows in addition to chickens can you explain to me how to do it I tried my it doesn’t work thank you

    #13542
    Terence
    Level 30
    Keymaster
    Helpful?
    Up
    0
    ::

    Mika, what issue are you running into when creating cows? Can you provide more details?

    #13547
    Jonathan Teo
    Level 18
    Moderator
    Helpful?
    Up
    0
    ::

    Hi Mika, Create an Animal ScriptableObject in Resources/Animals and ensure that all the fields are filled up.

    For the cow prefab, ensure the AnimalMovement component is added

    #13549
    mika machaine
    Level 11
    Participant
    Helpful?
    Up
    0
    ::

    hello what I did I used the same thing as the chicken instead of the egg I put as a gift when the gift arrives at the term the cow should appear I think it’s due to the IncubationManager script at line 53 (AnimalData chickenData = AnimalStats. GetAnimalTypeFromString(“Chicken”);) I tried another solution I placed the prefabricated cow in the scene (same type as the chicken) however the relationship between the player is not there we cannot interact with the animal maybe I I’m wrong and what you on your side with the same script we can create a new animal with the same type (eating, relationship with the player, evolution of animal) thanks again for the feedback

    #13564
    Jonathan Teo
    Level 18
    Moderator
    Helpful?
    Up
    0
    ::

    I wouldn’t incubate cows. How I would do the cows is have a character sell them, add a special itemdata for the animals, and on the purchase function, instead of adding it to the players inventory, I will start the animal creation sequence in part 19.

    #13565
    mika machaine
    Level 11
    Participant
    Helpful?
    Up
    0
    ::

    hello if I understand correctly you take the character component to make an animal I will test this method on my side thank you for the feedback

    #13568
    Jonathan Teo
    Level 18
    Moderator
    Helpful?
    Up
    0
    ::

    You can refer to how it was done for the chicken from part 19 to 22 and tweak them to work for the cow.

    #13570
    mika machaine
    Level 11
    Participant
    Helpful?
    Up
    0
    ::

    as I tell you even if we respect the steps from 19 to 22 it doesn’t work it’s made for the chicken and what on your side you managed to make it work for a cow I didn’t remember

    #13571
    Jonathan Teo
    Level 18
    Moderator
    Helpful?
    Up
    0
    ::

    Minimally, your cow prefab will need:

    • An AnimalBehaviour component (if you want the cow to do unique things like getting milked by the player, you will need to create a new class that inherits from it)
    • AnimalMovement for its movement
    • <li>AnimalRenderer for animations</li>

    Make sure this prefab is assigned to the AnimalObject variable in the Cow ScriptableObject.

    #13578
    mika machaine
    Level 11
    Participant
    Helpful?
    Up
    0
    ::

    hello I tested this solution it works well however we can’t have the relationship as it’s an animal I would really like to do like the chicken (feed it, win hearts, and subsequently have milk (instead of eggs) it’s really a shame that we can’t add it like the chicken (we give it a name and then we take care of it if it’s possible to do the same thing I would be delighted or then give me the procedure to follow I tested my when I have another name than chicken I have an error that says he can’t find the name thanks again for the feedback

    #13592
    Jonathan Teo
    Level 18
    Moderator
    Helpful?
    Up
    0
    ::
    we can’t have the relationship as it’s an animal I would really like to do like the chicken (feed it, win hearts, and subsequently have milk (instead of eggs) it’s really a shame that we can’t add it like the chicken (we give it a name and then we take care of it if it’s possible to do the same thing

    Hi Mika, hope you’ve had a good weekend. You’re supposed to call the AnimalStats.StartAnimalCreation(AnimalData animalType) once you buy the cow.

    This will trigger the naming prompt. If you want the cow to be milked, you need to create a new class like the chicken and inherit it from AnimalBehaviour.

    I would be delighted or then give me the procedure to follow I tested my when I have another name than chicken I have an error that says he can’t find the name thanks again for the feedback

    Where did you place your cow ScriptableObject? Is it in Resources/Animals?

    It would be helpful if you could post all the code you need help with, as well as a screenshot of your cow ScriptableObject configuration (in the inspector).

    #13597
    mika machaine
    Level 11
    Participant
    Helpful?
    Up
    0
    ::

    hello I thank you I stopped by and very good wk I am attaching the captures and what you can attach to me a code capture that I must insert I created a prefab cow with a scriptableobject cow here is the information that I can give you here is the capture link Vache01 Vache02

    #13600
    Jonathan Teo
    Level 18
    Moderator
    Helpful?
    Up
    0
    ::

    Hi Mika, you’re not supposed to have the ChickenBehaviour class attached to your cow if you don’t want it to lay eggs. Create a new Script CowBehaviour similar to ChickenBehaviour

    #13601
    mika machaine
    Level 11
    Participant
    Helpful?
    Up
    0
    ::

    hello ok I created the CowBehaviour class I assign them to the cow on the other hand I want to recover milk when I approach the cow I guess when in this class I have to define what I want to do to get the milk if I am wrong not of course

    #13602
    Jonathan Teo
    Level 18
    Moderator
    Helpful?
    Up
    0
    ::

    Yup, that’s correct.

    If you want the player to get millk just from talking to the cow, you can override the TriggerDialogue function

Viewing 15 posts - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.

Go to Login Page →


Advertisement below: