Jump to content

Problem with some code

Recommended Posts

So I've been working on a mod for my character yohir and I want him to become stronger while insane and weaker while sane.

another thing i had in mind is that he has a 5% chance on getting nightmare fuel when he kills certain mobs.

So this is the code i already have and well it doesn't work, not in the terms of it crashing the game or anything like that it simply doesn't work.

I've killed over 100 spider and no nightmare fuel and the sanity change thing doesn't seem to work aswell.

local master_postinit = function(inst)	inst.soundsname = "maxwell"	inst.components.health:SetMaxHealth(100)	inst.components.hunger:SetMax(150)	inst.components.sanity:SetMax(90)    inst.components.eater.strongstomach = true    inst.components.combat.damagemultiplier = 0.75    inst.components.sanity.night_drain_mult = -1    inst.components.sanity.neg_aura_mult = -1    inst.components.sanity.rain_drain_mult = -4    inst.components.eater.ignoresspoilage = true    inst.OnLoad = onload    inst.OnNewSpawn = onloadend local function statchangestatus(inst)    if inst.strength == "wimpy" then        inst.components.locomotor.walkspeed = 4        inst.components.locomotor.runspeed = 6        inst.components.combat.damagemultiplier = 0.75    elseif inst.strength == "normal" then        inst.components.locomotor.walkspeed = 5        inst.components.locomotor.runspeed = 7        inst.components.combat.damagemultiplier = 1.5    elseif inst.strength == "mighty" then        inst.components.locomotor.walkspeed = 7        inst.components.locomotor.runspeed = 10        inst.components.combat.damagemultiplier = 6.66         endend local function onsanitychange(inst, data)     if inst.strength == "mighty" then        if inst.components.sanity.current > 20 then                         inst.strength = "normal"            inst.components.talker:Say("My Friends seem to leave the party.")         end    elseif inst.strength == "wimpy" then        if inst.components.sanity.current < 50 then             inst.strength = "normal"            inst.components.talker:Say("I start hearing strange voices in my head.")         end    else        if inst.components.sanity.current < 20 then            inst.strength = "mighty"            inst.components.talker:Say("My Friends have joined the slaughter!")          elseif inst.components.sanity.current > 50 then            inst.strength = "wimpy"            inst.components.talker:Say("No voices, no fun.")         end    end              statchangestatus (inst)endfunction YohirLootPostInit( inst )  if GLOBAL.GetPlayer().prefab == "Yohir" then    inst.components.lootdropper:AddChanceLoot("nightmarefuel", .05)    AddPrefabPostInit("bat", YohirLootPostInit)    AddPrefabPostInit("crawlinghorror", YohirLootPostInit)    AddPrefabPostInit("crawlingnightmare", YohirLootPostInit)    AddPrefabPostInit("knight", YohirLootPostInit)    AddPrefabPostInit("bishop", YohirLootPostInit)    AddPrefabPostInit("rook", YohirLootPostInit)    AddPrefabPostInit("hound", YohirLootPostInit)    AddPrefabPostInit("spider", YohirLootPostInit)    AddPrefabPostInit("spider_warrior", YohirLootPostInit)    AddPrefabPostInit("spiderqueen", YohirLootPostInit)    AddPrefabPostInit("spider_spitter", YohirLootPostInit)    AddPrefabPostInit("tentacles", YohirLootPostInit)    AddPrefabPostInit("leif", YohirLootPostInit)    AddPrefabPostInit("warg", YohirLootPostInit)    AddPrefabPostInit("minotaur", YohirLootPostInit)    AddPrefabPostInit("bearger", YohirLootPostInit)    AddPrefabPostInit("tallbird", YohirLootPostInit)    AddPrefabPostInit("ghost", YohirLootPostInit)    AddPrefabPostInit("spider_dropper", YohirLootPostInit)    AddPrefabPostInit("worm", YohirLootPostInit)    AddPrefabPostInit("deerclops", YohirLootPostInit)    AddPrefabPostInit("frog", YohirLootPostInit)    AddPrefabPostInit("merm", YohirLootPostInit)    AddPrefabPostInit("little_walrus", YohirLootPostInit)  endend

I'll be glad for any help, u can also contact me directly via adding me on steam if u need more infos etc.: http://steamcommunity.com//id/yohir 

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

  • Create New...