代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。

原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html



一六七.致命的毒箭(中吹箭的敌人不知不觉流血至死)

	用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/blowdart.lua文件,在inst.components.weapon:SetDamage(TUNING.PIPE_DART_DAMAGE)的下一行插入以下内容:

local function pipeonhit(inst, attacker, target)
	target.components.health:StartRegen(-100, 1)
	target.components.combat.target = nil
	target.AnimState:SetMultColour(255/255,0/255,0/255,1)
	attacker.components.inventory:Equip(inst)
end
	inst.components.weapon:SetRange(20, 25)
	inst.components.projectile:SetOnHitFn(pipeonhit)

	即可让中吹箭的敌人变成红色,每秒减100点血直至死亡,被射中的敌人不会反击主角。吹箭为无限使用,吹出后自动回到手中