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
- This topic has 14 replies, 3 voices, and was last updated 9 months ago by Jonathan Teo.
-
AuthorPosts
-
March 11, 2024 at 11:07 pm #13538::
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
March 13, 2024 at 3:40 am #13542::Mika, what issue are you running into when creating cows? Can you provide more details?
March 13, 2024 at 8:24 am #13547::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
March 13, 2024 at 2:38 pm #13549::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
March 15, 2024 at 12:56 pm #13564::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.
March 15, 2024 at 4:13 pm #13565::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
March 15, 2024 at 4:33 pm #13568::You can refer to how it was done for the chicken from part 19 to 22 and tweak them to work for the cow.
March 15, 2024 at 4:56 pm #13570::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
March 15, 2024 at 5:06 pm #13571::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.
March 16, 2024 at 3:37 am #13578::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
March 18, 2024 at 11:04 am #13592::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).
March 18, 2024 at 10:43 pm #13597March 19, 2024 at 10:22 pm #13600::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
March 19, 2024 at 10:55 pm #13601::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
March 20, 2024 at 8:26 am #13602::Yup, that’s correct.
If you want the player to get millk just from talking to the cow, you can override the TriggerDialogue function
-
AuthorPosts
- You must be logged in to reply to this topic.
Advertisement below: