祗緗簡單妳﹏ 发表于 2013-7-28 19:51

yzzn2009 发表于 2013-7-28 18:31 static/image/common/back.gif
因为所有的魔杖都在staff.lua文件中,导致魔杖要去百分比,必须所有魔杖一起去掉,也就是说,须在inst:Ad ...

local function onlight(inst, target)
    if inst.components.finiteuses then
      --inst.components.finiteuses:Use(1)
    end
end

if后面的应该不用加啊...我所有的都加了,为什么不行呢

local assets={        Asset("ANIM", "anim/staffs.zip"),        Asset("ANIM", "anim/swap_staffs.zip"), }
local prefabs = {    "ice_projectile",    "fire_projectile",    "staffcastfx",        "stafflight",}
---------RED STAFF---------
local function onattack_red(inst, attacker, target)
    if target.components.burnable and not target.components.burnable:IsBurning() then      if target.components.freezable and target.components.freezable:IsFrozen() then                     target.components.freezable:Unfreeze()                  else                        target.components.burnable:Ignite()      end       end
    if target.components.freezable then      target.components.freezable:AddColdness(-1) --Does this break ice staff?      if target.components.freezable:IsFrozen() then            target.components.freezable:Unfreeze()                  end    end
    if target.components.sleeper and target.components.sleeper:IsAsleep() then      target.components.sleeper:WakeUp()    end
    if target.components.combat then      target.components.combat:SuggestTarget(attacker)      if target.sg and target.sg.sg.states.hit then            target.sg:GoToState("hit")      end    end
    if attacker and attacker.components.sanity then      attacker.components.sanity:DoDelta(-TUNING.SANITY_SUPERTINY)    end
    attacker.SoundEmitter:PlaySound("dontstarve/wilson/fireball_explo")end
local function onlight(inst, target)    if inst.components.finiteuses then      --inst.components.finiteuses:Use(1)    endend
---------BLUE STAFF---------
local function onattack_blue(inst, attacker, target)
    if attacker and attacker.components.sanity then      attacker.components.sanity:DoDelta(-TUNING.SANITY_SUPERTINY)    end      if target.components.freezable then      target.components.freezable:AddColdness(1)      target.components.freezable:SpawnShatterFX()    end    if target.components.sleeper and target.components.sleeper:IsAsleep() then      target.components.sleeper:WakeUp()    end    if target.components.burnable and target.components.burnable:IsBurning() then      target.components.burnable:Extinguish()    end    if target.components.combat then      target.components.combat:SuggestTarget(attacker)      if target.sg and not target.sg:HasStateTag("frozen") and target.sg.sg.states.hit then            target.sg:GoToState("hit")      end    endend
---------PURPLE STAFF---------
local function getrandomposition(inst)    local ground = GetWorld()    local centers = {}    for i,node in ipairs(ground.topology.nodes) do      table.insert(centers, {x = node.x, z = node.y})    end    local pos = centers    return Point(pos.x, 0, pos.z)end
local function canteleport(inst, caster, target)    if target then      return target.components.locomotor ~= nil    end
    return trueend
local function teleport_thread(inst, caster, teletarget, loctarget)    local ground = GetWorld()
    local t_loc = nil    if loctarget then      t_loc = loctarget:GetPosition()    else      t_loc = getrandomposition()    end
    local teleportee = teletarget    local pt = teleportee:GetPosition()    if teleportee.components.locomotor then      teleportee.components.locomotor:StopMoving()    end
    --inst.components.finiteuses:Use(1)
    if ground.topology.level_type == "cave" then      TheCamera:Shake("FULL", 0.3, 0.02, .5, 40)      ground.components.quaker:MiniQuake(3, 5, 1.5, teleportee)             return    end
    if teleportee.components.health then      teleportee.components.health:SetInvincible(true)    end      GetSeasonManager():DoLightningStrike(pt)    teleportee:Hide()
    if teleportee == GetPlayer() then      TheFrontEnd:Fade(false, 2)      Sleep(3)    end      if caster.components.sanity then      caster.components.sanity:DoDelta(-TUNING.SANITY_HUGE)    end    if ground.components.seasonmanager then      ground.components.seasonmanager:ForcePrecip()    end
    teleportee.Transform:SetPosition(t_loc.x, 0, t_loc.z)
    if teleportee == GetPlayer() then      TheCamera:Snap()      TheFrontEnd:DoFadeIn(1)      Sleep(1)    end    if loctarget and loctarget.onteleto then loctarget.onteleto(loctarget) end    GetSeasonManager():DoLightningStrike(t_loc)    teleportee:Show()    if teleportee.components.health then      teleportee.components.health:SetInvincible(false)    end
    if teleportee == GetPlayer() then      teleportee.sg:GoToState("wakeup")      teleportee.SoundEmitter:PlaySound("dontstarve/common/staffteleport")    endend
