Jump to content

Custom character codes just not working


Recommended Posts


local function PowerUpAtNewMoon(inst)
    if TheWorld.state.isnight then
        print("Night test is working.")
        if TheWorld.state.moonphase == "new" then
            print("Night and new moon test is working.")
            inst.components.combat:SetAttackPeriod (0.4)
            inst.components.locomotor.walkspeed = 6
            inst.components.locomotor.runspeed = 10
            inst.Light:Enable(true)
            inst.Light:SetRadius(18)
            inst.Light:SetFalloff(0.75)
            inst.Light:SetIntensity(.7)
            inst.Light:SetColour(70/255,230/255,12/170)
            inst.components.talker:Say("The curse has gone We are finally free! Nya~")
        elseif TheWorld.state.moonphase == "full" then
            print("Night and full moon test is working.")
            inst.components.combat:SetAttackPeriod (0.8)
            inst.components.locomotor.walkspeed = 3.2
            inst.components.locomotor.runspeed = 4
            inst.components.talker:Say("I can feel the curse of moon. The moon binds us! Nya~")
        end

    elseif TheWorld.state.isdusk then
        print("Dusk test is working.")
        if TheWorld.state.moonphase == "new" then
            print("Dusk and new moon test is working.")
            inst.components.combat:SetAttackPeriod (0.4)
            inst.components.locomotor.walkspeed = 6
            inst.components.locomotor.runspeed = 10
            inst.components.talker:Say("I can't feel the moon. Finally i can be free. Nya~")
        elseif TheWorld.state.moonphase == "full" then
            print("Dusk and full moon test is working.")
            inst.components.combat:SetAttackPeriod (0.8)
            inst.components.locomotor.walkspeed = 3.2
            inst.components.locomotor.runspeed = 4
            inst.components.talker:Say("Oh! I can feel the moon. This night will be cursed. Nya~")
        end
        
    elseif TheWorld.state.isday then
        print("Day test is working")
        -- You'll want to set your stats back to normal using this portion, that way the curse only lasts for dusk and night.
    end
end
 

--Put this into Master Postinit

    inst:WatchWorldState("isday", PowerUpAtNewMoon)
    inst:WatchWorldState("isdusk", PowerUpAtNewMoon)
    inst:WatchWorldState("isnight", PowerUpAtNewMoon)
    inst:WatchWorldState("moonphase", PowerUpAtNewMoon)
    

Link to comment
Share on other sites

On 13.02.2017 at 11:46 PM, RedHairedHero said:


local function PowerUpAtNewMoon(inst)
    if TheWorld.state.isnight then
        print("Night test is working.")
        if TheWorld.state.moonphase == "new" then
            print("Night and new moon test is working.")
            inst.components.combat:SetAttackPeriod (0.4)
            inst.components.locomotor.walkspeed = 6
            inst.components.locomotor.runspeed = 10
            inst.Light:Enable(true)
            inst.Light:SetRadius(18)
            inst.Light:SetFalloff(0.75)
            inst.Light:SetIntensity(.7)
            inst.Light:SetColour(70/255,230/255,12/170)
            inst.components.talker:Say("The curse has gone We are finally free! Nya~")
        elseif TheWorld.state.moonphase == "full" then
            print("Night and full moon test is working.")
            inst.components.combat:SetAttackPeriod (0.8)
            inst.components.locomotor.walkspeed = 3.2
            inst.components.locomotor.runspeed = 4
            inst.components.talker:Say("I can feel the curse of moon. The moon binds us! Nya~")
        end

    elseif TheWorld.state.isdusk then
        print("Dusk test is working.")
        if TheWorld.state.moonphase == "new" then
            print("Dusk and new moon test is working.")
            inst.components.combat:SetAttackPeriod (0.4)
            inst.components.locomotor.walkspeed = 6
            inst.components.locomotor.runspeed = 10
            inst.components.talker:Say("I can't feel the moon. Finally i can be free. Nya~")
        elseif TheWorld.state.moonphase == "full" then
            print("Dusk and full moon test is working.")
            inst.components.combat:SetAttackPeriod (0.8)
            inst.components.locomotor.walkspeed = 3.2
            inst.components.locomotor.runspeed = 4
            inst.components.talker:Say("Oh! I can feel the moon. This night will be cursed. Nya~")
        end
        
    elseif TheWorld.state.isday then
        print("Day test is working")
        -- You'll want to set your stats back to normal using this portion, that way the curse only lasts for dusk and night.
    end
