Sign in to follow this  
EulenMarie

Ice King - The king of iiiiiiiiiice

Recommended Posts

DarkXero    2892

@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

Share this post


Link to post
Share on other sites
EulenMarie    200

 

@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!!!

Share this post


Link to post
Share on other sites
EulenMarie    200

i4krnwcgr4d.jpg

 

Something went wrong. Did I add it in the wrong line?

 

 

 

Oh, and how I change the lua that he drain sanity at day?

And how to change it that he can't use the ice fingers without wearing the crown?

 

sorry for so much questions.

iceking.lua

Edited by EulenMarie

Share this post


Link to post
Share on other sites
EulenMarie    200

@EulenMarie:

What I posted goes all in modmain.lua.

 

I 've been thinking about the character .

it makes more sense when the crown gains live and drain sanity.

and that he gets health near females and  females lose sanity.

would you help me?

Share this post


Link to post
Share on other sites
DarkXero    2892

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

icecrown.lua

Share this post


Link to post
Share on other sites
EulenMarie    200

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

Share this post


Link to post
Share on other sites
EulenMarie    200

He gets both health and sanity or only health?

 

sanity and heatlh near females :-)

but females only lose sanity.

 

sanity near pengulls.

 

that is it I think

Edited by EulenMarie

Share this post


Link to post
Share on other sites
DarkXero    2892

@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

Share this post


Link to post
Share on other sites
EulenMarie    200

 

@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

Share this post


Link to post
Share on other sites
EulenMarie    200

Another idea is, that the crown is only for ice king unbreakable.

Use other peoples the crown, they will break fast. (prevents the crowns lying around)

Share this post


Link to post
Share on other sites
DarkXero    2892

@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

Share this post


Link to post
Share on other sites
EulenMarie    200

 

@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 :)

Share this post


Link to post
Share on other sites
EulenMarie    200

Test  with Ice King, Wilson, Pengulls (ice king enable) = crash

Test with Elsa, Wilson, Pengulls (ice king disable) = no crash

Test with Wigfrid, Pengulls (ice king enable) = crash

 

it is the ice king :(

Edited by EulenMarie

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