Jump to content

Please help with the editing of the character


Recommended Posts

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

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)

 

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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

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

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

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

 

 

Link to comment
Share on other sites

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

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

Link to comment
Share on other sites

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 =)

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