Sign in to follow this  
Tesumoto

Please help with the editing of the character

Recommended Posts

Lumina    2151
inst.components.eater:SetCanEatRaw()

As far as i know, this line is used only by bunnymen, gobbler and pigman, and allow them to eat food on the floor that is raw. Not sure that a character need it in any way.

Share this post


Link to post
Share on other sites
Tesumoto    19

I want add health regeneration the character?
There is option
(inst.components) or need a code?
I need health regeneration 1 hp / 4.8 sec

Edited by Tezumoto

Share this post


Link to post
Share on other sites
--- -.-    4028
2 minutes ago, Tezumoto said:

I want add health regeneration the character?
There is option or need a code?
I need health regeneration 1 hp / 4.8 sec

How much's the character's max hp?

Share this post


Link to post
Share on other sites
--- -.-    4028

This should work, I think :)

inst:DoPeriodicTask(4.8, function()
	if inst.components.health.current >= 199 then
	return
	end
	inst.components.health:DoDelta(1)
	end)

@Tezumoto If you didn't see this then use the new code.

Edited by SuperDavid

Share this post


Link to post
Share on other sites
Tesumoto    19
1 minute ago, SuperDavid said:

This should work, I think :)


inst:DoPeriodicTask(4.8, function()
	if inst.components.health.current >= 199 then
	return
	end
	inst.components.health:DoDelta(1)
	end)

@Tezumoto If you don't see this then use the new code.

This code need add modmain.lua?

Share this post


Link to post
Share on other sites
Tesumoto    19
17 minutes ago, SuperDavid said:

This should work, I think :)


inst:DoPeriodicTask(4.8, function()
	if inst.components.health.current >= 199 then
	return
	end
	inst.components.health:DoDelta(1)
	end)

@Tezumoto If you didn't see this then use the new code.

I see "the server is stopped".
But if this character has disabled everything is working.
And if I remove the health regeneration, works without problems)

Edited by Tezumoto

Share this post


Link to post
Share on other sites
--- -.-    4028
38 minutes ago, Tezumoto said:

I see "the server is stopped".
But if this character has disabled everything is working.
And if I remove the health regeneration, works without problems)

I'm sorry about that kinda tired, here this one should work I tested it. Put it in the YOURCHARACTR.lua master_postinit

inst:DoPeriodicTask(4.8, function()
   if inst.components.health and inst.components.health.currenthealth <= 200 and not inst.components.health:IsDead() then
      inst.components.health:DoDelta(1)
   else
      return
   end
end)

 

Share this post


Link to post
Share on other sites
Tesumoto    19
8 minutes ago, SuperDavid said:

I'm sorry about that kinda tired, here this one should work I tested it. Put it in the YOURCHARACTR.lua master_postinit


inst:DoPeriodicTask(4.8, function()
   if inst.components.health and inst.components.health.currenthealth <= 200 and not inst.components.health:IsDead() then
      inst.components.health:DoDelta(1)
   else
      return
   end
end)

 

Thank, I check this later)

Share this post


Link to post
Share on other sites
Tesumoto    19
27 minutes ago, SuperDavid said:

inst:DoPeriodicTask(4.8, function()
   if inst.components.health and inst.components.health.currenthealth <= 200 and not inst.components.health:IsDead() then
      inst.components.health:DoDelta(1)
   else
      return
   end
end)

 

This code works fine)
Thank you for help)

Share this post


Link to post
Share on other sites
Tesumoto    19
34 minutes ago, SuperDavid said:

I'm sorry about that kinda tired, here this one should work I tested it. Put it in the YOURCHARACTR.lua master_postinit

And I can get health begins to recover with 100 to 150?)
Or is it too hard?

Share this post


Link to post
Share on other sites
Tesumoto    19
8 minutes ago, SuperDavid said:

You want health to heal when over 100 points but below 150 points?


inst:DoPeriodicTask(4.8, function()
   if inst.components.health and inst.components.health.currenthealth >= 100 and inst.components.health.currenthealth <= 150 and not inst.components.health:IsDead() then
      inst.components.health:DoDelta(1)
   else
      return
   end
end)

 

Less than 100 when the regeneration started and stopped at 150)

Edited by Tezumoto

