• Content Count

  • Joined

  • Last visited

Community Reputation

569 Excellent


About IronHunter

  • Rank
    Senior Member

Recent Profile Visitors

2034 profile views
  1. From simutil.lua function FindEntity(inst, radius, fn, musttags, canttags, mustoneoftags) --simply returns the first valid entity from findentities
  2. FindEntities(x, y, z, radius, musthavetags, nottags, hasoneoftags) Returns a ordered list of ents from closest to furtherest of x, y, z that is within radius and has & doesn't have & has one of those tags. Musthavetags is a table of tags the ents must have them all. Nottags is a table of tags the ent cannot have to be valid. Musthaveoneoftags is table of tags where the ent only needs 1 of to be valid. Edit: For more information look up FindEntity and FindEntities in simutil.lua
  3. Try testing it out with the updateDamage fn outside the fn(sim) As that will put it in the scope for the listenforevents sanityspear.lua
  4. @Earthyburt If you still are having problems troubleshooting. Please attach your file so I can make sure you have placed the code in the correct spots.
  5. Hey, sorry I haven't had time to reply. I would suggest considering its a weapon, you add to your on equip and unequip fns a listenforevent that will update whenever sanity changes, then have it update the weapon that way. local function updateDamage(owner) local sanity = owner.components.sanity and owner.components.sanity:GetPercent() or 0 local weapon = owner.components.inventory and owner.components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS) if weapon ~= nil then weapon.components.weapon:SetDamage(30*sanity + 15) end end local function OnEquip(inst, owner) --in OnEquip Function owner:ListenForEvent("sanitydelta", updateDamage) end local function OnUnEquip(inst, owner) --in OnUnEquipFunction owner:RemoveEventCallback("sanitydelta", updateDamage) end --in local function fn inst.components.weapon:SetDamage(15) inst.components.equippable:SetOnEquip(OnEquip) inst.components.equippable:SetOnUnequip(OnUnEquip)
  6. This is because their is no owner unless the item is in a inventory. I would add a failsafe. So if there is no owner set it to a default value. Also you want to listenfor when this item is picked up and dropped so when the owner value changes. In this case because this is a weapon, I would simply have it update on equip and listenforevent the owners sanitydelta
  7. If it has the inventoryitem component Then inst.components.inventoryitem.owner Where inst is the item's reference in your code From there we can then do inst.components.inventoryitem.owner.components.sanity.current inst.components.inventoryitem.owner.components.sanity:GetPercent() The same can be applied for obtaining max health, and other data for reference look at the components for InventoryItem Health Sanity
  8. Maybe try SoundEmitter:OverideVolumeMultiplier I think this is used somewhere in the code to make stufg quieter, not sure if it has a cap but worth looking into?
  9. Update: This bug still exists with new wurt skin from the recent update, and all other torso/arm skins that have sleeves.
  10. How does one extract shader code from existing shader files? As that would be really helpful as reference material.
  11. --in modmain.lua you can run modimport("filename.lua") This file contains whatever I want to keep neat and tidy from each other so I got one just for strings, one for stategraphs, one for tuning, one for recipes etc. Just so it is easier for me to keep my ever growing files organized.
  12. --masterpostinit local _Eat = inst.components.eater.Eat --backup original function inst.components.eater.Eat = function(self, food, feeder, ...) --override original function if food and food.components.edible and food.components.edible.foodtype ~= "MEAT" then self.healthabsorption = 0 --lower our healthabsorption to 0 so we get no health from nonmeats end local result = _Eat(self, food, feeder,...) --call backuped function copy of original self.healthabsorption = 1 --return it to default return result --return the results from _Eat end
  13. Dude you are making this way more complicated than it has to be lols... the start_inv table is just a table containing the subtables default, and maybe lavaarena/quaqmire all lowercase, these tables contain a simple ordered list of strings. start_inv = { default = { "nightmarefuel", "papyrus", "flint", }, } This is the results you would get if you had TUNING.GAMEMODE_STARTING_ITEMS.DEFAULT.YOUR_CHARACTER_NAME = { "nightmarefuel", "papyrus", "flint", } local start_inv = {} for k, v in pairs(TUNING.GAMEMODE_STARTING_ITEMS) do start_inv[string.lower(k)] = v.YOUR_CHARACTER_NAME end as you can see you need to make sure your start_inv has a subtable default because you are calling for that from: inst.starting_inventory = start_inv[TheNet:GetServerGameMode()] or start_inv.default in the masterpostinit if you want to break the template your people.test most likely needs to return a table rather than a string.
  14. To prevent the green circle and heal sound, you'll need to extend the function for Eat in the eater component for your character, you can then check what the food you are eating before it is eaten. Disable/Enable healthabsorption and then play the original function. The oneat function you are using plays after the food is already eaten and such can't modify the past.