I am trying to write a mod for a simple "farming" type game. Here are the basic features:
- Create an NPC
- When player clicks on NPC, NPC gives an object and a quest, e.g., player gets some wheat seeds and a hoe, a message in the chat window saying: "Hi, here are some seeds. Bring me back some wheat and I will give you some gold."
- You come back to the same NPC later with some wheat. NPC takes the wheat and gives back some other item.
So the basic functionalities are:
- recognize when a player clicks on a specific NPC
- gives items to player
- gets items from player
- checks that player has a certain item
So far I have been able to:
- Create an NPC (villager) using drones
- Create text messages in the chat window
- Give an item to the player
- Detect using an event when a player clicks
I can't figure out how to detect that a player is interacting with a given NPC. There is a player_interact and player_interact_entity event. But how can you tell that the player clicked on a specific NPC?
How can you determine that a player has a certain object?
Is there an example of a similar mod out there? Basically one where a player interacts with an NPC with a dialogue, and objects being exchanged? Or some similar mechanism?
Thanks for the help.