local function teleport_func(inst, target)    local mindistance = 1    local caster = inst.components.inventoryitem.owner    local tar = target or caster    local pt = tar:GetPosition()    local ents = TheSim:FindEntities(pt.x,pt.y,pt.z, 9000, {"telebase"})
    if #ents <= 0 then      --There's no bases, active or inactive. Teleport randomly.      inst.task = inst:StartThread(function() teleport_thread(inst, caster, tar) end)      return    end
    local targets = {}    for k,v in pairs(ents) do      local v_pt = v:GetPosition()      if distsq(pt, v_pt) >= mindistance * mindistance then            table.insert(targets, {base = v, distance = distsq(pt, v_pt)})         end    end
    table.sort(targets, function(a,b) return (a.distance) < (b.distance) end)    for i = 1, #targets do      local teletarget = targets      if teletarget.base and teletarget.base.canteleto(teletarget.base) then            inst.task = inst:StartThread(function()teleport_thread(inst, caster, tar, teletarget.base) end)            return      end    end
    inst.task = inst:StartThread(function() teleport_thread(inst, caster, tar) end)end

---------YELLOW STAFF-------------
local function cancreatelight(staff, caster, target, pos)    local ground = GetWorld()    if ground and pos then      local tile = ground.Map:GetTileAtPoint(pos.x, pos.y, pos.z)      return tile ~= GROUND.IMPASSIBLE and tile < GROUND.UNDERGROUND    end    return falseend
local function createlight(staff, target, pos)    local light = SpawnPrefab("stafflight")    light.Transform:SetPosition(pos.x, pos.y, pos.z)    staff.components.finiteuses:Use(1)
    local caster = staff.components.inventoryitem.owner    if caster.components.sanity then      caster.components.sanity:DoDelta(-TUNING.SANITY_MEDLARGE)    end
end
---------COMMON FUNCTIONS---------
local function onfinished(inst)    inst.SoundEmitter:PlaySound("dontstarve/common/gem_shatter")    inst:Remove()end
local function unimplementeditem(inst)    local player = GetPlayer()    player.components.talker:Say(GetString(player.prefab, "ANNOUNCE_UNIMPLEMENTED"))    if player.components.health.currenthealth > 1 then      player.components.health:DoDelta(-player.components.health.currenthealth * 0.5)    end
    if inst.components.useableitem then      inst.components.useableitem:StopUsingItem()    endend
local function commonfn(colour)
    local onequip = function(inst, owner)         owner.AnimState:OverrideSymbol("swap_object", "swap_staffs", colour.."staff")      owner.AnimState:Show("ARM_carry")         owner.AnimState:Hide("ARM_normal")   end
    local onunequip = function(inst, owner)         owner.AnimState:Hide("ARM_carry")         owner.AnimState:Show("ARM_normal")   end
        local inst = CreateEntity()        local trans = inst.entity:AddTransform()        local anim = inst.entity:AddAnimState()    local sound = inst.entity:AddSoundEmitter()    MakeInventoryPhysics(inst)      anim:SetBank("staffs")    anim:SetBuild("staffs")    anim:PlayAnimation(colour.."staff")    -------       --inst:AddComponent("finiteuses")    --inst.components.finiteuses:SetOnFinished( onfinished )
    inst:AddComponent("inspectable")      inst:AddComponent("inventoryitem")      inst:AddComponent("equippable")    inst.components.equippable:SetOnEquip( onequip )    inst.components.equippable:SetOnUnequip( onunequip )

      return instend

---------COLOUR SPECIFIC CONSTRUCTIONS---------
local function red()    local inst = commonfn("red")
    inst:AddTag("firestaff")    inst:AddTag("rangedfireweapon")
    inst:AddComponent("weapon")    inst.components.weapon:SetDamage(0)    inst.components.weapon:SetRange(8, 10)    inst.components.weapon:SetOnAttack(onattack_red)    inst.components.weapon:SetProjectile("fire_projectile")
    inst:AddComponent("lighter")    inst.components.lighter:SetOnLightFn(onlight)
    --inst.components.finiteuses:SetMaxUses(TUNING.FIRESTAFF_USES)    --inst.components.finiteuses:SetUses(TUNING.FIRESTAFF_USES)
    return instend
