Jump to content

Help with Angry Citizens!!


Recommended Posts

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

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...