Jump to content

Insulation and Sanity help?


Recommended Posts

EDIT: I figured out the insanity aura! I just dug around in Wolfgang's prefab file and found what I needed!

 

So, I'm making my first mod (yay!) and I've got almost all the technical stuff out of the way (base stats, starting inventory, custom dialog, etc.)! The only thing I need to do is figure out the perks. What I wanted to add was a slight resistance to freezing and slightly increased susceptibility to overheating (basically, the character's always wearing a big heavy sweater), sanity bonus from garlands and picking flowers, making the "radius of detection" (for lack of a better term- basically they have to get closer to mobs before they're noticed) and causing the character to have an increased sanity loss from monsters. I'm more concerned with the temperature and detection, as I can probably dig around in the code to find what I need for the other two, though any help is appreciated!

Edited by poppychips
Link to comment
Share on other sites

 I have a character mod with temperature related perks. Here's a segment of code here that should help you out:

    inst.components.temperature.overheattemp = 70 (base for all characters, in game celcius)
    inst.components.temperature.hurtrate =  (how quickly temperature hurts them)
    inst.components.temperature.inherentinsulation = 
    inst.components.temperature.summerinsulation = 

 

I think freezing is .freezetemp but I'm not sure

Edited by mf99k
Link to comment
Share on other sites

I made a code for someone before that wanted to be able to get closer to monsters & small animals without getting detected. I think it still works, I hope you like it :)!

Spoiler

inst:DoPeriodicTask(0.1, function()
	local CAN_ATTACK =
	{
		CHOP = false,
		DIG = false,
		HAMMER = false,
		MINE = false,
		ATTACK = true,
	}

	local ATTACK_TAGS = {"_combat"}

	for k, v in pairs(CAN_ATTACK) do
		table.insert(ATTACK_TAGS, k.."_workable")
	end

	local NON_ATTACK_TAGS = {"INLIMBO", "playerghost"}

	local x, y, z = inst.Transform:GetWorldPosition()
	local ents = TheSim:FindEntities(x, y, z, 2, nil, NON_ATTACK_TAGS, ATTACK_TAGS) -- You can change "2" to whatever number your want, the smaller it is the closer you have to be for them to detect you.
	
   for i, v in ipairs(ents) do
      if not v:HasTag("player") and not v:HasTag("shadow") and not v:HasTag("shadowminion") and not v:HasTag("shadowchesspiece") and v.components.health and not v.components.health:IsDead() and inst.components.health and not inst.components.health:IsDead() then -- No hiding from nightmare creatures, mwuhahaha!
         inst:RemoveTag("notarget")
	     inst:AddTag("scarytoprey")
	  else
		 inst:AddTag("notarget")
		 inst:RemoveTag("scarytoprey")
      end
   end 
end)

Edit: Put it in YOURCHARACTER.lua inside the master_postinit

Edited by SuperDavid
Link to comment
Share on other sites

13 hours ago, SuperDavid said:

I made a code for someone before that wanted to be able to get closer to monsters & small animals without getting detected. I think it still works, I hope you like it :)!

  Hide contents


inst:DoPeriodicTask(0.1, function()
	local CAN_ATTACK =
	{
		CHOP = false,
		DIG = false,
		HAMMER = false,
		MINE = false,
		ATTACK = true,
	}

	local ATTACK_TAGS = {"_combat"}

	for k, v in pairs(CAN_ATTACK) do
		table.insert(ATTACK_TAGS, k.."_workable")
	end

	local NON_ATTACK_TAGS = {"INLIMBO", "playerghost"}

	local x, y, z = inst.Transform:GetWorldPosition()
	local ents = TheSim:FindEntities(x, y, z, 2, nil, NON_ATTACK_TAGS, ATTACK_TAGS) -- You can change "2" to whatever number your want, the smaller it is the closer you have to be for them to detect you.
	
   for i, v in ipairs(ents) do
      if not v:HasTag("player") and not v:HasTag("shadow") and not v:HasTag("shadowminion") and not v:HasTag("shadowchesspiece") and v.components.health and not v.components.health:IsDead() and inst.components.health and not inst.components.health:IsDead() then -- No hiding from nightmare creatures, mwuhahaha!
         inst:RemoveTag("notarget")
	     inst:AddTag("scarytoprey")
	  else
		 inst:AddTag("notarget")
		 inst:RemoveTag("scarytoprey")
      end
   end 
end)

Edit: Put it in YOURCHARACTER.lua inside the master_postinit

Thanks for the help!

Link to comment
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
 Share

×
  • Create New...