local function blue()    local inst = commonfn("blue")      inst:AddTag("icestaff")
    inst:AddComponent("weapon")    inst.components.weapon:SetDamage(0)    inst.components.weapon:SetRange(8, 10)    inst.components.weapon:SetOnAttack(onattack_blue)    inst.components.weapon:SetProjectile("ice_projectile")
    --inst.components.finiteuses:SetMaxUses(TUNING.ICESTAFF_USES)    --inst.components.finiteuses:SetUses(TUNING.ICESTAFF_USES)      return instend
local function purple()    local inst = commonfn("purple")    inst.fxcolour = {104/255,40/255,121/255}    --inst.components.finiteuses:SetMaxUses(TUNING.TELESTAFF_USES)    --inst.components.finiteuses:SetUses(TUNING.TELESTAFF_USES)    inst:AddComponent("spellcaster")    inst.components.spellcaster:SetSpellFn(teleport_func)    inst.components.spellcaster.canuseontargets = true    inst.components.spellcaster:SetSpellTestFn(canteleport)    inst:AddTag("nopunch")
    return instend
local function yellow()    local inst = commonfn("yellow")    inst.fxcolour = {223/255, 208/255, 69/255}    inst.castsound = "dontstarve/common/staffteleport"
    inst:AddComponent("spellcaster")    inst.components.spellcaster:SetSpellFn(createlight)    inst.components.spellcaster:SetSpellTestFn(cancreatelight)
    inst.components.spellcaster.canuseonpoint = true    inst.components.spellcaster.canusefrominventory = false
    --inst.components.finiteuses:SetMaxUses(TUNING.YELLOWSTAFF_USES)    --inst.components.finiteuses:SetUses(TUNING.YELLOWSTAFF_USES)    inst:AddTag("nopunch")
    return instend
return Prefab( "common/inventory/icestaff", blue, assets, prefabs),Prefab("common/inventory/firestaff", red, assets, prefabs),Prefab("common/inventory/telestaff", purple, assets, prefabs),Prefab("common/inventory/yellowstaff", yellow, assets, prefabs)
这是所有staff的代码,帮忙看看呗,谢了

abc1074 发表于 2013-7-28 19:59

怎么改种岩石的石矿的

yzzn2009 发表于 2013-7-28 20:06

祗緗簡單妳﹏ 发表于 2013-7-28 19:51 static/image/common/back.gif
local function onlight(inst, target)
    if inst.components.finiteuses then
      --inst.compone ...

我改好了一个文件,实测可以用,你再比对一下

祗緗簡單妳﹏ 发表于 2013-7-28 20:13

yzzn2009 发表于 2013-7-28 20:06 static/image/common/back.gif
我改好了一个文件,实测可以用,你再比对一下

我忘了做YELLOW STAFF部分的修改了,感谢{:3_110:}

yzzn2009 发表于 2013-7-28 20:57

abc1074 发表于 2013-7-28 19:59 static/image/common/back.gif
怎么改种岩石的石矿的

我为你做了更新

四十六.用木头、木炭、灰种植石矿(可持续发展)

    1.用木头种第一种石矿(只有石头):用记事本打开游戏目录\data\scripts\prefabs\log.lua文件,在inst:AddComponent("stackable")的下一行插入以下内容:

local function OnDeploy (inst, pt)
    local rock_flintless = SpawnPrefab("rock_flintless")
    if rock_flintless then
      rock_flintless:PushEvent("growfromlog")
                rock_flintless.Transform:SetPosition(pt.x, pt.y, pt.z)
      inst.components.stackable:Get():Remove()
    end
end

    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy


    2.用木炭种第二种石矿(带硝石的):用记事本打开游戏目录\data\scripts\prefabs\charcoal.lua文件,在inst:AddComponent("inspectable")的下一行插入以下内容:

local function OnDeploy (inst, pt)
    local rock1 = SpawnPrefab("rock1")
    if rock1 then
      rock1:PushEvent("growfromcharcoal")
                rock1.Transform:SetPosition(pt.x, pt.y, pt.z)
      inst.components.stackable:Get():Remove()
    end
