Forum begins after the advertisement:

[Part 16] How to make NPCs offer us a gift

Home Forums Video Game Tutorial Series Creating a Farming RPG in Unity [Part 16] How to make NPCs offer us a gift

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #13472

    One of our Patrons, Mika Machaine, asks:

    hello in episode 14 we see the shop method how to set up the items on sale by season in the shop (seeds according to season) thank you for the tutorials and for your answer have a good day mickael

    hello in part 16 we see how to give gifts to the NPC how can you do the opposite how can you set up one day prescie the NPC offers us a gift thank you again for all the work have a good day mickael

    Jonathan Teo

    To have characters give gifts, simply add a condition to InteractableCharacter to trigger that line of dialogue, and add a function to alter the player’s inventory onDialogueEnd. I will go through this in-depth when the series gets to NPC events.

    mika machaine
    Bronze Supporter (Patron)

    hello can you elaborate please I’m not too comfortable with the code thank you for your feedback

    Jonathan Teo

    So in the TriggerDialogue function, add something along the lines of

    if(condition that makes NPC want to give the player a gift){
    dialogueToHave = insertDialogueHere;
    onDialogueEnd += GiftPlayer;

    Then on the GiftPlayer function you just need to add the item to the player’s inventory.

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

Go to Login Page →

Advertisement below: