Garamonde Posted March 20, 2022 Share Posted March 20, 2022 (edited) Along with my other current problem, I have discovered two more. When my mod character befriends pigmen with his working ability, they seem to refuse to attack other pigs that are not befriended, including pig guards. Similarly, the game is acting like pig guards become followers too when in range of K_K's ability by giving them friendly names and rendering me unable to attack them (unless I ctrl + click them with a weapon). Yet they still attack me like normal. Here again is K_K's prefab file for convenience, although it's basically unchanged since I made the other thread as I have made no progress towards these issues. kk.lua These three issues are I think the last thing stopping me from completing this character. Thanks again for any help! Edited April 13, 2022 by Garamonde Link to comment https://forums.kleientertainment.com/forums/topic/138431-solved-befriended-pigs-refuse-to-attack-other-pigs-and-guard-pigs-are-falsely-labeled-as-followers/ Share on other sites More sharing options...
Garamonde Posted April 11, 2022 Author Share Posted April 11, 2022 (edited) Hi, not trying to be annoying, just thought I'd bump this in case anyone who might be able to help sees it, because this is actually a pretty significant issue for my character. The newest version of my character's .LUA is here: kk.lua In addition to the above issues, another problem is that when attacking pigs, K_K's followers turn on him and start attacking for some reason. EDIT: Also, I just now tested this but it seems Merms do not become followers via working near them, even with a Clever Disguise on unless you feed them seeds. Thank you for reading! Edited April 11, 2022 by Garamonde Found another bug. Link to comment https://forums.kleientertainment.com/forums/topic/138431-solved-befriended-pigs-refuse-to-attack-other-pigs-and-guard-pigs-are-falsely-labeled-as-followers/#findComment-1556889 Share on other sites More sharing options...
-LukaS- Posted April 11, 2022 Share Posted April 11, 2022 Does working befriend pigs? Is there only a problem with befriending merms? Because there's an issue I noticed in your code and that's the fact you have 2 local functions named OnWorked. If your OnWorked function is meant to be called on working event callback it will run the one that's created last and that would be this one: local function OnWorked(inst, data) if inst.SoundEmitter:PlayingSound("hungerbuffsong") then -- If the sound is still going inst.songkilltask:Cancel() -- Stop our kill task inst.songkilltask = nil else -- otherwise inst.SoundEmitter:PlaySound("soundstudio/hungerbuff/song", "hungerbuffsong") -- Start the sound end inst.songkilltask = inst:DoTaskInTime(4, function() -- Start the kill task ReduceVolume(inst,1) --start the periodic task that reduces the volume each 2 frames, start with volume = 1 end) end  Have you tested befriending since adding this function? 1 Link to comment https://forums.kleientertainment.com/forums/topic/138431-solved-befriended-pigs-refuse-to-attack-other-pigs-and-guard-pigs-are-falsely-labeled-as-followers/#findComment-1556914 Share on other sites More sharing options...
Garamonde Posted April 11, 2022 Author Share Posted April 11, 2022 (edited) Yes, working does befriend nearby pigs (as it should merms) just like a One-man Band...or at least, it's supposed to. You're right, I just tested it and pigs do not become loyal anymore with that extra OnWorking function. Do you know how I can fix this problem while keeping both effects? And thank you so much for replying! Edited April 11, 2022 by Garamonde Link to comment https://forums.kleientertainment.com/forums/topic/138431-solved-befriended-pigs-refuse-to-attack-other-pigs-and-guard-pigs-are-falsely-labeled-as-followers/#findComment-1556940 Share on other sites More sharing options...
-LukaS- Posted April 12, 2022 Share Posted April 12, 2022 You should just combine the two functions into one. On another note, I checked your code and seems like pigs should have no trouble targeting other pigs. Don't know about guard pigs though. Their targeting is a bit different from normal pig so I'm going to assume you need to snoop around in their brain. I think it's called pig_guardbrain or something like that. 1 Link to comment https://forums.kleientertainment.com/forums/topic/138431-solved-befriended-pigs-refuse-to-attack-other-pigs-and-guard-pigs-are-falsely-labeled-as-followers/#findComment-1557013 Share on other sites More sharing options...
Garamonde Posted April 13, 2022 Author Share Posted April 13, 2022 Everything regarding this works now! Thank you so much for your help, I've added your name to the credits of my mod along with everyone else who's helped me. 1 Link to comment https://forums.kleientertainment.com/forums/topic/138431-solved-befriended-pigs-refuse-to-attack-other-pigs-and-guard-pigs-are-falsely-labeled-as-followers/#findComment-1557403 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