end
 

--Put this into Master Postinit

    inst:WatchWorldState("isday", PowerUpAtNewMoon)
    inst:WatchWorldState("isdusk", PowerUpAtNewMoon)
    inst:WatchWorldState("isnight", PowerUpAtNewMoon)
    inst:WatchWorldState("moonphase", PowerUpAtNewMoon)
    

thanks a lot 

Link to comment
Share on other sites

local function levelexp(inst, data)

	local max_exp = 999999999994650
	local level = math.min(inst.level, max_exp)
	
	local health_percent = inst.components.health:GetPercent()
	local sanity_percent = inst.components.sanity:GetPercent()
	local hunger_percent = inst.components.hunger:GetPercent()
	
	--level 0 (start)
if inst.level >0 and inst.level <=10 then
	inst.components.health.maxhealth = math.ceil (50)
	inst.components.hunger.maxhunger = math.ceil (50)
	inst.components.sanity.max = math.ceil (50)
	--level 1
elseif inst.level >10 and inst.level <=20 then
	inst.components.health.maxhealth = math.ceil (55)
	inst.components.hunger.maxhunger = math.ceil (55)
	inst.components.sanity.max = math.ceil (55)
    elseif inst.level >19 and inst.level <=20 then
	inst.components.talker:Say("Level Up! Well done! Level 1. Nya~")
	inst.SoundEmitter:PlaySound("dontstarve/characters/alishia/levelup")
	--level 2
elseif inst.level >20 and inst.level <=30 then
	inst.components.health.maxhealth = math.ceil (60)
	inst.components.hunger.maxhunger = math.ceil (60)
	inst.components.sanity.max = math.ceil (60)
	elseif inst.level >29 and inst.level <=30 then
	inst.components.talker:Say("Level Up! Well done! Level 2. Nya~")
	inst.SoundEmitter:PlaySound("dontstarve/characters/alishia/levelup")
	--level 3
elseif inst.level >30 and inst.level <=60 then
	inst.components.health.maxhealth = math.ceil (65)
	inst.components.hunger.maxhunger = math.ceil (65)
	inst.components.sanity.max = math.ceil (65)
	elseif inst.level >59 and inst.level <=60 then
	inst.components.talker:Say("Level Up! Well done! Level 3. Nya~")
	inst.SoundEmitter:PlaySound("dontstarve/characters/alishia/levelup")
	--level 4
elseif inst.level >60 and inst.level <=100 then
	inst.components.health.maxhealth = math.ceil (70)
	inst.components.hunger.maxhunger = math.ceil (70)
	inst.components.sanity.max = math.ceil (70)
	elseif inst.level >99 and inst.level <=100 then
	inst.components.talker:Say("Level Up! Well done! Level 4. Nya~")
	inst.SoundEmitter:PlaySound("dontstarve/characters/alishia/levelup")
	--level 5
elseif inst.level >100 and inst.level <=150 then
	inst.components.health.maxhealth = math.ceil (75)
	inst.components.hunger.maxhunger = math.ceil (75)
	inst.components.sanity.max = math.ceil (75)
	elseif inst.level >149 and inst.level <=150 then
	inst.components.talker:Say("Level Up! Well done! Level 5. Nya~")
	inst.SoundEmitter:PlaySound("dontstarve/characters/alishia/levelup")
	--level 6
