• Content Count

  • Joined

  • Last visited

Community Reputation

172 Excellent


About Blueberrys

  • Rank
    Senior Member

Recent Profile Visitors

3619 profile views
  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 == "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)