第162页:萌时代
展开一六二.萌时代(扔蜂蜜将怪物变回童年)
用记事本打开游戏目录\data\scripts\prefabs\honey.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容:
local function onhit(inst, attacker, target)
inst:Remove()
SpawnPrefab("collapse_small").Transform:SetPosition(target.Transform:GetWorldPosition())
target.Transform:SetScale(0.7, 0.7, 0.7)
if target.components.health then
target.components.health.currenthealth = 1
target.components.health.maxhealth = 1
end
if target.components.combat then
target.components.combat:SetDefaultDamage(0)
target.components.combat.target = nil
end
if target.components.locomotor then
target.components.locomotor.runspeed = 1
target.components.locomotor.walkspeed = 1
end
end
local function onthrown(inst, data)
inst.AnimState:SetOrientation( ANIM_ORIENTATION.OnGround )
end
inst:AddComponent("weapon")
inst.components.weapon:SetDamage(0)
inst.components.weapon:SetRange(20, 25)
inst:AddComponent("equippable")
inst.components.equippable.equipstack = true
inst:AddComponent("projectile")
inst.components.projectile:SetSpeed(60)
inst.components.projectile:SetOnHitFn(onhit)
inst:ListenForEvent("onthrown", onthrown)
即可扔蜂蜜将怪物变成无害的童年怪物,怪物体型变小、生命值为1、没有攻击力、行走缓慢。因为蜂蜜可装备,如果主角也想吃蜂蜜,请拿起蜂蜜对主角按鼠标右键
更多相关内容请关注:饥荒专区
责任编辑:Shy夏夏