elseif inst.level >150 and inst.level <=210 then
	inst.components.health.maxhealth = math.ceil (80)
	inst.components.hunger.maxhunger = math.ceil (80)
	inst.components.sanity.max = math.ceil (80)
	elseif inst.level >219 and inst.level <=210 then
	inst.components.talker:Say("Level Up! Well done! Level 6. Nya~")
	inst.SoundEmitter:PlaySound("dontstarve/characters/alishia/levelup")
	--level 7
elseif inst.level >210 and inst.level <=280 then
	inst.components.health.maxhealth = math.ceil (85)
	inst.components.hunger.maxhunger = math.ceil (85)
	inst.components.sanity.max = math.ceil (85)
	elseif inst.level >279 and inst.level <=280 then
	inst.components.talker:Say("Level Up! Well done! Level 7. Nya~")
	inst.SoundEmitter:PlaySound("dontstarve/characters/alishia/levelup")
	--level 8
elseif inst.level >280 and inst.level <=360 then
	inst.components.health.maxhealth = math.ceil (90)
	inst.components.hunger.maxhunger = math.ceil (90)
	inst.components.sanity.max = math.ceil (90)
	elseif inst.level >359 and inst.level <360 then
	inst.components.talker:Say("Level Up! Well done! Level 8. Nya~")
	inst.SoundEmitter:PlaySound("dontstarve/characters/alishia/levelup")
	--level 9
elseif inst.level >360 and inst.level <=450 then
	inst.components.health.maxhealth = math.ceil (95)
	inst.components.hunger.maxhunger = math.ceil (95)
	inst.components.sanity.max = math.ceil (95)
	elseif inst.level >449 and inst.level <=450 then
	inst.components.talker:Say("Level Up! Well done! Level 9. Nya~")
	inst.SoundEmitter:PlaySound("dontstarve/characters/alishia/levelup")
	--level 10
elseif inst.level >450 and inst.level <=550 then
	inst.components.health.maxhealth = math.ceil (100)
	inst.components.hunger.maxhunger = math.ceil (100)
	inst.components.sanity.max = math.ceil (100)
	elseif inst.level >549 and inst.level <=550 then
	inst.components.talker:Say("Sugoii (Nya~) demo mada aru (Nya~). Level Up 10. Nya~")
	inst.SoundEmitter:PlaySound("dontstarve/characters/alishia/levelup")
	--level 11
elseif inst.level >550 and inst.level <=660 then
	inst.components.health.maxhealth = math.ceil (110)
	inst.components.hunger.maxhunger = math.ceil (110)
	inst.components.sanity.max = math.ceil (110)
	elseif inst.level >659 and inst.level <=660 then
	inst.components.talker:Say("Level Up! Well done! Level 11. Nya~")
	inst.SoundEmitter:PlaySound("dontstarve/characters/alishia/levelup")
	--level 12
elseif inst.level >660 and inst.level <=780 then
	inst.components.health.maxhealth = math.ceil (120)
	inst.components.hunger.maxhunger = math.ceil (120)
	inst.components.sanity.max = math.ceil (120)
	elseif inst.level >779 and inst.level <=780 then
	inst.components.talker:Say("Level Up! Well done! Level 12. Nya~")
	inst.SoundEmitter:PlaySound("dontstarve/characters/alishia/levelup")
	--level 13
elseif inst.level >780 and inst.level <=910 then
	inst.components.health.maxhealth = math.ceil (130)
	inst.components.hunger.maxhunger = math.ceil (130)
	inst.components.sanity.max = math.ceil (130)
	elseif inst.level >909 and inst.level <=910 then
	inst.components.talker:Say("Level Up! Well done! Level 13. Nya~")
	inst.SoundEmitter:PlaySound("dontstarve/characters/alishia/levelup")
	--level 14
