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

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



五.菩萨低眉(主角受怪物攻击毫发无伤,怪物反暴毙)

	用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/player_common.lua文件,将下列内容:

		inst:AddComponent("grue")
		inst.components.grue:SetSounds("dontstarve/charlie/warn","dontstarve/charlie/attack")

	替换为:

local function OnAttacked(inst, data)
	inst.components.health:DoDelta(inst.components.health.maxhealth)
	inst.components.sanity:DoDelta(inst.components.sanity.max)
	if data.attacker.components.health then
	   data.attacker.components.health:DoDelta(-3000)
	end
end
	inst:ListenForEvent("attacked", OnAttacked)

	即可让主角受攻击时不掉血、不伤脑,怪物反暴毙,并且主角在黑暗中不会被杀死。这是献给不杀生派玩家的礼物,慈悲也是一种力量。不要与“近卫军”一同修改