代码来源于“易宁”大佬的分享,仅供学习,不要直接复制粘贴。
原帖链接:http://bbs.3dmgame.com/thread-3859071-1-1.html
1
2一五九.瑞士手杖(砍树、凿石、锤墙、挖草、祛暑、取暖、防雨、补脑、瞬移、10倍攻击力、2倍速度、照明)
3
4 用MT管理器打开游戏目录/assets/scripts/prefabs/cane.lua文件,
5
6 1.在local function onequip(inst, owner)的下一行插入以下内容:
7
8 inst.Light:Enable(true)
9 GetPlayer().components.temperature:SetTemp(20)
10 GetPlayer():PushEvent("stopfreezing")
11 GetPlayer():PushEvent("stopoverheating")
12 GetPlayer().components.moisture:SetMoistureLevel(0)
13
14
15 2.在local function onunequip(inst, owner)的下一行插入以下内容:
16
17 inst.Light:Enable(false)
18 GetPlayer().components.temperature:SetTemp(nil)
19
20
21 3.在anim:PlayAnimation("idle")的下一行插入以下内容:
22
23 inst:AddComponent("tool")
24 inst.components.tool:SetAction(ACTIONS.CHOP, 15)
25 inst.components.tool:SetAction(ACTIONS.MINE, 15)
26 inst.components.tool:SetAction(ACTIONS.HAMMER,15)
27 inst.components.tool:SetAction(ACTIONS.DIG)
28 inst:AddComponent("waterproofer")
29 inst.components.waterproofer:SetEffectiveness(TUNING.WATERPROOFNESS_ABSOLUTE)
30 inst:AddComponent("blinkstaff")
31 local light = inst.entity:AddLight()
32 light:SetFalloff(0.4)
33 light:SetIntensity(.7)
34 light:SetRadius(2.5)
35 light:SetColour(180/255, 195/255, 150/255)
36 light:Enable(true)
37
38
39 4.将inst.components.weapon:SetDamage(TUNING.CANE_DAMAGE)替换为inst.components.weapon:SetDamage(TUNING.CANE_DAMAGE*10)
40
41
42 5.将inst.components.equippable.walkspeedmult = TUNING.CANE_SPEED_MULT替换为以下内容:
43
44 inst.components.equippable.walkspeedmult = TUNING.CANE_SPEED_MULT*2
45 inst.components.equippable.dapperness = TUNING.DAPPERNESS_HUGE
46
47 即可让手杖拥有瑞士军刀般的多功能。装备手杖时,在空地上点鼠标右键可瞬移,借此可跳过较窄沟壑,少走冤枉路