elseif inst.level >910 and inst.level <=1050 then
	inst.components.health.maxhealth = math.ceil (140)
	inst.components.hunger.maxhunger = math.ceil (140)
	inst.components.sanity.max = math.ceil (140)
	elseif inst.level >1049 and inst.level <=1050 then
	inst.components.talker:Say("Level Up! Well done! Level 14. Nya~")
	inst.SoundEmitter:PlaySound("dontstarve/characters/alishia/levelup")
	--level 15
elseif inst.level >1050 and inst.level <=1200 then
	inst.components.health.maxhealth = math.ceil (150)
	inst.components.hunger.maxhunger = math.ceil (150)
	inst.components.sanity.max = math.ceil (150)
	elseif inst.level >1199 and inst.level <=1200 then
	inst.components.talker:Say("Level Up! Well done! Level 15. Nya~")
	inst.SoundEmitter:PlaySound("dontstarve/characters/alishia/levelup")
	--level 16
elseif inst.level >1200 and inst.level <=1360 then
	inst.components.health.maxhealth = math.ceil (160)
	inst.components.hunger.maxhunger = math.ceil (150)
	inst.components.sanity.max = math.ceil (160)
	elseif inst.level >1359 and inst.level <=1360 then
	inst.components.talker:Say("Level Up! Well done! Level 16. Nya~")
	inst.SoundEmitter:PlaySound("dontstarve/characters/alishia/levelup")
	--level 17
elseif inst.level >1360 and inst.level <=1530 then
	inst.components.health.maxhealth = math.ceil (170)
	inst.components.hunger.maxhunger = math.ceil (170)
	inst.components.sanity.max = math.ceil (170)
	elseif inst.level >1529 and inst.level <=1530 then
	inst.components.talker:Say("Level Up! Well done! Level 17. Nya~")
	inst.SoundEmitter:PlaySound("dontstarve/characters/alishia/levelup")
	--level 18
elseif inst.level >1530 and inst.level <=1710 then
	inst.components.health.maxhealth = math.ceil (180)
	inst.components.hunger.maxhunger = math.ceil (180)
	inst.components.sanity.max = math.ceil (180)
	elseif inst.level >1709 and inst.level <=1710 then
	inst.components.talker:Say("Level Up! Well done! Level 18. Nya~")
	inst.SoundEmitter:PlaySound("dontstarve/characters/alishia/levelup")
	--level 19
elseif inst.level >1710 and inst.level <1900 then
	inst.components.health.maxhealth = math.ceil (190)
	inst.components.hunger.maxhunger = math.ceil (190)
	inst.components.sanity.max = math.ceil (190)
	elseif inst.level >1899 and inst.level <=1900 then
	inst.components.talker:Say("Level Up! Well done! Level 19. Nya~")
	inst.SoundEmitter:PlaySound("dontstarve/characters/alishia/levelup")
	--level 20
elseif inst.level >1900 and inst.level <=2100 then
	inst.components.health.maxhealth = math.ceil (200)
	inst.components.hunger.maxhunger = math.ceil (200)
	inst.components.sanity.max = math.ceil (200)
	elseif inst.level >2099 and inst.level <=2100 then
	inst.components.talker:Say("We come long way from the start. Level Up 20. Nya~")
	inst.SoundEmitter:PlaySound("dontstarve/characters/alishia/levelup")
	--level 21
elseif inst.level >2100 and inst.level <=2310 then
	inst.components.health.maxhealth = math.ceil (210)
	inst.components.hunger.maxhunger = math.ceil (210)
	inst.components.sanity.max = math.ceil (210)
	elseif inst.level >2309 and inst.level <=2310 then
	inst.components.talker:Say("Level Up! Well done! Level 21. Nya~")
	inst.SoundEmitter:PlaySound("dontstarve/characters/alishia/levelup")
	--level 22
