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

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



一七八.巨人帽(带猪皮帽变巨人,攻击、防御上升,可撞毁建筑、树、石头)

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

	local function football()
		local inst = simple()
		inst:AddComponent("armor")

		inst:AddComponent("waterproofer")
		inst.components.waterproofer:SetEffectiveness(TUNING.WATERPROOFNESS_SMALL)
		
		inst.components.armor:InitCondition(TUNING.ARMOR_FOOTBALLHAT, TUNING.ARMOR_FOOTBALLHAT_ABSORPTION)
		return inst
	end

	替换为:

local function football_equip(inst, owner)
	onequip(inst, owner)
	if owner == GetPlayer() then
	   owner.Transform:SetScale(3, 3, 3)
	   owner.components.combat:SetDefaultDamage(500)
	   owner.Physics:SetCollisionCallback(function(owner, other)
		   if other and other.components.workable and other.components.workable.workleft > 0 then
			  other.components.workable:Destroy(owner)
		   end
	   end)
	end
end
local function football_unequip(inst, owner)
	onunequip(inst, owner)
	if owner == GetPlayer() then
	   owner.Transform:SetScale(1, 1, 1)
	   owner.components.combat:SetDefaultDamage(TUNING.UNARMED_DAMAGE)
	   owner.Physics:SetCollisionCallback( nil )
	end
end
local function football()
	local inst = simple()
	inst:AddComponent("armor")
	inst.components.armor:InitCondition(TUNING.ARMOR_FOOTBALLHAT, 0.95)
	inst:AddComponent("waterproofer")
	inst.components.waterproofer:SetEffectiveness(TUNING.WATERPROOFNESS_SMALL)
	inst.components.equippable:SetOnEquip( football_equip )
	inst.components.equippable:SetOnUnequip( football_unequip )
	return inst
end

	即可戴猪皮帽变巨人,空手攻击力达到500点(空手按Ctrl + 鼠标左键攻击,或按住F反击),防御敌人95%的伤害(只掉5%的血),可撞毁建筑、树、石头。猪皮帽在战斗选项(画着两把剑)下,用1个绳子、1个猪皮制造,制造时须靠近炼金术引擎