Blueberrys

  • Content Count

    737
  • Joined

  • Last visited

 Content Type 

Profiles

Forums

Downloads

Klei Bug Tracker

Game Updates

Hot Lava Bug Reporter

Everything posted by Blueberrys

  1. @Deilan I don't currently have the time for it, but I'll keep that in mind if I get back to DS modding. Thanks for the feedback!
  2. @SquareRoot In a place where the inst variable refers to your player instance. Usually, that's in your player file, inside the "fn" function.
  3. @SquareRoot inst:ListenForEvent("oneat", function(inst, data) -- When you eat something if data.food.components.edible.foodtype == "VEGGIE" then -- If it's a veggie inst.components.sanity:DoDelta(-10) -- Decrease sanity endend)
  4. You can't just cut out parts of the code to optimise space xD It has to make sense too. I see. First of all, fix the if statement. Either write them all out correctly, or use one of the shorter methods I suggested. The builditem event is still being used in DST through the builder component. The armor component still has a operational SetPercent function. I think the issue may be related to the networking aspect. Perhaps the code isn't executing because it's not running on the host. I suggest you post on the DST mod forums. Include your full code, logs, etc.
  5. You mean prefab name? Not sure what you're looking for, but that if statement won't work how you think. if data.item.prefab == "armorwood" or "armormarble" ...Means "if the name is 'armorwood', OR if 'armormarble exists..." Should be: if data.item.prefab == "armorwood" or data.item.prefab == "armormarble" ...- Alternately: if data.item.prefab:sub(1, 5) == "armor" ...for everything starting with "armor" Edit: More code. -- ending in hatif data.item.prefab:sub(-3) == "hat" ...-- containing armorif data.item.prefab:find("armor", 1, true) ...-- containing hatif data.item.prefab:find("hat", 1, true) ...
  6. @jimmosio See Mobbstar's solution above. Also.. where is armor_inst coming from? Are you doing something like "armor_inst = data.item"? If what you provided here is all you have in your event function, it should probably crash with "attempt to index armor_inst a nil value". Considering that isn't happening, there may be another issue. Testing the event myself to confirm. Edit: data.item contains the prefab name, not the instance of the item. armor_inst still needs to come from somewhere though. Edit 2: Nope, actually it is the instance. You would need to use data.item.prefab to check if you've got the right item. Testing to confirm. Edit 3: Works. inst:ListenForEvent("builditem", function(inst, data) if (data.item.prefab == "armorwood") then data.item.components.armor:SetPercent(1.35) endend)
  7. @jimmosio Use the hungerdelta event, it updates whenever the hunger value is changed. local function check_light(inst, data) if GetClock():IsNight() and inst.components.hunger.current > 104 then -- if light off, enable light else -- if light on, disable light endendinst:ListenForEvent("hungerdelta", check_light)-- To ensure it's working even if the hunger doesn't change at night/dayinst:ListenForEvent("nighttime", check_light)inst:ListenForEvent("daytime", check_light)- Not sure what approach you want to take on that, but here's how you can change the durability. -- 135% of original durabilityarmor_inst.components.armor:SetPercent(1.35)You can do it upon crafting with: inst:ListenForEvent("builditem", function(inst, data) if data.item.prefab == "armor_prefab" then -- ... endend)Edit: Fixed data.item.prefab. (see below)
  8. Sorry, I don't think so. You're free to try it, but it wasn't made with DST compatibility in mind. I might make a DST version some time later though.
  9. @Corrosive I think you used the term fine, but it's such a vague and undefined term that it can be confusing. It's probably better to keep it reserved for humorous or non-educational kinda things (as above). We're so off topic, btw. This thread is for variables in caves. @Mobbstar I think you might as well start a new topic regarding your mod. I'd like to help out with it when I have some time.
  10. "Strongly typed". "type" meaning variable types such as integer, string, float, etc. Not typing with a keyboard. (Simpler explanation)
  11. It's about your mod, but not the issue you mentioned. Corrosive found something else in your mod and we started talking about that, but he edited the original post now. Er, again, have you tried using that module? xD It's fairly straight forward, should only take you about 5 minutes to figure it out. Or are you talking about the second issue, too? That doesn't sound right.. I think I'll have a look at your code. >-> If 1 is "unconcerned" and 10 is "Noo whyyyyyyyy" then probably 9.
  12. @Corrosive Hmm. But I don't see any reason for SpawnPrefab's original data to be discarded at any time while the game world is still running. I think it should be fine as long as the code doesn't execute outside of the game world.
  13. @6gumis9 Is it from GOG? Edit: If yes, see this and this.
  14. @Corrosive Thank you for pointing that out. It persuaded me to research more on how upvalues work. if anyone else is interested, here's a long explanation which I found quite helpful. As for SpawnPrefab, wouldn't the reference to the upvalue be stored within the function's own scope? What do you mean by "longer than the original context of SpawnPrefab", is it being changed or removed anywhere? Edit: Just saw your edit. You probably should've left the original post too so people know what you're referring to, haha.
  15. Version 1.2

    544 downloads

    A module that can store, save, and load any arbitrary data. For developers only! Don't expect it to do anything interesting in-game. Download contains: persistentdata.lua - The module. Put this in your mod's scripts folder. PersistentDataExample_v1.x.zip - Example usage of the module with comments See the example for information on how to use it. Mods that currently use it: Mod Manager - by Blueberrys Feats of the World - by debugman18 Previously posted here. Everything provided here is public domain. No warranties for anything. Blah blah blah. Use it however you want! Attribution would be appreciated, but is not required.