elseif inst.level >2310 and inst.level <=2530 then
	inst.components.health.maxhealth = math.ceil (220)
	inst.components.hunger.maxhunger = math.ceil (220)
	inst.components.sanity.max = math.ceil (220)
	elseif inst.level >2529 and inst.level <=2530 then
	inst.components.talker:Say("Level Up! Well done! Level 22. Nya~")
	inst.SoundEmitter:PlaySound("dontstarve/characters/alishia/levelup")
	--level 23
elseif inst.level >2530 and inst.level <=2760 then
	inst.components.health.maxhealth = math.ceil (230)
	inst.components.hunger.maxhunger = math.ceil (230)
	inst.components.sanity.max = math.ceil (230)
	elseif inst.level >2759 and inst.level <=2760 then
	inst.components.talker:Say("Level Up! Well done! Level 23. Nya~")
	inst.SoundEmitter:PlaySound("dontstarve/characters/alishia/levelup")
	--level 24
elseif inst.level >2760 and inst.level <=3000 then
	inst.components.health.maxhealth = math.ceil (240)
	inst.components.hunger.maxhunger = math.ceil (240)
	inst.components.sanity.max = math.ceil (240)
	elseif inst.level >2999 and inst.level <=3000 then
	inst.components.talker:Say("Level Up! Well done! Level 24. Nya~")
	inst.SoundEmitter:PlaySound("dontstarve/characters/alishia/levelup")
	--level 25
elseif inst.level >3000 and inst.level <=3250 then
	inst.components.health.maxhealth = math.ceil (250)
	inst.components.hunger.maxhunger = math.ceil (250)
	inst.components.sanity.max = math.ceil (250)
	elseif inst.level >3249 and inst.level <=3250 then
	inst.components.talker:Say("Level Up! Well done! Level 25. Nya~")
	inst.SoundEmitter:PlaySound("dontstarve/characters/alishia/levelup")
	--level 26
elseif inst.level >3250 and inst.level <=3510 then
	inst.components.health.maxhealth = math.ceil (260)
	inst.components.hunger.maxhunger = math.ceil (260)
	inst.components.sanity.max = math.ceil (260)
	elseif inst.level >3509 and inst.level <=3510 then
	inst.components.talker:Say("Level Up! Well done! Level 26. Nya~")
	inst.SoundEmitter:PlaySound("dontstarve/characters/alishia/levelup")
	--level 27
elseif inst.level >3510 and inst.level <=3780 then
	inst.components.health.maxhealth = math.ceil (270)
	inst.components.hunger.maxhunger = math.ceil (270)
	inst.components.sanity.max = math.ceil (270)
	elseif inst.level >3779 and inst.level <=3780 then
	inst.components.talker:Say("Level Up! Well done! Level 27. Nya~")
	inst.SoundEmitter:PlaySound("dontstarve/characters/alishia/levelup")
	--level 28
elseif inst.level >3780 and inst.level <=4060 then
	inst.components.health.maxhealth = math.ceil (280)
	inst.components.hunger.maxhunger = math.ceil (280)
	inst.components.sanity.max = math.ceil (280)
	elseif inst.level >4059 and inst.level <=4060 then
	inst.components.talker:Say("Level Up! Well done! Level 28. Nya~")
	inst.SoundEmitter:PlaySound("dontstarve/characters/alishia/levelup")
	--level 29
elseif inst.level >4060 and inst.level <=4350 then
	inst.components.health.maxhealth = math.ceil (290)
	inst.components.hunger.maxhunger = math.ceil (290)
	inst.components.sanity.max = math.ceil (290)
	elseif inst.level >4349 and inst.level <=4350 then
	inst.components.talker:Say("Level Up! Well done! Level 29. Nya~")
	inst.SoundEmitter:PlaySound("dontstarve/characters/alishia/levelup")
	--level 30
elseif inst.level >=4350 and inst.level <=4650 then
	inst.components.health.maxhealth = math.ceil (300)
	inst.components.hunger.maxhunger = math.ceil (300)
	inst.components.sanity.max = math.ceil (300)
	elseif inst.level >4649 and inst.level <=4650 then