end

    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy


    3.用灰种第三种石矿(带黄金的):用记事本打开游戏目录\data\scripts\prefabs\ash.lua文件,在inst.AnimState:PlayAnimation("idle")的下一行插入以下内容:

local function OnDeploy (inst, pt)
    local rock2 = SpawnPrefab("rock2")
    if rock2 then
      rock2:PushEvent("growfromash")
                rock2.Transform:SetPosition(pt.x, pt.y, pt.z)
      inst.components.stackable:Get():Remove()
    end
end

    inst:AddComponent("deployable")
    inst.components.deployable.ondeploy = OnDeploy

    即可使石矿循环利用




aizi1117 发表于 2013-7-28 20:59

怎么下载不了的说呢

blbox 发表于 2013-7-28 21:00

???奇怪!!
原来有红蓝宝石种红蓝象...还有羽毛种火鸡的代码修改~
怎么现在不见了呢???

升级了18版~><还想用这个啊~~~~~

yzzn2009 发表于 2013-7-28 21:13

aizi1117 发表于 2013-7-28 20:59 static/image/common/back.gif
怎么下载不了的说呢

是不是正赶上我更新的刹那,那会儿无法下载。现在应该没问题了

yzzn2009 发表于 2013-7-28 21:17

本帖最后由 yzzn2009 于 2013-7-28 21:19 编辑

blbox 发表于 2013-7-28 21:00 static/image/common/back.gif
???奇怪!!
原来有红蓝宝石种红蓝象...还有羽毛种火鸡的代码修改~
怎么现在不见了呢???

因为种大象、火鸡的方法,在种高鸟中已经介绍了,所以只保留了种高鸟的例子。你可以下载养殖大师5.0Mod,这个Mod是我参与制作的,里面除了种植以为,还修改了动物的习性,支持18版

blbox 发表于 2013-7-28 22:12

yzzn2009 发表于 2013-7-28 21:17 static/image/common/back.gif
因为种大象、火鸡的方法,在种高鸟中已经介绍了,所以只保留了种高鸟的例子。你可以下载养殖大师5.0Mod, ...

{:3_130:}哎呀~原来如此!!!!!>,.<之前一直没用过养殖mod啊~都是直接修改的~呵呵~~~~~~

greenlandxu 发表于 2013-7-29 14:36

请教如何修改探索视野的半径?也就是探索时候小地图展现的范围。不想直接全图...

yzzn2009 发表于 2013-7-29 14:43

greenlandxu 发表于 2013-7-29 14:36 static/image/common/back.gif
请教如何修改探索视野的半径?也就是探索时候小地图展现的范围。不想直接全图... ...

这两天一直在研究这个,一直没有找到比较好的方法{:3_95:}。目前只能做到装备某件物品的刹那,周边开比较大的视野,但动态扩大视野存在问题(怕对CPU负担太大)

452859986 发表于 2013-7-29 14:48

都改成这样了 还有什么好玩的

yzzn2009 发表于 2013-7-29 15:07

本帖最后由 yzzn2009 于 2013-7-29 15:11 编辑

452859986 发表于 2013-7-29 14:48 static/image/common/back.gif
都改成这样了 还有什么好玩的
生活岂能尽如人意,游戏何不纵情寰宇{:3_93:}

hunter3213 发表于 2013-7-29 15:14

我晕,这么叼?

yzzn2009 发表于 2013-7-29 18:19

本帖最后由 yzzn2009 于 2013-7-29 19:49 编辑

回复81651891
砍树就得木炭:用记事本打开游戏目录\data\scripts\prefabs\evergreens.lua文件,将下列内容:

                normal_loot = {"log", "log", "pinecone"},
                short_loot = {"log"},
                tall_loot = {"log", "log", "log", "pinecone", "pinecone"},

替换为以下内容:

                normal_loot = {"log", "log", "pinecone", "charcoal", "charcoal", "charcoal", "charcoal", "charcoal"},
                short_loot = {"log", "charcoal", "charcoal", "charcoal", "charcoal"},
                tall_loot = {"log", "log", "log", "pinecone", "pinecone", "charcoal", "charcoal", "charcoal", "charcoal", "charcoal", "charcoal", "charcoal", "charcoal", "charcoal", "charcoal"},

    即可砍小树得3个木炭,砍中树得5个木炭,砍大树得10个木炭

tyblbly 发表于 2013-7-29 20:14

