• Announcements

    • JoeW
    • JanH

      Rhymes with Play 148 - Oxygen Not Included Art Stream!   07/20/2017

      Join Oxygen Not Included artists Alex and Erica this Thursday, July 20th at 3:30 PM Pacific (10:30 PM UTC) where they will be showing off how your favourite dupes are drawn, as well as creating a summer-themed ONI illustration, only on the Rhymes with Play Dev Cast on Twitch. Where is it?
      On our official Twitch channel here:
      http://www.twitch.tv/kleientertainment
       
      When is it?
      Twitch Stream Date: July 20th, 2017 

      10:30 PM UTC (Coordinated Universal Time)
      6:30 PM ET (East)
      5:30 PM CT (Central)
      4:30 PM MT (Mountain) Here's a handy tool to figure out what time that means for you. Check out the stream announce thread for discussions!

alainmcd

Registered Users
  • Content count

    512
  • Joined

  • Last visited


Community Reputation

779 Excellent

7 Followers

About alainmcd

  • Rank
    Junior Member

Badges

  • badge_2 http://www.dontstarvegame.com/chestershrine
  1. Hooray for tools! @V2C, can we keep ImGui? Pleeeease? We promise we'll love it! Even if it's sick and crashes all the time! (Am I doing something wrong or does it just randomly crash all the time?)
  2. If you're running a modded server, I strongly suggest using collections: it makes checking your mods easier for players and if you're hosting a dedicated server, you can download all of your mods at once with ServerModCollectionSetup in your dedicated_server_mods_setup.lua file (I don't know if you can activate them all at the same time in your modoverrides.lua, it would make for a nice feature).
  3. (From The Secret of Monkey Island.) But I think it's too early to try and guess a launch price.
  4. AddPrefabPostInitAny defines a function that will be applied to any prefab that is spawned in.
  5. I mean that I really don't know what I'm talking about. If there's some way you can merge your symbols, you wouldn't need to check all the hats and change their functions. I am completely clueless when it comes to animations, so you're probably right in doing it this way.
  6. Oops. Copy-pasting without checking. You don't need the second for-loop at all, then. Change the last block of code to: for _, items in pairs(loot) do local item = SpawnPrefab(items.item) if items.count and item.components.stackable then item.components.stackable:SetStackSize(items.count) end chest.components.container:GiveItem(item) end
  7. Ah, yeah, you can't name the "chests" or the length operator will complain. Simple solution: remove "chest1 =" and "chest2 =". I've updated the example above and corrected a mistake in the same line you mentioned (loots is a table, not a function). If you do want to use names, you can try something like... Again, untested.
  8. local loots = { { {item = "spear"}, {item = "armorwood"} }, { {item = "manure", count = 10}, {item = "pitchfork"} } } local chest = SpawnPrefab("treasurechest") local loot = loots[math.random(#loots)] for _, items in pairs(loot) do for _, v in pairs(items) do local item = SpawnPrefab(v.item) if v.count and item.components.stackable then item.components.stackable:SetStackSize(v.count) end chest.components.container:GiveItem(item) end end 100% untested. The chest1 and chest2 are unnecessary in this example, mostly just for clarity. You could give them fancier names to tweak them more easily or to set chance percentages. Or, or, or...
  9. The SW code looks very convoluted. Try this instead: chest = SpawnPrefab("treasurechest") chest.components.container:GiveItem(SpawnPrefab("rocks")) From the dospawnchest function in data/scripts/prefabs/minotaur.lua.
  10. You can use AddPrefabPostInitAny: AddPrefabPostInitAny(function(inst) if inst and inst.components and inst.components.equippable and inst.components.equippable.equipslot = GLOBAL.EQUIPSLOT.HEAD then local OldOnequipfn = inst.components.equippable.onequipfn local OldOnunequipfn = inst.components.equippable.onunequipfn inst.components.equippable.onequipfn = function(inst, owner, symbol_override) OldOnequipfn(inst, owner, symbol_override) if owner.prefab == "YOURCHARACTER" then owner.AnimState:Show("HAIRFRONT_HAT") end end inst.components.equippable.onunequipfn = function(inst, owner) OldOnunequipfn(inst, owner) if owner.prefab == "YOURCHARACTER" then owner.AnimState:Hide("HAIRFRONT_HAT") end end end end) I have no idea about animations, but wouldn't it be simpler to merge HAIRFRONT_HAT with HAIR_HAT? -- That will result in an error, won't it? ( attempt to call local 'OriginalFn' (a table value) ).
  11. The code I suggested here belongs in your master_postinit. The other crash you mention is because of the last comma in your last line of code.
  12. I don't know what your line 52 looks like or its context. Please copy your whole endy.lua.
  13. Nothing. Klei would just pull the plug.
  14. ic.lootdropper:SpawnLootPrefab(lootprefab[math.random(10*#lootprefab)])
  15. onfinishcallback isn't referenced anywhere in the code, Workable:WorkedBy only calls onfinish (if it exists and if there's no work left). -- math.random takes zero, one or two arguments: If it's called with no arguments, it will return a number between 0 and 1 (and less than 1). So something like "if math.random() < 0.3 then ..." roughly means "do this 30% of the time". If it's called with a single argument, it will return an integer between 1 and that argument. For example, math.random(6) is practically the same as throwing a regular six-sided die. If it's called with two arguments, it will return an integer between those two numbers. math.random(1, #lootprefab) is the same as math.random(#lootprefab). All arguments should be integers. My understanding is that DS/DST are based on Lua 5.1 which didn't specify how to handle non-integers. And yes, calling math.random with more than two arguments produces an error. I'm not sure what you were trying there.