Share this post


Link to post
Share on other sites
--- -.-    4028
1 hour ago, Tezumoto said:

Less than 100 when the regeneration started and stopped at 150)

inst:DoPeriodicTask(4.8, function()
   if inst.components.health and inst.components.health.currenthealth <= 150 and not inst.components.health:IsDead() then
      inst.components.health:DoDelta(1)
   else
      return
   end
end)

 

28 minutes ago, Tezumoto said:

Or it will be last added health when exactly 150.

@Tezumoto I think it'll go to 149 then go to 150 & stop adding, but test it to make sure if you want :).

Edited by SuperDavid

Share this post


Link to post
Share on other sites
Tesumoto    19
1 hour ago, SuperDavid said:

inst:DoPeriodicTask(4.8, function()
   if inst.components.health and inst.components.health.currenthealth <= 150 and not inst.components.health:IsDead() then
      inst.components.health:DoDelta(1)
   else
      return
   end
end)

 

but need fix

	inst.components.health and inst.components.health.currenthealth <= 149 and not inst.components.health:IsDead() then

Or it will be last added health when exactly 150.

Edited by Tezumoto

Share this post


Link to post
Share on other sites
--- -.-    4028
10 minutes ago, Tezumoto said:

I want to have my character's sanity was restored when it is next to Science Machine and Alchemy Engine (sanity: +1.3/min).
Help me with this please.

Put this code in your character's "modmain.lua", I think it would work :)!

Spoiler

if GLOBAL.TheNet:GetIsServer() then

	AddPrefabPostInit("researchlab", function(inst)
		inst:AddComponent("sanityaura")
		inst.components.sanityaura.aura = 0
	end)
	
	AddPrefabPostInit("researchlab2", function(inst)
		inst:AddComponent("sanityaura")
		inst.components.sanityaura.aura = 0
	end)
	
	AddComponentPostInit("sanityaura", function(self)
		local old = self.GetAura 
		function self:GetAura(observer) 
			if observer.prefab == "YOURCHARACTERNAMEHERE" and self.inst.prefab == "researchlab" or self.inst.prefab == "researchlab2" then 
				return 5 -- Play around with this number to get the sanity bonus you like
			end
			return old(self,observer) 
		end
	end)			

end

 

 

Share this post


Link to post
Share on other sites
Tesumoto    19
8 minutes ago, SuperDavid said:

Put this code in your character's "modmain.lua", I think it would work :)!

Thank you very much, this code works!
But, I can reduce the range of this effect?

Share this post


Link to post
Share on other sites
--- -.-    4028
Just now, Tezumoto said:

Thank you very much, this code works!
But, I can reduce the range of this effect?

I wouldn't know how to do that, unfortunately :(...

Share this post


Link to post
Share on other sites
Tesumoto    19
Just now, SuperDavid said:

I wouldn't know how to do that, unfortunately :(...

And yet too quickly restores sanity.
Although I change the number 5 to number 1.3
I need  (sanity: +1.3/min) .-.

Share this post


Link to post
Share on other sites
--- -.-    4028
1 minute ago, Tezumoto said:

And yet too quickly restores sanity.

Change the number to something very small like ".01", ".1", ".25" ect. then go up from there :)!

Edited by SuperDavid

Share this post


Link to post
Share on other sites
Tesumoto    19
2 minutes ago, SuperDavid said:

Change the number to something very small like ".01" then go up from there :)!

And I can set the parameter (Garland * 1)?
Garland - Wreath
If it can, then how to do it?

Edited by Tezumoto

Share this post


Link to post
Share on other sites
--- -.-    4028
Just now, Tezumoto said:

And I can set the parameter (Garland * 1)?
If it can, then how to do it?

The easiest way to do it is just put a number, at least that's what I would do.. Because I don't really know how to do the exact same as garland or stuff like that..sorry, I'm not very amazing at coding...

Share this post


Link to post
Share on other sites
Tesumoto    19
4 minutes ago, SuperDavid said:

The easiest way to do it is just put a number, at least that's what I would do.. Because I don't really know how to do the exact same as garland or stuff like that..sorry, I'm not very amazing at coding...

Well, I'm glad that the code works =)

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
Sign in to follow this