inst.components.talker:Say("Yeey! We did it! We reach the ultimate Level. Level Up 30. Nya~")
	inst.SoundEmitter:PlaySound("dontstarve/characters/alishia/levelup")
end

	inst.components.health:SetPercent(health_percent)
	inst.components.hunger:SerPercent(hunger_percent)
	inst.components.sanity:SetPercent(sanity_percent)
end
	
local function onkill(inst, data)

	local victim = data.victim
	
	if (
		victim:HasTag("chester") or
		victim:HasTag("glommer") or
		victim:HasTag("catcoon") or
		victim:HasTag("hutch") or
		victim:HasTag("lavae_pet") 
	) then
	
	inst.level = inst.level - 50
	inst.components.talker:Say("Oh come on! Why i did that? I'm cursed now. Nya~")
end
	
	if (
		victim:HasTag("smallbird") or
		victim:HasTag("babybeefalo") or
		victim:HasTag("toddlerbeefalo") 
	) then
	
	inst.level = inst.level - 10
	inst.components.talker:Say("I feel bad about that. It was so cute. Nya~")
end
	if (
		victim:HasTag("pigman") or
		victim:HasTag("bunnyman") or
		victim:HasTag("rocky") 
	) then
	
	inst.level = inst.level - 5
	inst.components.talker:Say("Should i do that? I mean it feels bad. Nya~")
end
	
	if (
		victim:HasTag("butterfly") or
		victim:HasTag("crow") or
		victim:HasTag("robin") or
		victim:HasTag("robin_winter") or
		victim:HasTag("canary") or
	    victim:HasTag("rabbit") or
		victim:HasTag("mole") or
		victim:HasTag("grassgekko") or
		victim:HasTag("mandrake")
	) then
	
	inst.level = inst.level + 1
	inst.components.talker:Say("I can't be strong enought with that! Nya~")
end
	
	if (
		victim:HasTag("eyeplant") or
		victim:HasTag("bee") or
		victim:HasTag("spider") or
		victim:HasTag("frog") or
		victim:HasTag("batilisk") or
		victim:HasTag("mosquito") or
		victim:HasTag("deer") or
		victim:HasTag("deerantler") or
		victim:HasTag("perd") or
		victim:HasTag("monkey") or
		victim:HasTag("buzzard") or
		victim:HasTag("snurtle") 
	) then
	
	inst.level = inst.level + 2
	inst.components.talker:Say("That'll help to level up. But not much. Nya~")
end
	if (
		victim:HasTag("birchnutdrake") or
		victim:HasTag("killerbee") or
		victim:HasTag("tentacle") or
		victim:HasTag("tentacle_pillar") or
		victim:HasTag("spider_warrior") or
		victim:HasTag("teenbird") or
		victim:HasTag("little_walrus") or
		victim:HasTag("teenbeefalo") or
		victim:HasTag("penguin") or
		victim:HasTag("lightninggoat") or
		victim:HasTag("slurtle") 
	) then
	
	inst.level = inst.level + 3
	inst.components.talker:Say("Yeah, that'll help but i need more. Nya~")
end
	if (
		victim:HasTag("tallbird") or
		victim:HasTag("spider_spitter") or
		victim:HasTag("merm") or
		victim:HasTag("spider_hider") or
		victim:HasTag("spider_dropper") or
		victim:HasTag("pigguard") or
		victim:HasTag("koalefant_summer") or
		victim:HasTag("koalefant_winter") or
		victim:HasTag("beefalo") or
		victim:HasTag("walrus") 
	) then
	
	inst.level = inst.level + 5
	inst.components.talker:Say("Your soul makes me stronger. But still not enought. Nya~")
