第207页:斗牛场
展开二零七.斗牛场(用牛角种斗牛场,与公牛搏斗赢奖金,观众会向场内扔额外赏金)
用记事本打开游戏目录\data\scripts\prefabs\horn.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容:
local sounds =
{
walk = "dontstarve/beefalo/walk",
grunt = "dontstarve/beefalo/grunt",
yell = "dontstarve/beefalo/yell",
swish = "dontstarve/beefalo/tail_swish",
curious = "dontstarve/beefalo/curious",
angry = "dontstarve/beefalo/angry",
}
local function makebullring(inst)
local pt = inst:GetPosition()
local bullring0 = SpawnPrefab("horn")
bullring0.Transform:SetPosition(pt.x, pt.y, pt.z)
bullring0.AnimState:SetBank("marble_trees")
bullring0.AnimState:SetBuild("marble_trees")
bullring0.AnimState:PlayAnimation("full_4")
bullring0.Transform:SetScale(1.5, 1.5, 1.5)
bullring0:RemoveComponent("instrument")
bullring0:RemoveComponent("tool")
bullring0:RemoveComponent("finiteuses")
bullring0:RemoveComponent("inventoryitem")
bullring0:RemoveComponent("deployable")
bullring0:RemoveTag("horn")
bullring0:AddComponent("named")
bullring0.components.named:SetName("Bullring")
local light = bullring0.entity:AddLight()
light:SetFalloff(1)
light:SetIntensity(.8)
light:SetRadius(15)
light:SetColour(180/255, 195/255, 50/255)
light:Enable(true)
bullring0:AddComponent("workable")
bullring0.components.workable:SetWorkAction(ACTIONS.HAMMER)
bullring0.components.workable:SetWorkLeft(3)
bullring0.components.workable:SetOnFinishCallback(function()
SpawnPrefab("collapse_big").Transform:SetPosition(bullring0.Transform:GetWorldPosition())
GetPlayer().SoundEmitter:PlaySound("dontstarve/common/destroy_wood")
local pos = Vector3(bullring0.Transform:GetWorldPosition())
local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, 10)
for k,v in pairs(ents) do
if v:HasTag("nobullring") then
v:Remove()
end
end
bullring0:Remove()
end )
bullring0.components.inspectable.getstatus = function(bullring0)
GetPlayer().SoundEmitter:PlaySound("dontstarve/common/horn_beefalo")
local bullfighting = SpawnPrefab("horn")
bullfighting.Transform:SetPosition(pt.x+2, 0, pt.z+2)
bullfighting.AnimState:SetBank("beefalo")
bullfighting.AnimState:SetBuild("beefalo_build")
bullfighting.AnimState:PlayAnimation("idle_loop", true)
bullfighting.Transform:SetFourFaced()
bullfighting.Transform:SetScale(1.3, 1.3, 1.3)
local sound = bullfighting.entity:AddSoundEmitter()
bullfighting.sounds = sounds
local shadow = bullfighting.entity:AddDynamicShadow()
shadow:SetSize( 3, 1.25 )
MakeCharacterPhysics(bullfighting, 200, 1.3)
bullfighting:RemoveComponent("instrument")
bullfighting:RemoveComponent("tool")
bullfighting:RemoveComponent("finiteuses")
bullfighting:RemoveComponent("inventoryitem")
bullfighting:RemoveComponent("deployable")
bullfighting:RemoveTag("horn")
bullfighting:AddComponent("named")
bullfighting.components.named:SetName("Bullfighting")
bullfighting:AddComponent("locomotor")
bullfighting.components.locomotor.walkspeed = math.random(4,6)
bullfighting.components.locomotor.runspeed = math.random(8,10)
bullfighting:SetStateGraph("SGBeefalo")
local brain = require "brains/leifbrain"
bullfighting:SetBrain(brain)
bullfighting:AddComponent("follower")
bullfighting:AddComponent("knownlocations")
bullfighting:AddComponent("lootdropper")
bullfighting.components.lootdropper:SetLoot({"meat","meat","meat","meat","meat","meat","beefalowool","beefalowool","beefalowool","beefalowool"})
bullfighting.components.lootdropper:AddChanceLoot("horn", 0.1)
bullfighting:AddComponent("health")
bullfighting.components.health:SetMaxHealth(math.random(3000,7000))
bullfighting:AddComponent("combat")
bullfighting.components.combat:SetTarget(GetPlayer())
bullfighting.components.combat.hiteffectsymbol = "beefalo_body"
bullfighting.components.combat:SetDefaultDamage(math.random(30,70))
bullfighting.components.combat:SetAttackPeriod(math.random(1,3))
bullfighting.components.combat:SetRetargetFunction(1, function(bullfighting)
if not bullfighting.components.health:IsDead() then
return FindEntity(bullfighting, 200, function(guy)
if guy.components.health and not guy.components.health:IsDead() and not guy:HasTag("bullfighting") then
return guy:HasTag("player")
end
end )
end
end )
bullfighting.components.combat:SetKeepTargetFunction(function(bullfighting, target) return target and target:IsValid() end )
bullfighting:ListenForEvent("death", function()
for k = 1, 30 do
local goldnugget = SpawnPrefab("goldnugget")
GetPlayer().components.inventory:GiveItem(goldnugget)
end
GetPlayer():StartThread(function()
for k = 1, math.random(3,10) do
GetPlayer().SoundEmitter:PlaySound("dontstarve/wilson/equip_item_gold")
local bounty = SpawnPrefab("goldnugget")
bounty.Transform:SetPosition(pt.x, pt.y, pt.z)
bounty.components.inventoryitem.canbepickedup = false
bounty:AddComponent("complexprojectile")
bounty.components.complexprojectile.yOffset = 2.5
bounty.components.complexprojectile:Launch(Point(pt.x+(math.random(6,10)-math.random(5)), 0, pt.z+(math.random(6,10)-math.random(5))))
bounty.components.complexprojectile:SetOnHit(function()
bounty:RemoveComponent("complexprojectile")
bounty.components.inventoryitem.canbepickedup = true
end )
Sleep(0.15)
end
end )
end )
bullfighting:DoTaskInTime(60, function()
if not bullfighting.components.health:IsDead() then
SpawnPrefab("die_fx").Transform:SetPosition(bullfighting.Transform:GetWorldPosition())
GetPlayer().SoundEmitter:PlaySound("dontstarve/creatures/eyeballturret/shotexplo")
bullfighting:Remove()
end
end )
bullfighting:AddTag("bullfighting")
end
bullring0:AddTag("bullring0")
local bullring1 = SpawnPrefab("horn")
bullring1.Transform:SetPosition(pt.x+2.5, 0, pt.z-2.5)
bullring1.AnimState:SetBank("marble_trees")
bullring1.AnimState:SetBuild("marble_trees")
bullring1.AnimState:PlayAnimation("full_4")
bullring1.Transform:SetScale(0.8, 0.8, 0.8)
bullring1:RemoveComponent("instrument")
bullring1:RemoveComponent("tool")
bullring1:RemoveComponent("finiteuses")
bullring1:RemoveComponent("inventoryitem")
bullring1:RemoveComponent("deployable")
bullring1:RemoveTag("horn")
bullring1:AddTag("NOCLICK")
bullring1:AddTag("nobullring")
local bullring2 = SpawnPrefab("horn")
bullring2.Transform:SetPosition(pt.x-2.5, 0, pt.z+2.5)
bullring2.AnimState:SetBank("marble_trees")
bullring2.AnimState:SetBuild("marble_trees")
bullring2.AnimState:PlayAnimation("full_4")
bullring2.Transform:SetScale(0.8, 0.8, 0.8)
bullring2:RemoveComponent("instrument")
bullring2:RemoveComponent("tool")
bullring2:RemoveComponent("finiteuses")
bullring2:RemoveComponent("inventoryitem")
bullring2:RemoveComponent("deployable")
bullring2:RemoveTag("horn")
bullring2:AddTag("NOCLICK")
bullring2:AddTag("nobullring")
for k = 0,6 do
local audience = SpawnPrefab("horn")
audience.Transform:SetPosition(pt.x-2+6-k*2, 0, pt.z-2-6+k*2)
audience.AnimState:SetBank("wilson")
local names = {"wilson","wendy","wes","wickerbottom","willow","wolfgang","wx78"}
local buildname = names[math.random(#names)]
audience.AnimState:SetBuild(buildname)
local hats = {"hat_bee","hat_beefalo","hat_bush","hat_earmuffs","hat_feather","hat_flower","hat_football","hat_miner","hat_ruins","hat_slurper","hat_slurtle","hat_spider","hat_straw","hat_top","hat_walrus","hat_winter","hat_rain","hat_watermelon","hat_ice","hat_catcoon","hat_wathgrithr"}
local hat = hats[math.random(#hats)]
audience.AnimState:OverrideSymbol("swap_hat", hat, "swap_hat")
local armors = {"armor_grass","armor_marble","armor_onemanband","armor_ruins","armor_sanity","armor_slurper","armor_slurtleshell","armor_sweatervest","armor_trunkvest_summer","armor_trunkvest_winter","armor_wood","torso_rain"}
local armor = armors[math.random(#armors)]
audience.AnimState:OverrideSymbol("swap_body", armor, "swap_body")
audience.AnimState:Show("HAT")
audience.AnimState:Show("HAT_HAIR")
audience.AnimState:Hide("HAIR_NOHAT")
audience.AnimState:Hide("HAIR")
audience.AnimState:Hide("ARM_carry")
audience.AnimState:Show("ARM_normal")
local stories = {"idle","hungry","eat","dart","throw","atk","idle_onemanband1_loop","run_pst","item_hat","give"}
local story = stories[math.random(#stories)]
audience.AnimState:PlayAnimation(story,true)
audience.Transform:SetFourFaced()
audience:RemoveComponent("instrument")
audience:RemoveComponent("tool")
audience:RemoveComponent("finiteuses")
audience:RemoveComponent("inventoryitem")
audience:RemoveComponent("deployable")
audience:RemoveTag("horn")
audience:AddTag("NOCLICK")
audience:AddTag("nobullring")
end
end
local function OnDeploy (inst, pt)
makebullring(inst)
inst:Remove()
end
inst:AddComponent("deployable")
inst.components.deployable.ondeploy = OnDeploy
local function onsave(inst, data)
if inst:HasTag("bullring0") then
data.bullring0 = true
end
if inst:HasTag("bullfighting") then
data.bullfighting = true
end
if inst:HasTag("nobullring") then
data.nobullring = true
end
end
local function onload(inst, data)
if data and data.bullring0 then
makebullring(inst)
inst:Remove()
end
if data and data.bullfighting then
inst:Remove()
end
if data and data.nobullring then
inst:Remove()
end
end
inst.OnSave = onsave
inst.OnLoad = onload
即可用牛角种斗牛场,鼠标左键点中间的大理石树,会冲出公牛,1分钟内战胜它,可获得30个黄金的奖金(直接放入主角物品栏),和大肉、牛毛等战利品。如未能获胜,1分钟后公牛将消失。每次冲出的公牛,血量、攻击力、攻击节奏、速度都不同,这次打不赢,不代表下次不会胜利哦。场外会有观众为你喝彩,如果你获胜,他们会向场内扔黄金(数量不等),作为你额外的奖励。不想要斗牛场了,用锤子砸掉中间的大理石树即可
更多相关内容请关注:饥荒专区
责任编辑:Shy夏夏