代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。
原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html
1
2五.菩萨低眉(主角受怪物攻击毫发无伤,怪物反暴毙)
3
4 用MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/player_common.lua文件,将下列内容:
5
6 inst:AddComponent("grue")
7 inst.components.grue:SetSounds("dontstarve/charlie/warn","dontstarve/charlie/attack")
8
9 替换为:
10
11local function OnAttacked(inst, data)
12 inst.components.health:DoDelta(inst.components.health.maxhealth)
13 inst.components.sanity:DoDelta(inst.components.sanity.max)
14 if data.attacker.components.health then
15 data.attacker.components.health:DoDelta(-3000)
16 end
17end
18 inst:ListenForEvent("attacked", OnAttacked)
19
20 即可让主角受攻击时不掉血、不伤脑,怪物反暴毙,并且主角在黑暗中不会被杀死。这是献给不杀生派玩家的礼物,慈悲也是一种力量。不要与“近卫军”一同修改