ZupaleX

Registered Users
  • Content count

    484
  • Joined

  • Last visited

Community Reputation

140 Excellent

2 Followers

About ZupaleX

Recent Profile Visitors

1,021 profile views
  1. Mod Commision!

    It's just changing the anim bank and/or build and disable actions so nothing special in term of coding
  2. [Help] With Coding

    Thete is a typo. components instead of componetns should help
  3. Mod Commision!

    I don't think you need to offer money for something so trivial except if you want people to also do the art and animation for you. I'll be happy to help with the code for free when I have access to the forum on something else than my phone.
  4. Hat disappears on equip

    Read this post and let me know if it helps
  5. [Help] With Coding

    Don't hesitate to post your attempts so we can try to debug it. What I sent is not 100% failsafe. It's written in a web browser without any in-game testing. That's just a skeleton of code to get started.
  6. Yes but somehow you need to add that component, right?I mean, you need to register it, so it is a known component. If you have just this piece of code, you did not create a component.
  7. Hat disappears on equip

    Actually there is another bigger issue here. There is not check for if the code is run on the client or the host. All the components will be added to the client here and that means big problems.
  8. could you link that file as well (the complete code inside)?
  9. inst.AddComponent("chosenweapon") Did you create such a component?
  10. The issue seems to at some point when you are trying to add a component. Could you post more of your code? The chunk you posted looks legit.
  11. [Help] With Coding

    Alright, so you were on a good trail with the inst.components.sanity.custom_rate_fn However what you are doing in there is probably not doing what you expect. Let's take a look at the component sanity, especially the function handling the sanity loss or gain: You will notive that the custom_rate_fn is called almost at the end. And you will also notice that it doesn't override the previously calculated rate, it just adds to it. So doing what you did local function sanityfn(inst) local delta = 0 if TheWorld.state.isday and not TheWorld.state.israining then delta = 0 elseif TheWorld.state.isday and TheWorld.state.israining then delta = - 0.25 elseif TheWorld.state.isdusk and not TheWorld.state.israining then delta = 0.25 elseif TheWorld.state.isdusk and TheWorld.state.israining then delta = -0.25 elseif TheWorld.state.isnight and not TheWorld.state.israining then delta = 0.15 elseif TheWorld.state.isnight and TheWorld.state.israining then delta = - 1 elseif TheWorld.state.isnight and TheWorld.state.israining then delta = 0 end return delta end Means that when it is day and it is raining, you return 0 for custom_rate_fn, so have an effective sanity rate of self.rate + 0 = self.rate in the function I linked above. The result of that is a sanity loss/gain unmodified. Then maybe that was the purpose of this piece of code, I don't know but as far as I understood what you want to do, I don't think so. Anyway, you will notice that custom_rate_fn is a function which takes the instance affected by the sanity business. You could write inside that function something like local function sanityfn(inst) local delta = 0 if TheWorld.state.isday and inst.components and inst.components.inventory then local equipped = inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS) if equipped and equipped.prefab == "umbrella" then delta = [whatever you want it to be if the player has umbrella equipped] else delta = [whatever you want it to be when the player has something else equipped] end elseif [some other condition] then [...] end return delta end Keep in mind that what you return will be added to the current rate and not override it. So if you want to cancel the sanity loss, saying delta = 0 in your custom sanity rate function won't work.
  12. [Help] With Coding

    You never use that function of yours, plus you use a variable in the check which will be nil because never populated (umbrella_equipped is never used).
  13. [Help] With Coding

    That chunk of code doesn't tell much. How do you use it? Where? When is it called?
  14. Hat disappears on equip

    Let me guess, this mod comes from standard Don't Starve at the first place?