• Content Count

  • Joined

  • Last visited

 Content Type 




Klei Bug Tracker

Game Updates

Hot Lava Bug Reporter

Everything posted by Cthonicus

  1. Super sorry for the late response, but this totally works! Thanks a ton!
  2. Hey everyone! I came here awhile ago with to find some help on writing a line of code to create a sanity aura for my character, and while it does work, I've discovered over time an issue. -- MY CUSTOM CODE! -- This value is the highest amount of sanity that a single entity can give per second. local maxSanityRateBonusPerEntity = TUNING.SANITYAURA_SMALL -- This function is hooked up to the sanity component, to add a custom rate-based -- change to sanity for this particular character. local function sanityfn(inst) local delta = 0 local x, y, z = inst.Transform:GetWorldPosition() local max_rad = 10 local ents = TheSim:FindEntities(x, y, z, max_rad, nil, nil, { "bee", "flower", "butterfly", "rabbit", "koalefant_summer", "koalefant_winter", "chester", "squid", "glommer", "hutch", "mole" }) for i, v in ipairs(ents) do -- Determine whether the entity is dead, which they can only be if they have a health-component. -- Otherwise, we default to them not being seen as dead. local isDead = v.components.health ~= nil and v.components.health:IsDead() or false local distsq = inst:GetDistanceSqToInst(v) - 9 -- Add the maximum sanity rate divided by distance, so you get more sanity the closer -- you are to the entities, but cap it so distance cannot be lower than 1, -- because dividing by e.g. 0.2 would multiply the value by 5 :) -- And at the end there, if the entity is dead, it makes the character sad instead. delta = delta + maxSanityRateBonusPerEntity / math.max(1, distsq) * (isDead and -1 or 1) end return delta end This code allows the player to gain sanity when near those listed entities (which works fine), except I later noticed that if the player is holding one of those entities in their inventory, such as a Moleworm or a butterfly, the sanity aura continues. This is pretty OP since the player can just feed the Moleworm rocks for example and have infinite sanity gain. So really I just need to make it that if the player is holding an entity listed there, the sanity aura does NOT count. Could anyone please inform me if this is possible to fix? All help is greatly appreciated. I've attached the prefab file there just in case. Thanks! wolyo.lua
  3. Anyone with invisible items in-hand and items being too small in-game (in need of scaling) please read this: I have spent the last absurd amount of hours trying to figure out these two issues (more so the invisible item part), and I have found what worked for me, assuming you have your .lua files typed accordingly and you compile the two animation files with the proper names (yourmod - idle and yourmod - BUILD). I had all the assets listed, no "errors" in the pre-game compile in CMD, and the inventory and ground animations I could see just fine. Thanks to Cheerio and his example item mod, I was able to properly rule out the file system layout. I followed the OP's file layout, and everyone else's supposed "correct" layout they had responded to other people with the same issue's question to and had no luck in resolving this issue. To have no invisible item in-hand, copy his EXACT file layout. Do not worry about the .zip files for they will be compiled automatically. The PROPER mod file system layout for Don't Starve: Together is the following: This is for the ground animation (your item just sitting on the ground.) yourmod > exported > yourmod (contains yourmod.scml) > yourmod > yourmod.png This is for the in-hand animation (your item being held by a player.) yourmod > exported > swap_yourmod (contains swap_yourmod.scml) > yourmod > yourmod.png This is for the inventory icon (your item in your inventory.) yourmod > images > inventoryimages > yourmod.png If this does not resolve the issue for you, then I simply advise to triple check your .lua files and .scml data. As for the item being scaled too small, simply change the resolution of the .png files used for the compiling. I found that these sizes worked perfectly for me: Inventory icon - 64 x 64 Item on ground - 200 x 200 Item in-hand - 200 x 200 I really hope this helps someone. This process was very painful and honestly should have been updated for 2019 by at least one person by now. The method listed by the OP still works of course, but it is definitely outdated and unclear in specific areas. Thanks again ,OP! I guess as the game updated some of the old layouts needed updating. (That wasn't supposed to sound hostile lol I'm genuinely thankful for your post, I couldn't have done anything with out it :D)