当出现特定对话框时,如何在 ROBLOX 中创建事件?

发布于 2024-10-05 14:23:58 字数 146 浏览 0 评论 0原文

假设我想让一块砖块在选择某个对话框选项时消失。

我创建了一个 NPC,然后添加了一个对话树。现在的设置是,当玩家与 NPC 交谈时,他们可以选择说“你能让那块砖块消失吗?”。 NPC 回答:“给你!”

我需要做什么才能让 NPC 回复时砖块消失?

Say I want to make a brick dissapear when a certain dialog choice is selected.

I make an NPC, then I add a dialog tree. It is now set so when a player talks to the NPC, they have the choice to say "Can you make that brick dissapear?". The NPC replies "There you go!"

What would I need to do to make it so when the NPC replies, the brick dissapears?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

眉目亦如画i 2024-10-12 14:23:58

在罗布洛克斯上?

Dialog 对象中有一个事件。

DialogChoiceSelected(Instanceplayer, InstancedialogChoice)

只要您定义了变量“Dialog”和“Brick”,您就可以使用它来使砖块“消失”。

Dialog.DialogChoiceSelected:connect(function(Player, Choice)
    if Choice.Name == "BrickChanger" then
        Brick.Transparency = 1
    end
end)

参数“Player”是选择该选项的玩家,“Choice”参数指的是所选的 DialogChoice 用户数据。

On roblox?

There's an event in the Dialog object.

DialogChoiceSelected(Instance player, Instance dialogChoice)

This is how you can use it for making a brick "disappear" as long as you have defined the variables "Dialog" and "Brick"

Dialog.DialogChoiceSelected:connect(function(Player, Choice)
    if Choice.Name == "BrickChanger" then
        Brick.Transparency = 1
    end
end)

The argument "Player" is the player who selected that choice, the "Choice" argument refers to the DialogChoice userdata that was chosen.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文