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

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


 1
 2二二二.我是巨鹿(按键盘HOME键主角变身巨鹿,按END键还原
 3
 4	MT管理器打开游戏目录/assets/DLC0002/scripts/prefabs/player_common.lua文件,在inst:AddComponent("playercontroller")的下一行插入以下内容:
 5
 6TheInput:AddKeyUpHandler(KEY_HOME, function()
 7  if inst.components.inventory:Has("goldnugget", 30) then
 8	inst.components.inventory:ConsumeByName("goldnugget", 30)
 9	inst.components.locomotor:Stop()
10	inst.components.playercontroller:Enable(false)
11	inst.AnimState:PlayAnimation("idle_shiver_pre")
12	inst.AnimState:PushAnimation("idle_shiver_loop")
13	inst.AnimState:PushAnimation("idle_shiver_pst", false)
14	inst:DoTaskInTime(1, function() 
15		inst.AnimState:SetBank("deerclops")
16		inst.AnimState:SetBuild("deerclops_build")
17		inst:SetStateGraph("SGdeerclops")
18		inst.AnimState:PlayAnimation("idle_loop", true)
19		inst.Transform:SetScale(1.5,1.5,1.5)
20		shadow:SetSize( 6, 3.5 )
21		local pos = GetPlayer():GetPosition()
22		GetSeasonManager():DoLightningStrike(pos)
23		inst.components.health:SetInvincible(true)
24		inst.components.hunger:Pause()
25		inst.components.combat:SetDefaultDamage(500)
26		inst.components.combat.hiteffectsymbol = "deerclops_body"
27		inst.components.combat.onhitotherfn = function()
28			 inst.SoundEmitter:PlaySound("dontstarve/creatures/deerclops/attack")
29			 inst.components.playercontroller:ShakeCamera(inst, "FULL", 0.5, 0.05, 2, 40)
30		end
31		inst.components.combat.playerdamagepercent = 0
32		inst.components.combat:SetAreaDamage(10, 1)
33		inst.components.temperature:SetTemp(20)
34		inst.components.playercontroller:Enable(true)
35	end )
36  end
37end )
38TheInput:AddKeyUpHandler(KEY_END, function()
39	inst.components.locomotor:Stop()
40	inst.components.playercontroller:Enable(false)
41	inst.AnimState:PlayAnimation("taunt")
42	inst:DoTaskInTime(1, function() 
43		inst.AnimState:SetBank("wilson")
44		inst.AnimState:SetBuild(name)
45		inst:SetStateGraph("SGwilson")
46		inst.AnimState:PlayAnimation("idle")
47		inst.Transform:SetScale(1,1,1)
48		shadow:SetSize( 1.3, .6 )
49		local pos = GetPlayer():GetPosition()
50		GetSeasonManager():DoLightningStrike(pos)
51		inst.components.health:SetInvincible(false)
52		inst.components.hunger:Resume()
53		inst.components.combat:SetDefaultDamage(TUNING.UNARMED_DAMAGE)
54		inst.components.combat.hiteffectsymbol = "torso"
55		inst.components.combat.onhitotherfn = nil
56		inst.components.combat:SetAreaDamage(0, 0)
57		inst.components.temperature:SetTemp(nil)
58		inst.components.playercontroller:Enable(true)
59	end )
60end )
61
62	即可在你深陷绝境之时,对电脑屏幕大喊“我是巨鹿”,并同时按下键盘HOME键,主角将变身无敌巨鹿(锁血、锁饥饿、不怕冷),对敌人展开恐怖的报复吧(按Ctrl + 鼠标左键攻击)。每次变身将消耗30个黄金,身上黄金数不足时不会变身。想要变回主角时,按键盘END键即可。注意,由于巨鹿变身时会招来闪电,并且本身具备大面积杀伤的能力,所以请远离基地变身,且尽量不要带同伴。修改过“神奇跳跃”的话,不要在变身巨鹿时跳跃