游戏达人
  
- 贡献度
- 80
- 金元
- 19062
- 积分
- 2236
- 精华
- 1
- 注册时间
- 2010-11-27
|
靚仔 发表于 2013-12-21 10:43 
把更新发一下:)多休息点。。。
一七三.收妖镜(装备铥矿奖章对敌人按右键,将其收入镜中)
用记事本打开游戏目录\data\scripts\prefabs\nightmare_timepiece.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容:
local function onequip(inst, owner)
owner.components.inventory:SetOverflow(inst)
inst.components.container:Open(owner)
end
local function onunequip(inst, owner)
owner.components.inventory:SetOverflow(nil)
inst.components.container:Close(owner)
end
local function itemtest(inst, item, slot)
if item:HasTag("catched") then
return true
end
return false
end
local slotpos = {}
for y = 0, 9 do
table.insert(slotpos, Vector3(-162, -y*75 + 170 ,0))
end
local function cancatchmonster(inst, caster, target)
if target then
return target.components.locomotor and not target.components.health:IsDead() and not target:HasTag("smallbird") and not target:HasTag("chester")
end
return true
end
local function catchmonster(staff, target, pos)
if not inst.components.container:IsFull() then
if target.components.stackable then target:RemoveComponent("stackable") end
if target.components.inventoryitem then target:RemoveComponent("inventoryitem") end
target:AddComponent("inventoryitem")
target.components.inventoryitem.nobounce = true
target.components.inventoryitem.canbepickedup = true
target.components.inventoryitem:ChangeImageName("beard_monster")
target.components.health.canmurder = true
target:AddTag("catched")
target.components.inventoryitem:SetOnDroppedFn(function(target)
target:RemoveComponent("inventoryitem")
target:RemoveTag("catched")
if target.brain then target.brain:Start() end
if target.sg then target.sg:Start() end
end )
target.components.inventoryitem:SetOnPutInInventoryFn(function(target)
if target.sg then target.sg:GoToState("idle") end
if target.SoundEmitter then target.SoundEmitter:KillAllSounds() end
end )
inst.components.container:GiveItem(target)
end
end
inst:AddComponent("spellcaster")
inst.components.spellcaster:SetSpellFn(catchmonster)
inst.components.spellcaster:SetSpellTestFn(cancatchmonster)
inst.components.spellcaster.canuseontargets = true
inst.components.spellcaster.canusefrominventory = false
inst:AddComponent("equippable")
inst.components.equippable.equipslot = EQUIPSLOTS.HANDS
inst.components.equippable:SetOnEquip( onequip )
inst.components.equippable:SetOnUnequip( onunequip )
inst:AddComponent("container")
inst.components.container:SetNumSlots(#slotpos)
inst.components.container.widgetslotpos = slotpos
inst.components.container.widgetpos = Vector3(18,50,0)
inst.components.container.side_widget = true
inst.components.container.itemtestfn = itemtest
inst.components.container.acceptsstacks = false
即可在装备铥矿奖章时,对敌人按鼠标右键,将敌人收入镜中(画面右边的格子中,显示为烧焦的兔子),如果想杀死它,就对格子中的敌人按鼠标右键,会获得战利品;如果想释放它,就拿出敌人放在地上。“收妖镜”的格子全满后,无法再收新的敌人,可以将敌人放在物品栏或其他背包后再收妖。在存档退出前,请处置(杀掉或释放)全部收来的敌人,否则读档后,敌人将全部被放出。铥矿奖章在远古选项(画着远古祭坛)下,用2个铥矿石、2个噩梦燃料制造,制造时需要靠近远古祭坛
二一三.小镇新移民(白天石头营火附近出现新移民,饥荒世界从此不寂寞,89685版及以后游戏使用)
1.用记事本打开游戏目录\data\scripts\prefabs\firepit.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容:
local function createnpc(inst)
for k = 1,math.random(10,25) do
local pt = inst:GetPosition()
local npc = SpawnPrefab("frog")
npc.Transform:SetPosition(pt.x+(math.random(50)-math.random(50)), 0, pt.z+(math.random(50)-math.random(50)))
npc.AnimState:SetBank("wilson")
local names = {"wilson","wendy","wes","wickerbottom","willow","wolfgang","wx78"}
local buildname = names[math.random(#names)]
npc.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"}
local hat = hats[math.random(#hats)]
npc.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"}
local armor = armors[math.random(#armors)]
npc.AnimState:OverrideSymbol("swap_body", armor, "swap_body")
npc.AnimState:Show("HAT")
npc.AnimState:Show("HAT_HAIR")
npc.AnimState:Hide("HAIR_NOHAT")
npc.AnimState:Hide("HAIR")
npc.AnimState:Hide("ARM_carry")
npc.AnimState:Show("ARM_normal")
npc.AnimState:PlayAnimation("idle")
npc:SetStateGraph("SGshadowwaxwell")
npc.components.health:SetMaxHealth(1000)
npc.components.combat:SetDefaultDamage(10)
npc.components.combat:SetAttackPeriod(1)
npc.components.combat:SetRetargetFunction(0, nil)
npc.components.combat.onhitotherfn = nil
npc:RemoveComponent("sleeper")
npc:RemoveComponent("thief")
npc:RemoveComponent("lootdropper")
npc:AddComponent("trader")
npc.components.trader:SetAcceptTest(function(npc, item)
if GetPlayer().components.inventory:Has("goldnugget", 10) then
if item.components.equippable then
return false
end
if item.components.edible.foodtype == "VEGGIE" then
return true
end
if item.components.edible.foodtype == "MEAT" then
return true
end
end
return false
end )
npc.components.trader.onaccept = function(npc, giver, item)
local goldnugget = SpawnPrefab("goldnugget")
for k = 1, 2 do
GetPlayer().components.inventory:GiveItem(goldnugget)
end
end
local minimap = npc.entity:AddMiniMapEntity()
minimap:SetIcon( "lighter.png" )
npc:AddTag("npcs")
end
end
local function delnpc(inst)
local range = 3000
local pos = Vector3(inst.Transform:GetWorldPosition())
local ents = TheSim:FindEntities(pos.x,pos.y,pos.z, range)
for k,v in pairs(ents) do
if v:HasTag("npcs") then
v:Remove()
end
end
end
inst:ListenForEvent( "daytime", function() createnpc(inst) end , GetWorld())
inst:ListenForEvent( "nighttime", function() delnpc(inst) end , GetWorld())
2.用记事本打开游戏目录\data\scripts\prefabs\frog.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容:
local items = { SWORD = "swap_nightmaresword" }
local function EquipItem(inst, item)
if item then
inst.AnimState:OverrideSymbol("swap_object", item, item)
inst.AnimState:Show("ARM_carry")
inst.AnimState:Hide("ARM_normal")
end
end
inst.items = items
inst.equipfn = EquipItem
EquipItem(inst)
local function onsave(inst, data)
if inst:HasTag("npcs") then
data.npcs = true
end
end
local function onload(inst, data)
if data and data.npcs then
inst.AnimState:SetBank("wilson")
local names = {"wilson","wendy","wes","wickerbottom","willow","wolfgang","wx78"}
local buildname = names[math.random(#names)]
inst.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"}
local hat = hats[math.random(#hats)]
inst.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"}
local armor = armors[math.random(#armors)]
inst.AnimState:OverrideSymbol("swap_body", armor, "swap_body")
inst.AnimState:Show("HAT")
inst.AnimState:Show("HAT_HAIR")
inst.AnimState:Hide("HAIR_NOHAT")
inst.AnimState:Hide("HAIR")
inst.AnimState:Hide("ARM_carry")
inst.AnimState:Show("ARM_normal")
inst.AnimState:PlayAnimation("idle")
inst:SetStateGraph("SGshadowwaxwell")
inst.components.health:SetMaxHealth(1000)
inst.components.combat:SetDefaultDamage(10)
inst.components.combat:SetAttackPeriod(1)
inst.components.combat:SetRetargetFunction(0, nil)
inst.components.combat.onhitotherfn = nil
inst:RemoveComponent("sleeper")
inst:RemoveComponent("thief")
inst:RemoveComponent("lootdropper")
inst:AddComponent("trader")
inst.components.trader:SetAcceptTest(function(inst, item)
if GetPlayer().components.inventory:Has("goldnugget", 10) then
if item.components.equippable then
return false
end
if item.components.edible.foodtype == "VEGGIE" then
return true
end
if item.components.edible.foodtype == "MEAT" then
return true
end
end
return false
end )
inst.components.trader.onaccept = function(inst, giver, item)
local goldnugget = SpawnPrefab("goldnugget")
for k = 1, 2 do
GetPlayer().components.inventory:GiveItem(goldnugget)
end
end
local minimap = inst.entity:AddMiniMapEntity()
minimap:SetIcon( "lighter.png" )
inst:AddTag("npcs")
end
end
inst.OnSave = onsave
inst.OnLoad = onload
即可在白天时,石头营火附近有新移民走动,黑夜时离去。你可以卖食物给他们(拿着食物对行人点鼠标左键),无论肉类还是蔬菜,都会付给你2个黄金,但他们不会与穷光蛋做买卖,交易时你身上至少有10个黄金(身上黄金数不足则无法交易)。如果你攻击新移民,附近的其他人将围殴你。在地图各处建造石头营火及其他建筑,就可以形成许多小镇,饥荒世界从此不寂寞。新移民在小地图上显示为打火机图标,通过查看小地图,可以了解各个小镇的人口情况
|
|