第173页:千斤锤
展开一七三.千斤锤(用火腿短棍攻击时,天降巨石将敌人拍扁)
用记事本打开游戏目录\data\scripts\prefabs\hambat.lua文件,将inst:AddComponent("weapon")替换为以下内容:
local function onattack(inst, owner, target)
local pt = target:GetPosition()
local boulder = SpawnPrefab("thulecite")
RemovePhysicsColliders(boulder)
boulder.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
boulder.Transform:SetScale(3,3,3)
boulder:RemoveComponent("inventoryitem")
boulder.Transform:SetPosition(pt.x, 10, pt.z)
boulder.falling = boulder:DoPeriodicTask(.01, function() boulder.Physics:SetMotorVelOverride(0,-55,0) end)
boulder:DoTaskInTime(0.1, function()
if boulder.falling then boulder.falling:Cancel() boulder.falling = nil end
GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo")
GetPlayer().components.playercontroller:ShakeCamera(boulder, "FULL", 0.5, 0.05, 2, 40)
SpawnPrefab("collapse_big").Transform:SetPosition(boulder.Transform:GetWorldPosition())
target:AddTag("NOCLICK")
MakeInventoryPhysics(target)
target.AnimState:SetOrientation( ANIM_ORIENTATION.OnGround )
target.AnimState:SetLayer( LAYER_BACKGROUND )
target.AnimState:SetSortOrder( 1 )
target.AnimState:SetPercent("hit", math.random())
if target.brain then target:SetBrain(nil) end
if target.components.locomotor then target.components.locomotor:Stop() end
if target.components.combat then target.components.combat:SetTarget(nil) end
if target.components.health then target.components.health:SetInvincible(false) end
target:DoTaskInTime(5, function() target.components.health:Kill() end )
local pos = Vector3(boulder.Transform:GetWorldPosition())
local ents = TheSim:FindEntities(pos.x,0,pos.z, 5)
for k,v in pairs(ents) do
if v.components.workable and v.components.workable.workleft > 0 and not v.components.inventoryitem then
v.components.workable:Destroy(boulder)
end
end
boulder:DoTaskInTime(0.5, function()
GetPlayer().SoundEmitter:PlaySound("dontstarve/common/stone_drop")
SpawnPrefab("ground_chunks_breaking").Transform:SetPosition(boulder.Transform:GetWorldPosition())
boulder:Remove()
end )
end )
end
inst:AddComponent("weapon")
inst.components.weapon:SetRange(20, 25)
inst.components.weapon:SetOnAttack(onattack)
即可在用火腿短棍攻击时,天降巨石将敌人拍扁,并震毁附近的建筑、石头、植物,敌人将在5秒后死亡。火腿短棍在战斗选项(画着两把剑)下,用1个猪皮、2个树枝、2个大肉制造
更多相关内容请关注:饥荒专区
责任编辑:Shy夏夏