游民星空 > 攻略秘籍 > 攻略 > 正文

《饥荒》MOD制作图文教程 饥荒怎么制作MOD

2015-11-19 14:20:43 来源:饥荒游戏吧 作者:首字母G 我要投稿

第9页:第六步代码制作(1)

展开

第六步:代码制作

  打开goldcoin\scripts\prefabs新建goldcoin和exchange的文本文档。

游民星空

  点击工具-文件夹选项-查看,去除勾选的隐藏已知文件类型的拓展名

游民星空

  然后把exchange和goldcoin的拓展名改为

游民星空

  双击打开goldcoin.lua写入

  local assets=

  {

  Asset("ANIM", "anim/goldcoin.zip"),

  Asset("ATLAS", "images/inventoryimages/goldcoin.xml"),

  }

  local function fn(Sim)

  local inst = CreateEntity()

  inst.entity:AddTransform()

  inst.entity:AddAnimState()

  inst.entity:AddSoundEmitter()

  inst.entity:AddPhysics()

  MakeInventoryPhysics(inst)

  inst.AnimState:SetBank("goldcoin")

  inst.AnimState:SetBuild("goldcoin")

  inst.AnimState:PlayAnimation("idle")

  inst:AddComponent("edible")

  inst.components.edible.foodtype = "ELEMENTAL"

  inst.components.edible.hungervalue = 2

  inst:AddComponent("tradable")

  inst:AddComponent("inspectable")

  inst:AddComponent("stackable")

  inst:AddComponent("inventoryitem")

  inst.components.inventoryitem.atlasname = "images/inventoryimages/goldcoin.xml"

  return inst

  end

  return Prefab( "common/inventory/goldcoin", fn, assets)

更多相关内容请关注:饥荒专区

责任编辑:修凡客

上一页 1 2 3 4 5 6 7 8 9 10 11 下一页
友情提示:支持键盘左右键“← →”翻页

本文是否解决了您的问题

游民星空APP
随手浏览游戏攻略
code
攻略合集
单机游戏下载
休闲娱乐
综合热点资讯
游民星空联运游戏