diff --git a/common/src/main/resources/assets/cobblemon/lang/en_us.json b/common/src/main/resources/assets/cobblemon/lang/en_us.json index 41e7dd8b19..5220d0587e 100644 --- a/common/src/main/resources/assets/cobblemon/lang/en_us.json +++ b/common/src/main/resources/assets/cobblemon/lang/en_us.json @@ -3919,6 +3919,18 @@ "cobblemon.entity.variable.dialogue_selection.name": "Dialogue", "cobblemon.entity.variable.dialogue_selection.desc": "The resource identifier of the dialogue to open on interaction, such as cobblemon:your_dialogue", + "cobblemon.behaviour.chatter_npc.name": "Chatter NPC", + "cobblemon.behaviour.chatter_npc.desc": "Allows the NPC to talk with the player using the in-game chat when interacted with, optional animation support.", + + "cobblemon.entity.variable.chat_message.name": "Chat Message", + "cobblemon.entity.variable.chat_message.desc": "Content for the message the NPC says when interacted with. Supports traditional minecraft colour and formatting.", + + "cobblemon.entity.variable.animation_name.name": "Animation Name", + "cobblemon.entity.variable.animation_name.desc": "The name of the animation to play when the NPC is interacted with.", + + "cobblemon.entity.variable.play_animation.name": "Play Animation", + "cobblemon.entity.variable.play_animation.desc": "Whether to play an animation when the NPC is interacted with.", + "npc.sacchi.name": "Professor Sacchi", "cobblemon.move.pound": "Pound", diff --git a/common/src/main/resources/data/cobblemon/behaviours/npc/chatter_npc.json b/common/src/main/resources/data/cobblemon/behaviours/npc/chatter_npc.json new file mode 100644 index 0000000000..2189f8d1fc --- /dev/null +++ b/common/src/main/resources/data/cobblemon/behaviours/npc/chatter_npc.json @@ -0,0 +1,39 @@ +{ + "name": "cobblemon.behaviour.chatter_npc.name", + "description": "cobblemon.behaviour.chatter_npc.desc", + "entityType": "cobblemon:npc", + "undo": [ + "q.entity.unset_interaction();" + ], + "configurations": [ + { + "type": "script", + "variables": [ + { + "variableName": "chat_message", + "displayName": "cobblemon.entity.variable.chat_message.name", + "description": "cobblemon.entity.variable.chat_message.desc", + "type": "TEXT", + "defaultValue": "Hello!" + }, + { + "variableName": "animation_name", + "displayName": "cobblemon.entity.variable.animation_name.name", + "description": "cobblemon.entity.variable.animation_name.desc", + "type": "TEXT", + "defaultValue": "wave" + }, + { + "variableName": "play_animation", + "displayName": "cobblemon.entity.variable.play_animation.name", + "description": "cobblemon.entity.variable.play_animation.desc", + "type": "BOOLEAN", + "defaultValue": "false" + } + ], + "script": [ + "q.entity.set_script_interaction('cobblemon:chatter-npc-interaction')" + ] + } + ] +} diff --git a/common/src/main/resources/data/cobblemon/molang/npc/chatter-npc-interaction.molang b/common/src/main/resources/data/cobblemon/molang/npc/chatter-npc-interaction.molang new file mode 100644 index 0000000000..2bc075cf14 --- /dev/null +++ b/common/src/main/resources/data/cobblemon/molang/npc/chatter-npc-interaction.molang @@ -0,0 +1,2 @@ +q.player.tell(q.npc.name + ': ' + q.npc.config.chat_message); +q.npc.config.play_animation ? q.npc.play_animation(q.npc.config.animation_name, q.player.uuid); \ No newline at end of file