end
	if (
		victim:HasTag("hound") or
		victim:HasTag("firehound") or
		victim:HasTag("icehound") or
		victim:HasTag("knight") or
		victim:HasTag("rook") or
		victim:HasTag("bishop") or
		victim:HasTag("deer_red") or
		victim:HasTag("deer_blue") or
		victim:HasTag("lavae") or
		victim:HasTag("worm") or
		victim:HasTag("mossling") or
		victim:HasTag("beeguard") 
	) then
	
	inst.level = inst.level + 7
	inst.components.talker:Say("You were strong. And your soul will be stronger with me. Nya~")
end
	if (
		victim:HasTag("bishop_nightmare") or
		victim:HasTag("knight_nightmare") or
		victim:HasTag("rook_nightmare") or
		victim:HasTag("crawlinghorror") or
		victim:HasTag("crawlingnightmare") or
		victim:HasTag("shadow_knight") or
		victim:HasTag("shadow_bishop") or
		victim:HasTag("shadow_rook") or
		victim:HasTag("ghost") or
		victim:HasTag("werepig") or
		victim:HasTag("lureplant")
	) then
	
	inst.level = inst.level + 10
	inst.components.talker:Say("I can feel the power in my veins. Nya~")
end
	if (
		victim:HasTag("leif") or
		victim:HasTag("krampus") or
		victim:HasTag("warg") or
		victim:HasTag("spat") or
		victim:HasTag("deciduoustree") 
	) then
	
	inst.level = inst.level + 25
	inst.components.talker:Say("That's what i was talking about. Nya~")
end
	if (
		victim:HasTag("beequeen") or
		victim:HasTag("Goose") or
		victim:HasTag("dragonfly") or
		victim:HasTag("bearger") or
		victim:HasTag("spiderqueen") or
		victim:HasTag("deerclops") or
		victim:HasTag("minotaur") or
		victim:HasTag("klaus") or
		victim:HasTag("toadstool") 
	) then
	
	inst.level = inst.level + 50
	inst.components.talker:Say("Hell Yea! With this i can be the strongest queen ever! Nya~")
	inst.SoundEmitter:PlaySound("dontstarve/characters/alishia/bosskill")
end
end

local common_postinit = function(inst) 
	-- Minimap icon
	inst.MiniMapEntity:SetIcon( "alishia.tex" )
	inst:AddTag("alisha")
	inst.transformed = true
	inst:AddComponent("keyhandler")
    inst.components.keyhandler:AddActionListener("alishia", TUNING.alishia.KEYTWO, "SpeedUp")
	inst.components.keyhandler:AddActionListener("alishia", TUNING.alishia.KEY3, "IceAttack")
	inst.level = 0
end

local function onsave(inst, data)
	data.level = inst.level
 end

inst:ListenForEvent("killed", onkill)
inst:ListenForEvent("levelup", levelexp)

this code is not working i tried to add level system. Can you tell me what's wrong?

Link to comment
Share on other sites

5 hours ago, Lumina said:

I can't tell you what is wrong, but i know there are multiple mods with level system on the workshop. Maybe you could look at one of them. And if you don't find an answer, a clean topic with a clear title will probably be better.

I look some of them and i can't find the answer but i'll try to start new topic.

Link to comment
Share on other sites

Just taking a quick look the Victim:HasTag you put in there won't work. The reason is each monster prefab won't just have a tag in their file with their name on it. I won't know the exact coding off hand, but you're better off getting the prefab name of the victim instead. I'd also recommend adding in prints to ensure the code is working, so if say you kill a butterfly the message will print.

Link to comment
Share on other sites

On 2/18/2017 at 4:20 AM, AkaiNight said:

I don't know did i got it right but i think Victim:HasTag works fine because when i kill something talker:Say is works. I thing the problem is level code but i'm not sure

Now that I actually have access to in game files it does actually look like each mob has a tag with their name in it which is nice. So your character is actually leveling up it's just their max stats aren't changing, is that right?

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