罗布洛克斯塔国防游戏
我正在Roblox制作塔防御游戏,我想知道如何在僵尸击中僵尸时具有特殊效果的脚本。例如,冻结,缓慢,毒药等以及如何使特定的僵尸免疫其中一些影响。
I'm making a Tower Defense Game in Roblox and I'm wondering how to script towers having special effects when they hit a zombie. For example, freeze, slowness, poison, etc. and how to make specific zombies immune to some of these effects.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您能做的就是将脚本放在僵尸中,该脚本可以解释塔的塔式塔,并决定它是否应造成伤害或效果或类似的东西。
What you could do is put a script in the zombie that can interpret what tower hit it and decide if it should deal damage or effects or something like that.
我只会在僵尸中有一些数字值,当您击中它时,它将值提高1点,并在值中有另一个脚本会激活效果,一旦激活效果,它就会从值中删除1。
您可以将其更改为适合不同的效果,因此,对于出血效果,您可以命名值出血的值,而在您击中敌人时,在损坏脚本中,它会发现流血的Firstchild,并在值中添加1,并在值中具有另一个脚本。流血伤害,就像
局部bleedvalue = script.parent.parent.value
local eneytype = script.parent.parent.parent:waitforchild(“ humanoioid”)
在等待(tick速度)时
,如果script.parent.value< 0然后
bleedvalue-(您要删除每个tick的ammount)
ableedvalue
=
结束
这只是我头顶的顶部,如果这错了,但我希望我能帮助任何可能寻求另类的人
i would just have some numvalues inside the zombie and when u hit it change the value up 1 point and have another script in the value which will activate the effect and once the effect has been activated it removes 1 from the value.
u can change this around to fit the different effects so for a bleed effect you can name the value bleed and in the damage script when you hit a enemy it will findfirstchild for bleed and add 1 to the value and have another script within the value doing the bleed damage which would be something like
local bleedvalue = script.parent.value
local enemytype = script.parent.parent:waitforchild("humanoid")
while wait(tick speed) do
if script.parent.value < 0 then
bleedvalue = bleedvalue - (ammount you want removed per tick)
enemytype.health = enemytype.health - (damage ammount and health can be changed out for speed or can straight up just anchor the zombie for a freeze)
end
end
this was just off the top of my head so sorry if its wrong but i hope i helped anyone who may be seeking a alternative