Jump to content

Ice King - The king of iiiiiiiiiice


Recommended Posts

@EulenMarie:

local function IcySanity(inst)	if not GLOBAL.TheWorld.ismastersim then		return	end	if inst.prefab == "iceking" then		inst:AddComponent("sanityaura")		local function LadyDrainer(inst, observer)			local obs_gender = GLOBAL.GetGenderStrings(observer.prefab)			if obs_gender == "FEMALE" then				return -GLOBAL.TUNING.SANITYAURA_HUGE			end			return 0		end		inst.components.sanityaura.aurafn = LadyDrainer	else		local inst_gender = GLOBAL.GetGenderStrings(inst.prefab)		if inst_gender == "FEMALE" then			if not inst.components.sanityaura then				inst:AddComponent("sanityaura")			end			local old_aura = inst.components.sanityaura.aurafn			local NewAura			if old_aura then				NewAura = function(inst, observer)					local ret = old_aura(inst, observer)					if observer.prefab == "iceking" then						return ret + GLOBAL.TUNING.SANITYAURA_MED					end					return ret				end			else				NewAura = function(inst, observer)					if observer.prefab == "iceking" then						return GLOBAL.TUNING.SANITYAURA_MED					end				end			end			inst.components.sanityaura.aurafn = NewAura		end	endendlocal function BeakyLove(inst)	if not GLOBAL.TheWorld.ismastersim then		return	end	if not inst.components.sanityaura then		inst:AddComponent("sanityaura")	end	local old_aura = inst.components.sanityaura.aurafn	local NewAura	if old_aura then		NewAura = function(inst, observer)			local ret = old_aura(inst, observer)			if observer.prefab == "iceking" then				return ret + GLOBAL.TUNING.SANITYAURA_SMALL_TINY			end			return ret		end	else		NewAura = function(inst, observer)			if observer.prefab == "iceking" then				return GLOBAL.TUNING.SANITYAURA_SMALL_TINY			end		end	end	inst.components.sanityaura.aurafn = NewAuraendAddPlayerPostInit(IcySanity)AddPrefabPostInit("penguin", BeakyLove)
  • Like 1
Link to comment
Share on other sites

 

@EulenMarie:

local function IcySanity(inst)	if not GLOBAL.TheWorld.ismastersim then		return	end	if inst.prefab == "iceking" then		inst:AddComponent("sanityaura")		local function LadyDrainer(inst, observer)			local obs_gender = GLOBAL.GetGenderStrings(observer.prefab)			if obs_gender == "FEMALE" then				return -GLOBAL.TUNING.SANITYAURA_HUGE			end			return 0		end		inst.components.sanityaura.aurafn = LadyDrainer	else		local inst_gender = GLOBAL.GetGenderStrings(inst.prefab)		if inst_gender == "FEMALE" then			if not inst.components.sanityaura then				inst:AddComponent("sanityaura")			end			local old_aura = inst.components.sanityaura.aurafn			local NewAura			if old_aura then				NewAura = function(inst, observer)					local ret = old_aura(inst, observer)					if observer.prefab == "iceking" then						return ret + GLOBAL.TUNING.SANITYAURA_MED					end					return ret				end			else				NewAura = function(inst, observer)					if observer.prefab == "iceking" then						return GLOBAL.TUNING.SANITYAURA_MED					end				end			end			inst.components.sanityaura.aurafn = NewAura		end	endendlocal function BeakyLove(inst)	if not GLOBAL.TheWorld.ismastersim then		return	end	if not inst.components.sanityaura then		inst:AddComponent("sanityaura")	end	local old_aura = inst.components.sanityaura.aurafn	local NewAura	if old_aura then		NewAura = function(inst, observer)			local ret = old_aura(inst, observer)			if observer.prefab == "iceking" then				return ret + GLOBAL.TUNING.SANITYAURA_SMALL_TINY			end			return ret		end	else		NewAura = function(inst, observer)			if observer.prefab == "iceking" then				return GLOBAL.TUNING.SANITYAURA_SMALL_TINY			end		end	end	inst.components.sanityaura.aurafn = NewAuraendAddPlayerPostInit(IcySanity)AddPrefabPostInit("penguin", BeakyLove)

 

Wooow thank you!!!

Link to comment
Share on other sites

@EulenMarie, the crown crashes because the task keeps running when you unequip it and drop it.

 

inst.components.inventoryitem is never nil, and owner is nil when it's on the ground.

And you tried to index the components to a nil value, thus crash.

 

nice to know, thx a lot!

 

but now it doesn't work. no sanity drain and gain health.

Link to comment
Share on other sites

@EulenMarie,

        local inst_gender = GLOBAL.GetGenderStrings(inst.prefab)         if inst_gender == "FEMALE" then            if not inst.components.sanityaura then                inst:AddComponent("sanityaura")            end             local old_aura = inst.components.sanityaura.aurafn            local NewAura             if old_aura then                NewAura = function(inst, observer)                    local ret = old_aura(inst, observer)                    if observer.prefab == "iceking" then						observer.components.health:DoDelta(0.5, true, "Love") -- Here                        return ret + GLOBAL.TUNING.SANITYAURA_MED                    end                    return ret                end            else                NewAura = function(inst, observer)                    if observer.prefab == "iceking" then						observer.components.health:DoDelta(0.5, true, "Love") -- And here                        return GLOBAL.TUNING.SANITYAURA_MED                    end                end            end             inst.components.sanityaura.aurafn = NewAura        end
Link to comment
Share on other sites

 

@EulenMarie,

        local inst_gender = GLOBAL.GetGenderStrings(inst.prefab)         if inst_gender == "FEMALE" then            if not inst.components.sanityaura then                inst:AddComponent("sanityaura")            end             local old_aura = inst.components.sanityaura.aurafn            local NewAura             if old_aura then                NewAura = function(inst, observer)                    local ret = old_aura(inst, observer)                    if observer.prefab == "iceking" then						observer.components.health:DoDelta(0.5, true, "Love") -- Here                        return ret + GLOBAL.TUNING.SANITYAURA_MED                    end                    return ret                end            else                NewAura = function(inst, observer)                    if observer.prefab == "iceking" then						observer.components.health:DoDelta(0.5, true, "Love") -- And here                        return GLOBAL.TUNING.SANITYAURA_MED                    end                end            end             inst.components.sanityaura.aurafn = NewAura        end

 

@DarkXero,

Sorry, in which line? Replace?

modmain.lua

Edited by EulenMarie
Link to comment
Share on other sites

@EulenMarie:

 

Replace

	inst:AddComponent("armor")	inst.components.armor:InitCondition(10000000000, 0.5)

for

	inst:AddComponent("armor")	inst.components.armor:InitCondition(20, 0.5)	local old_TakeDamage = inst.components.armor.TakeDamage	inst.components.armor.TakeDamage = function(self, damage_amount)		local owner = self.inst.components.inventoryitem.owner		if owner and owner.prefab == "iceking" then			damage_amount = 0		end		old_TakeDamage(self, damage_amount)	end
Link to comment
Share on other sites

 

@EulenMarie:

 

Replace

	inst:AddComponent("armor")	inst.components.armor:InitCondition(10000000000, 0.5)

for

	inst:AddComponent("armor")	inst.components.armor:InitCondition(20, 0.5)	local old_TakeDamage = inst.components.armor.TakeDamage	inst.components.armor.TakeDamage = function(self, damage_amount)		local owner = self.inst.components.inventoryitem.owner		if owner and owner.prefab == "iceking" then			damage_amount = 0		end		old_TakeDamage(self, damage_amount)	end

 

Thank you, I'll try it soon :)

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