代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。
原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html
一六六.魔之双臂(狼牙棒左键抓来敌人并致死、右键抓地移动主角)
用MT管理器打开游戏目录/assets/scripts/prefabs/tentaclespike.lua文件,将下列内容:
inst:AddComponent("weapon")
inst.components.weapon:SetDamage(TUNING.SPIKE_DAMAGE)
-------
inst:AddComponent("finiteuses")
inst.components.finiteuses:SetMaxUses(TUNING.SPIKE_USES)
inst.components.finiteuses:SetUses(TUNING.SPIKE_USES)
inst.components.finiteuses:SetOnFinished( onfinished )
替换为:
local function onattack(inst, owner, target)
local pt = owner:GetPosition()
if target.components.health then
target.Transform:SetPosition(pt.x+1, pt.y, pt.z)
end
inst:DoTaskInTime(0.1, function()
target.components.health:DoDelta(-3000)
end)
end
inst:AddComponent("weapon")
inst.components.weapon:SetDamage(0)
inst.components.weapon:SetRange(20, 25)
inst.components.weapon:SetOnAttack(onattack)
inst.components.weapon:SetProjectile("bishop_charge")
inst:AddComponent("blinkstaff")
即可在装备狼牙棒时,对敌人点左键将其抓过来并致死;对空地点右键,抓地移动主角,使狼牙棒既可杀伤敌人,又可有效闪避。用来抓鸟、兔、火鸡、大象等会逃跑的动物也很实用哦。狼牙棒靠打沼泽里的触手获得