Jump to content

[Solved] Need help with changing the stats in the full moon phrase.


Recommended Posts

Hi all,

I'm just starting out with making mods, and this is my first one, so please bear with my inexperience. 

I tried to create a vampire-like custom character who grows stronger at night and can transform into a monster during the full moon phrase.(still making his monster form sprites tho) I'm able to change other stats like health, sanity, and attack damage thanks to this community. However, I'm not sure why it didn't trigger the changes for the full moon phrase.

I'm using if phase == "night" then

if TheWorld.state.isfullmoon then <<

But it's not working T T. Could you please tell me what the problem could be? I would be appreciate.

attached  the code! here

-- stat/apperance differences night/day
local function updatestats(inst, phase)
if 		inst:HasTag("playerghost") or
		inst.components.health:IsDead() then
          return
end
		if phase == "night" then
			if TheWorld.state.isfullmoon then
		
		inst.components.talker:Say ("The moon shall grant me more power")
		inst.components.locomotor.runspeed = 2 * TUNING.WILSON_RUN_SPEED
		inst.components.health.absorb = 1.2
		inst.components.combat.damagemultiplier = 3
		inst.components.hunger.hungerrate = 1.1 * TUNING.WILSON_HUNGER_RATE
		inst.nightregen = inst:DoPeriodicTask(2, function()--2 seconds to do the below function
				if not inst.components.health:IsDead() then
				inst.components.health:DoDelta(6, true, "regen")--heal 1hp
				end
				end)
				if inst.duskregen then
			inst.duskregen:Cancel()
			inst.duskregen = nil
				end
		
			else
		
		inst.components.locomotor.runspeed = 1.8 * TUNING.WILSON_RUN_SPEED
		inst.components.health.absorb = 0.6
		inst.components.combat.damagemultiplier = 1.5
		inst.components.hunger.hungerrate = 1.1 * TUNING.WILSON_HUNGER_RATE
		inst.nightregen = inst:DoPeriodicTask(2, function()--2 seconds to do the below function
				if not inst.components.health:IsDead() then
				inst.components.health:DoDelta(3, true, "regen")--heal 1hp
				end
				end)
				if inst.duskregen then
			inst.duskregen:Cancel()
			inst.duskregen = nil
				end
			end
			
		
	elseif phase == "dusk" then
		inst.components.locomotor.runspeed = 1.3 * TUNING.WILSON_RUN_SPEED
		inst.components.health.absorb = 0.4
		inst.components.combat.damagemultiplier = 1.2
		inst.components.hunger.hungerrate = 1.1 * TUNING.WILSON_HUNGER_RATE
		inst.duskregen = inst:DoPeriodicTask(4, function()--4 seconds to do the below function
			if not inst.components.health:IsDead() then
				inst.components.health:DoDelta(1, true, "regen")--heal 1hp
			end
		end)
		if inst.daydamage then
			inst.daydamage:Cancel()
			inst.daydamage = nil
		end

	elseif phase == "day" then
		inst.components.locomotor.runspeed = 1.0 * TUNING.WILSON_RUN_SPEED
		inst.components.health.absorb = 0.2
		inst.components.combat.damagemultiplier = 0.9
		inst.components.hunger.hungerrate = 0.8 * TUNING.WILSON_HUNGER_RATE
		if inst.nightregen then
			inst.nightregen:Cancel()
			inst.nightregen = nil
		end
		inst.daydamage = inst:DoPeriodicTask(3, function()--3 seconds to do the below function
			if not inst.components.health:IsDead() then
				inst.components.health:DoDelta(-3, true, "regen")--damage hp
			end
		end)
		
	end
	end

 

Edited by rainbuni
it's got solved :)
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...