
C# Interact / Talk Message UI for RPG Developer Bakin
A downloadable tool
This simple RPG Developer Bakin plugin will allow you to show/hide a talk/interact input prompt UI element when the player character approaches an event, without having to manually create logic to detect if the player is in range. It uses C# with very little to configure on a per event
このシンプルなRPG開発者向けBakinプラグインを使用すると、プレイヤーキャラクターがイベントに接近した際に会話/インタラクト入力プロンプトUI要素を表示/非表示にできます。プレイヤーが範囲内にあるかを手動で検出するロジックを作成する必要はありません。C#を使用しており、イベントごとの設定はほとんど不要です。
Addon Usage | アドオンの使用
EN
First, download the script and create a new Common Event called InteractTalkUI (the name doesn't matter), then attach the script to it.
Next, create 4 global variables:
- show_interact_message
- interact_message
- default_interact_message
- hide_interact_message
When your game runs, make sure to assign a string to default_interact_message (for example, "Talk", or "Investigate"): this will be used as the default message. You can use a common event that runs at game start for example.
Next, any event that you want to show the prompt needs at least one new local variable:
- can_interact - Set the value to 1 if you want this event to be considered for the interact prompt. Consider creating a parallel sheet that runs "When Generated" for map events, or consider running a first event sheet that enables a local flag to switch to the talk event sheet when initialized.
- my_interact_message (optional) -If you want this event to have a unique message when approached, set a string in this local variable.
How the variables work.
- When you approach an event that can show the prompt, if it had the value "can_interact" set to 1, the global variable show_interact_message will return 1.
- If it finds a string assigned to the event's my_interact_message string, it'll use that and override interact_message with the contents of that event's string. Otherwise, interact_message will copy the contents of default_interact_message.
- When nothing is in range, it'll set show_interact_message to 0.
What you need to do next.
Unfortunately, I can't do the entire process, as this part is the creative part of your game, and some games work differently, but here's the essential parts you need to assign to get whatever prompt you need to work:
- You need to create the layout for the interface prompt.
- It's best to make a Free Layout that always exists in game by adding it through an event.
- In that layout, you should create a container that has it's display conditions set to "show_interact_message == 1". That way, the contents of the container and everything inside will be hidden when out of range.
- Additionally, add a display condition of "hide_interact_message == false". That way, you can manually hide the message when speaking to an NPC or interacting with the object by turning this switch on, and then turn it back off to show the UI again.
- Add a text object inside the container and set the value of the text to the [x] variable property, and select interact_message as the value. It'll preview as 0 in the editor, but it does show in-game.
- Then, for events with a TALK event sheet, you should make sure that you set the hide_interact_message switch on, and at the very end, turn it back off, as the system will not auto hide the UI based on events without this switch.
Caution
- The script might not be optimized, or might cause lag, since it runs as an Update function. It should be fine, but feel free to edit the script and redistribute it if you've got upgrades to add to it, etc etc.
- If you like my scripts, make sure to follow me on X (https://x.com/MeringueRouge) and YouTube (https://www.youtube.com/@Meringue-Rouge) for more to come. I'm working on a soon to release game by the way!
JP
まず、スクリプトをダウンロードし、新しい共通イベント「InteractTalkUI」(名前は任意)を作成します。その後、そのイベントにスクリプトをアタッチします。
次に、4つのグローバル変数を作成します:
- show_interact_message
- interact_message
- default_interact_message
- hide_interact_message
ゲームが実行される際、default_interact_message に文字列を割り当ててください(例:「話す」、「調べる」)。これがデフォルトメッセージとして使用されます。例えば、ゲーム開始時に実行される共通イベントを利用できます。
次に、プロンプトを表示したいイベントには、少なくとも1つの新しいローカル変数が必要です:
- can_interact - このイベントをインタラクトプロンプトの対象とする場合は、値を1に設定してください。マップイベント用に「生成時」を実行する並列シートの作成を検討するか、初期化時にローカルフラグを有効にして会話イベントシートに切り替える最初のイベントシートの実行を検討してください。
- my_interact_message (オプション) - このイベントに接近時に表示する固有のメッセージを設定したい場合、このローカル変数に文字列を設定してください。
変数の動作について。
- プロンプトを表示できるイベントに接近した際、そのイベントの「can_interact」値が1に設定されている場合、グローバル変数「show_interact_message」は1を返します。
- イベントのmy_interact_message文字列に割り当てられた文字列が見つかった場合、その文字列を使用し、interact_messageをそのイベントの文字列の内容で上書きします。それ以外の場合、interact_messageはdefault_interact_messageの内容をコピーします。
- 何も範囲内にない場合、show_interact_messageを0に設定します。
次にすべきこと。
残念ながら、このプロセス全体は対応できません。この部分はゲームの創造的な部分であり、ゲームによって動作が異なるためです。ただし、必要なプロンプトを機能させるために割り当てるべき重要な部分は以下の通りです:
- インターフェースプロンプトのレイアウトを作成する必要があります。
- ゲーム内で常に存在するフリーレイアウトは、イベントを通じて追加するのが最善です。
- そのレイアウトでは、表示条件を「show_interact_message == 1」に設定したコンテナを作成する必要があります。これにより、範囲外ではコンテナの内容と内部のすべての要素が非表示になります。
- さらに、「hide_interact_message == false」という表示条件を追加します。これにより、NPCと会話したりオブジェクトとインタラクトする際に、このスイッチをオンにして手動でメッセージを非表示にでき、その後オフに戻すことでUIを再び表示できるようになります。
- コンテナ内にテキストオブジェクトを追加し、テキストの値を[x]変数プロパティに設定し、値としてinteract_messageを選択します。エディター上では0とプレビューされますが、ゲーム内では表示されます。
- 次に、TALKイベントシートを持つイベントでは、hide_interact_messageスイッチを必ずオンに設定し、最後に再びオフに戻す必要があります。このスイッチがない場合、システムはイベントに基づいてUIを自動で非表示にしないためです。
注意
- スクリプトは最適化されていない可能性があり、またUpdate関数として実行されるためラグを引き起こす可能性があります。問題ないはずですが、改良点などがある場合は自由にスクリプトを編集し再配布してください。
- 私の脚本が気に入ったら、ぜひX(https://x.com/MeringueRouge)とYouTube(https://www.youtube.com/@Meringue-Rouge)をフォローしてください。続編も公開予定です。ちなみに、近々リリース予定のゲームも制作中です!
| Published | 7 hours ago |
| Status | Released |
| Category | Tool |
| Author | Meringue Rouge |
| Genre | Role Playing |
| Tags | addon, bakin, Graphical User Interface (GUI), JRPG, rpgbakin, rpg-developer-bakin, script, User Interface (UI) |
Download
Click download now to get access to the following files:
Development log
- C# Interact Prompt for Bakin released!7 hours ago

Leave a comment
Log in with itch.io to leave a comment.