Jump to content

Recommended Posts

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 by Garamonde

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 by Garamonde
Found another bug.

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?

  • Like 1

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 by Garamonde

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.

  • Thanks 1

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...