第176页:霸王盔
展开一七六.霸王盔(用猪皮种霸王盔,吸收99%伤害,挨打时弹开并反伤敌人,可照明、防雨、防冻、防暑、补脑、奔跑加速)
用记事本打开游戏目录\data\scripts\prefabs\pigskin.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容:
local function OnDeploy (inst, pt)
local helmet = SpawnPrefab("pigskin")
helmet.Transform:SetPosition(pt.x, pt.y, pt.z)
helmet.AnimState:SetBank("wathgrithrhat")
helmet.AnimState:SetBuild("hat_wathgrithr")
helmet.AnimState:PlayAnimation("anim")
helmet.components.inventoryitem:ChangeImageName("wathgrithrhat")
helmet:RemoveComponent("stackable")
helmet:RemoveComponent("tradable")
helmet:RemoveComponent("edible")
helmet:RemoveComponent("burnable")
helmet:RemoveComponent("propagator")
helmet:RemoveComponent("deployable")
helmet:AddComponent("equippable")
helmet.components.equippable.equipslot = EQUIPSLOTS.HEAD
helmet.components.equippable.walkspeedmult = 2.5
helmet.components.equippable.dapperness = TUNING.DAPPERNESS_HUGE*32
helmet.components.equippable:SetOnEquip(function(helmet, owner)
owner.AnimState:OverrideSymbol("swap_hat", "hat_wathgrithr", "swap_hat")
owner.AnimState:Show("HAT")
owner.AnimState:Show("HAT_HAIR")
owner.AnimState:Hide("HAIR_NOHAT")
owner.AnimState:Hide("HAIR")
if owner == GetPlayer() then
owner.AnimState:Hide("HEAD")
owner.AnimState:Show("HEAD_HAIR")
owner.components.temperature:SetTemp(20)
owner:PushEvent("stopfreezing")
owner:PushEvent("stopoverheating")
owner.components.moisture:SetMoistureLevel(0)
helmet.fire = SpawnPrefab( "campfirefire" )
local follower = helmet.fire.entity:AddFollower()
follower:FollowSymbol( owner.GUID, "swap_hat", -6, -196, 0 )
helmet.fire.AnimState:SetMultColour(255/255,0/255,0/255,1)
helmet.fire.Transform:SetScale(1.3, 1.3, 1.3)
helmet.fire:RemoveComponent("heater")
helmet.fire.persists = false
helmet.helmetfn = function(attacked, data)
if data and data.attacker and data.attacker.components.health then
SpawnPrefab("groundpoundring_fx").Transform:SetPosition(owner.Transform:GetWorldPosition())
data.attacker.components.health:DoDelta(-300)
local pt01 = owner:GetPosition()
local pt02 = data.attacker:GetPosition()
data.attacker.Transform:SetPosition((pt02.x-pt01.x)*1.5+pt02.x, 0, (pt02.z-pt01.z)*1.5+pt02.z)
if data.attacker.components.locomotor then data.attacker.components.locomotor:Stop() end
if data.attacker.components.health:GetPercent() < 0.3 then
data.attacker.AnimState:SetMultColour(255/255,0/255,0/255,1)
end
end
end
helmet:ListenForEvent("attacked", helmet.helmetfn, owner)
owner:AddTag("goodsavages")
end
end )
helmet.components.equippable:SetOnUnequip(function(helmet, owner)
owner.AnimState:Hide("HAT")
owner.AnimState:Hide("HAT_HAIR")
owner.AnimState:Show("HAIR_NOHAT")
owner.AnimState:Show("HAIR")
if owner == GetPlayer() then
owner.AnimState:Show("HEAD")
owner.AnimState:Hide("HEAD_HAIR")
owner.components.temperature:SetTemp(nil)
helmet.fire:Remove()
helmet.fire = nil
helmet:RemoveEventCallback("attacked", helmet.helmetfn, owner)
owner:RemoveTag("goodsavages")
end
end )
helmet:AddComponent("armor")
helmet.components.armor:InitCondition(20000, 0.99)
helmet:AddComponent("waterproofer")
helmet.components.waterproofer:SetEffectiveness(1)
helmet:AddTag("helmets")
inst.components.stackable:Get():Remove()
end
inst:AddComponent("deployable")
inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
if inst:HasTag("helmets") then
data.helmets = true
end
end
local function onload(inst, data)
if data and data.helmets then
inst.AnimState:SetBank("wathgrithrhat")
inst.AnimState:SetBuild("hat_wathgrithr")
inst.AnimState:PlayAnimation("anim")
inst.components.inventoryitem:ChangeImageName("wathgrithrhat")
inst:RemoveComponent("stackable")
inst:RemoveComponent("tradable")
inst:RemoveComponent("edible")
inst:RemoveComponent("burnable")
inst:RemoveComponent("propagator")
inst:RemoveComponent("deployable")
inst:AddComponent("equippable")
inst.components.equippable.equipslot = EQUIPSLOTS.HEAD
inst.components.equippable.walkspeedmult = 2.5
inst.components.equippable.dapperness = TUNING.DAPPERNESS_HUGE*32
inst.components.equippable:SetOnEquip(function(inst, owner)
owner.AnimState:OverrideSymbol("swap_hat", "hat_wathgrithr", "swap_hat")
owner.AnimState:Show("HAT")
owner.AnimState:Show("HAT_HAIR")
owner.AnimState:Hide("HAIR_NOHAT")
owner.AnimState:Hide("HAIR")
if owner == GetPlayer() then
owner.AnimState:Hide("HEAD")
owner.AnimState:Show("HEAD_HAIR")
owner.components.temperature:SetTemp(20)
owner:PushEvent("stopfreezing")
owner:PushEvent("stopoverheating")
owner.components.moisture:SetMoistureLevel(0)
inst.fire = SpawnPrefab( "campfirefire" )
local follower = inst.fire.entity:AddFollower()
follower:FollowSymbol( owner.GUID, "swap_hat", -6, -196, 0 )
inst.fire.AnimState:SetMultColour(255/255,0/255,0/255,1)
inst.fire.Transform:SetScale(1.3, 1.3, 1.3)
inst.fire:RemoveComponent("heater")
inst.fire.persists = false
inst.helmetfn = function(attacked, data)
if data and data.attacker and data.attacker.components.health then
SpawnPrefab("groundpoundring_fx").Transform:SetPosition(owner.Transform:GetWorldPosition())
data.attacker.components.health:DoDelta(-300)
local pt01 = owner:GetPosition()
local pt02 = data.attacker:GetPosition()
data.attacker.Transform:SetPosition((pt02.x-pt01.x)*1.5+pt02.x, 0, (pt02.z-pt01.z)*1.5+pt02.z)
if data.attacker.components.locomotor then data.attacker.components.locomotor:Stop() end
if data.attacker.components.health:GetPercent() < 0.3 then
data.attacker.AnimState:SetMultColour(255/255,0/255,0/255,1)
end
end
end
inst:ListenForEvent("attacked", inst.helmetfn, owner)
owner:AddTag("goodsavages")
end
end )
inst.components.equippable:SetOnUnequip(function(inst, owner)
owner.AnimState:Hide("HAT")
owner.AnimState:Hide("HAT_HAIR")
owner.AnimState:Show("HAIR_NOHAT")
owner.AnimState:Show("HAIR")
if owner == GetPlayer() then
owner.AnimState:Show("HEAD")
owner.AnimState:Hide("HEAD_HAIR")
owner.components.temperature:SetTemp(nil)
inst.fire:Remove()
inst.fire = nil
inst:RemoveEventCallback("attacked", inst.helmetfn, owner)
owner:RemoveTag("goodsavages")
end
end )
inst:AddComponent("armor")
inst.components.armor:InitCondition(20000, 0.99)
inst:AddComponent("waterproofer")
inst.components.waterproofer:SetEffectiveness(1)
inst:AddTag("helmets")
end
end
inst.OnSave = onsave
inst.OnLoad = onload
即可用猪皮种霸王盔,吸收99%伤害,敌人攻击你时会被弹开,并遭到反伤,让你流的每一滴血,都收到百倍利息。霸王盔可照明、防雨、防冻、防暑、补脑,并使奔跑加速,与“霸王枪”并称饥荒世界两大神器,助你在乱世中百战百胜。佩戴霸王盔时,“铁血蛮族”不敢主动攻击你。不要与“用猪皮种猪火炬”一同修改
更多相关内容请关注:饥荒专区
责任编辑:Shy夏夏