很牛X的说,看到楼主又更新了,特来捧场,加顶一个------

wuzihang101 发表于 2013-7-29 20:57

能否取消使用远程魔杖就下雨

耀眼の晴空 发表于 2013-7-29 21:04

能让背包加上冰箱功能吗?

wuzihang101 发表于 2013-7-29 21:17

该死,这颜色怎样才能调成黑色 SetMultColour(1, 1, 1, 1),这是白色;怎样才能变成黑色啊!

yzzn2009 发表于 2013-7-29 22:00

耀眼の晴空 发表于 2013-7-29 21:04 static/image/common/back.gif
能让背包加上冰箱功能吗?

我为你做了更新

三十八.背包可冷藏食品

    1.普通背包可冷藏食品:用记事本打开游戏目录\data\scripts\prefabs\backpack.lua文件,在local inst = CreateEntity()的下一行插入inst:AddTag("fridge")

    2.小猪包可冷藏食品:用记事本打开游戏目录\data\scripts\prefabs\piggyback.lua文件,在local inst = CreateEntity()的下一行插入inst:AddTag("fridge")

    3.坎普斯背包可冷藏食品:用记事本打开游戏目录\data\scripts\prefabs\krampus_sack.lua文件,在local inst = CreateEntity()的下一行插入inst:AddTag("fridge")

    即可让背包具备冷藏功能

greenlandxu 发表于 2013-7-29 22:59

yzzn2009 发表于 2013-7-29 14:43 static/image/common/back.gif
这两天一直在研究这个,一直没有找到比较好的方法。目前只能做到装备某件物品的刹那,周边开比较 ...

多谢啦,真是麻烦你研究了好久。

452859986 发表于 2013-7-30 11:02

我始终还是喜欢玩 原版 听说18版有水 但是我怎么没看到呢

qqwwzjl 发表于 2013-7-30 15:12

大神,有18版本可以用的食物标签MOD跟状态、日期、温度显示MOD吗?

yzzn2009 发表于 2013-7-30 15:31

qqwwzjl 发表于 2013-7-30 15:12 static/image/common/back.gif
大神,有18版本可以用的食物标签MOD跟状态、日期、温度显示MOD吗?

那是从klei网上搬运的吧,目前没有看到新版本

耀眼の晴空 发表于 2013-7-30 16:49

qqwwzjl 发表于 2013-7-30 15:12 static/image/common/back.gif
大神,有18版本可以用的食物标签MOD跟状态、日期、温度显示MOD吗?

可参考此网站: http://tieba.baidu.com/p/2489381584

qqwwzjl 发表于 2013-7-30 17:15

耀眼の晴空 发表于 2013-7-30 16:49 static/image/common/back.gif
可参考此网站: http://tieba.baidu.com/p/2489381584

可以了,谢谢!

Spectral 发表于 2013-7-30 19:22

本帖最后由 Spectral 于 2013-7-30 21:01 编辑

请问怎么能用铲子铲去企鹅冰?或者是让企鹅冰换个位置

红卫兵 发表于 2013-7-30 19:24

神啊 这真是棒

yzzn2009 发表于 2013-7-30 21:06

本帖最后由 yzzn2009 于 2013-7-30 22:04 编辑

Spectral 发表于 2013-7-30 19:22 static/image/common/back.gif
请问怎么能用铲子铲去企鹅冰?或者是让企鹅冰换个位置
我本来已经放出了铲掉企鹅冰的方法,但读档后发现企鹅冰还会再生,只能临时铲除

用铲子挖掉企鹅冰(读档会再生)

    用记事本打开游戏目录\data\scripts\prefabs\penguin_ice.lua文件,

    1.在local SNOW_THRESH = 0.10的下一行插入以下内容:

local function dig_up(inst, chopper)
      inst:Remove()
end

    2.将inst:AddTag("NOCLICK")替换为以下内容:

            inst:AddComponent("workable")
            inst.components.workable:SetWorkAction(ACTIONS.DIG)
            inst.components.workable:SetOnFinishCallback(dig_up)
            inst.components.workable:SetWorkLeft(1)

页: 2 3 4 5 6 7 8 9 10 11 [12] 13 14 15 16 17 18 19 20 21
查看完整版本: 易宁:饥荒游戏实用修改技巧(非MOD模式,请自行备份)支持海难版——6月6日更新:简化修船工具制作材料(只用木板和绳子)