目前我正在为我的期中考试做一些事情,但我被困在一个特定的part.The AI角色必须遵循一条使用路点的路径,然后在一个圆圈的顶部停下来射击(摧毁)一堵墙以到达最终的路点。AI角色必须在炮塔位于射击附近并摧毁它之前做到这一点。AI角色有3点生命值,如果射击三次就会死亡。炮塔在每一次射击后都有一个冷却时间,所以它给了AI角色击落墙壁的时间。
我被卡住的部分是当AI角色到达击落墙壁的路点时(我还没有实现),炮塔射击一次,不再射击。然而,光线投射是有效的,因为只要AI在范围内,它就会观察AI。
下面是我的转塔脚本:
using UnityEngine;
using System.Collection
我的机器人中有两个使用冷却的命令:"suggest“和"repentir”。我已经执行了另一个命令来重置用户的冷却时间,下面是该命令的代码: @client.command()
@commands.check(is_owner)
async def reset(ctx, user:discord.Member):
repentir.reset_cooldown(ctx)
suggest.reset_cooldown(ctx)
await ctx.send("Le cooldown pour <@{}> a bien été réin
因此,我在我的机器人中添加了@commands.cooldown(1, 10, commands.BucketType.user),试图阻止人们向它发送垃圾邮件。我将错误消息设置为: async def on_command_error(ctx, error):
if isinstance(error, commands.CommandOnCooldown):
await ctx.send(f'This command is not ready to use, try again in %.2f seconds' % error.retry_after
我对discord.py和一般的python都很陌生,但我试着学习。我不知道如何将command.reset_cooldown添加到代码中。正如下面的代码所述,我希望!测试忽略冷却,但我希望!测试2有冷却。有人能帮我吗?
@commands.cooldown(1, 30, commands.BucketType.user)
async def test(ctx, command=None):
if command is None:
await ctx.send('I want this to ignore cooldown')
elif comm
我正试着制作一个机器人,当你输入一个命令时,它会给你一个角色,我已经试着让角色部分工作了很长一段时间了,但是我总是在错误之后出错--这是我的当前代码-
@bot.command(name= 'playfata')
async def playfata(ctx):
member = ctx.author
role = discord.utils.get(member.guild.roles, name="Currently Playing")
if role in member.roles:
await ctx.send(&
现在我正在为角色制作技能,我想添加冷却时间,但我不知道如何设置时间,但我想我有了一个关于它应该有哪些变量的想法:
private long currentTime; <-- this is the actual cooldown
private long cooldownTime; <--- this is the time it must pass before its ready
private boolean onCooldown; <---- game uses this to check if its on cooldown
private long elapsed
我一直在尝试将我的命令转换为on_message事件,因为在这种情况下,它节省了空间,而且看起来更干净。但是,我似乎不能再使用@cooldown(),因为我必须使用commands.Cog.listener()。 有没有其他方法可以让冷却时间起作用?下面列出了我的代码 # Cog on_message for waifus and husbandos
@commands.Cog.listener()
# Cooldown NOT WORKING
@cooldown(1, 1, BucketType.user)
async def on_message(self