Bad Willow

Help with Angry Citizens!!

Recommended Posts

Bad Willow    26

This happens so frequently to me and I am trying desperately to make a fix for it! I abduct usher pigs and keep them in the back room of my shanty, and when I accidentally attack one, they all run from me. I tried using the one man band but after they are no longer followers they still run from me! I give them oincs but its no use. I went over the pigman_city prefab file and saw that there are two separate tags: the angry_at_player tag which allows you to bribe pigs, and the guards_called tag. I checked whether the usher pigs have these tags and saw that they have neither. Does anyone know what is making these pigs run from you in the code, and what is the correct way to pacify them?

Okay I have discovered that when they run away from you it's because you are actually the target of their combat component. So something like this would fix it:

	inst:ListenForEvent("newcombattarget", function()
		if inst.components.combat.target ~= _G.GetPlayer() then return end 
		inst:DoTaskInTime(0, function()
			if inst:HasTag"angry_at_player" then return end
			inst:AddTag"angry_at_player"
			print("manually adding the angry_at_player tag since targetting player", inst.name, inst.prefab)
		end)
	end)

https://steamcommunity.com/sharedfiles/filedetails/?id=2632450951

Edited by Bad Willow

Share this post


Link to post
Share on other sites

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