Jump to content

Recommended Posts

MUbldAy.png

 

Hello! I'm Toxictester, a not-that new modder (i made my first mod at the beginning of this year i think :p).

I was wondering if I could get some help on coding some of the Plague Doctor's abilities?

 

ABILITIES (also listed in above picture):

  • x1.5 sanity drain
  • More health gain from healing items
  • More sanity gain from crockpot foods
  • Sanity gain from killing monsters
  • Death at 0 sanity
  • Uses poison damage (inflicts damage over a period of time)
  • Telltale hearts cost less health

 

I'm sure I can find code for the x1.5 sanity drain, poison damage, and extra sanity from killing monsters. So can anyone lend me a hand towards her other abilities (extra sanity gain from crockpot, more health from healing items, death at 0 sanity, telltale hearts costing less)?

Any help would be greatly appreciated  :D !

When you say "more health gain from healing items" do you mean "heal" items like spider gland or foods that give health like fish sticks?

as for some others:

 

"More sanity gain from crockpot foods":

--in ur character.lua
local function oneat(eater, food)
	local fooditem = food.prefab
	local crockpotfoods = require("preparedfoods")
	
	if table.containskey(crockpotfoods, fooditem) and eater.components.sanity then --if its a crockpot food
		eater.components.sanity:DoDelta(20)--change 20 to whatever you want
	end
	
end

-- in ur characters master_postinit function
inst.components.eater:SetOnEatFn(oneat)

 

"Death at 0 sanity":

--in ur character.lua

-- in ur characters master_postinit function
inst:ListenForEvent("sanitydelta", function(inst, data) 
	if data.newpercent == 0 then 
		inst.components.health:Kill() 
	end
end)

 

Edited by Aquaterion
--in modmain.lua
AddComponentPostInit("healer", function(self)
	local oldheal = self.Heal
	function self:Heal(target)
		if target.components.health then
			target:PushEvent("consumehealer", {healer = self.inst.prefab, healing = self.health})
			oldheal(self, target)
		end
	end
end)

--in ur character.lua

-- in ur characters master_postinit function
inst:ListenForEvent("consumehealer", function(inst, data) 
	inst.components.health:DoDelta(data.healing*0.25)-- +25% extra from normal amount
end)

haven't tried it but should work

Edited by Aquaterion
edited to the working version

did you add the first part to modmain.lua?

if so, try changing

target:PushEvent("consumehealer", self.inst.prefab, self.health)
--to
target:PushEvent("consumehealer", self.inst.prefab, self.inst.components.healer.health)

 

Edited by Aquaterion

1YZl4kM.jpg

Yeah, it still doesn't seem to be working :/

Wouldn't the issue be in the character.lua? Or at least that's what the game's warning message is pointing at

inst:ListenForEvent("consumehealer", function(inst, healer, amount) 
	inst.components.health:DoDelta(amount*0.25)-- +25% extra from normal amount
end)

 

Here's my script btw:

LA6FYyb.png

ok so this should work

target:PushEvent("consumehealer", self.inst.prefab, self.health)
--to
target:PushEvent("consumehealer", {healer = self.inst.prefab, healing = self.health})

and

inst:ListenForEvent("consumehealer", function(inst, healer, amount) 
	inst.components.health:DoDelta(amount*0.25)-- +25% extra from normal amount
end)

--to

inst:ListenForEvent("consumehealer", function(inst, data) 
	inst.components.health:DoDelta(data.healing*0.25)-- +25% extra from normal amount
end)

 

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...