Enderia Posted February 13, 2022 Share Posted February 13, 2022 Info: DA keeps Sun/daycare form as default. They change into their Were/Moon/Nightcare form when: a) in complete darkness, b) below 50 sanity, c) during fullmoon SpawnPrefab keeps spamming every second, spawning "shadow_shield1" every time DA changes into their shadow/were/moon form when they enter complete darkness/their sanity falls below set threshold. However it doesn't happen when they change because of fullmoon (it still appears if during fullmoon their sanity will become low). Could use help here, I'm so close to finishing this mod and I just want it to be done. attendant.lua Link to comment https://forums.kleientertainment.com/forums/topic/137534-spawnprefab-more-like-spamprefab/ Share on other sites More sharing options...
Wonderlarr Posted February 14, 2022 Share Posted February 14, 2022 I believe your problem is that ShadowFormController is getting called A LOT from the hungerdelta event listener, since that event is pushed whenever the character's hunger updates. You should add a check to both of your ShadowFormController if statements to make sure you haven't already ran that code. You can add, remove, and check for tags using. inst:AddTag("sunform") -- doesn't have to be sunform, any alphanumeric string afaik inst:RemoveTag("sunform") inst:HasTag("sunform") -- This one is treated more like a variable than a function you can run by itself, use it in if statements Link to comment https://forums.kleientertainment.com/forums/topic/137534-spawnprefab-more-like-spamprefab/#findComment-1539961 Share on other sites More sharing options...
Enderia Posted February 14, 2022 Author Share Posted February 14, 2022 4 hours ago, TheSkylarr said: I believe your problem is that ShadowFormController is getting called A LOT from the hungerdelta event listener, since that event is pushed whenever the character's hunger updates. You should add a check to both of your ShadowFormController if statements to make sure you haven't already ran that code. You can add, remove, and check for tags using. inst:AddTag("sunform") -- doesn't have to be sunform, any alphanumeric string afaik inst:RemoveTag("sunform") inst:HasTag("sunform") -- This one is treated more like a variable than a function you can run by itself, use it in if statements This might be what I need, but I can't find where I need to place em, either they don't work or they throw away TheWorld.state.isnight part completely, could you help? This mod is slowly growing out of my bare coding knowledge Link to comment https://forums.kleientertainment.com/forums/topic/137534-spawnprefab-more-like-spamprefab/#findComment-1539981 Share on other sites More sharing options...
Wonderlarr Posted February 14, 2022 Share Posted February 14, 2022 (edited) 8 hours ago, Enderia said: This might be what I need, but I can't find where I need to place em, either they don't work or they throw away TheWorld.state.isnight part completely, could you help? This mod is slowly growing out of my bare coding knowledge You're probably running in to some operator precedence mishap, take a look at this lua article, that should help. Edited February 14, 2022 by TheSkylarr Link to comment https://forums.kleientertainment.com/forums/topic/137534-spawnprefab-more-like-spamprefab/#findComment-1540026 Share on other sites More sharing options...
Enderia Posted February 15, 2022 Author Share Posted February 15, 2022 16 hours ago, TheSkylarr said: You're probably running in to some operator precedence mishap, take a look at this lua article, that should help. Yep this ended up being too complicated for me-- Since the SpawnPrefab worked like it should before cramping fullmoon part into the main function I ended up separating sanity/light based transformation from fullmoon one and it came out working fine. Now the problem was that both transformation overlayed. It's not a big deal normally, only noticeable during fullmoon night - Fullmoon Transformation has no nightvision, but when sanity falls under the threshold nightvision activates, meaning Light/Sanity based transformation takes effect. So after sanity is restored Sunform from Light/Sanity activates, even though Fullmoon Nightform should be out. I tried to block Light/Sanity from activating during whole fullmoon and it worked as far as I know, but in the morning after the event, Fullmoon Nightform continues existing, instead of switching to Light/Sanity Dayform (it fixes when you lower your sanity and get it back above threshold). It became a one big mess, I won't lie, but im almost there. Help with this one, please? attendant.lua Also one thing still bothering me is that Moon loads before Sun. Usually it corrects second after spawning, so it doesn't bother me much, but things like portrait, icons etc use Moon instead of Sun. If someone can help I will own ya big one Daycare Attendant.rar Link to comment https://forums.kleientertainment.com/forums/topic/137534-spawnprefab-more-like-spamprefab/#findComment-1540156 Share on other sites More sharing options...
Enderia Posted February 16, 2022 Author Share Posted February 16, 2022 I managed to fix the issue. Link to comment https://forums.kleientertainment.com/forums/topic/137534-spawnprefab-more-like-spamprefab/#findComment-1540369 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now