kitsuratr Posted June 6, 2019 Share Posted June 6, 2019 Hello there i have been tried those problems about 3 hours and i can't get anything... First of all i need to make my character fridge inventory when he reached lvl 2 i tried this but it won't work i suppoise it's the tag i use but i can't find any other tags --level 2 elseif inst.level >20 and inst.level <=40 then inst.components.health.maxhealth = math.ceil (60) inst.components.hunger.max = math.ceil (60) inst.components.sanity.max = math.ceil (60) elseif inst.level > 20 then inst.AddTag("fridge") . . . . . . . end . . . . when i reached 41+exp i gor lost connection i fixed it with just deleting the elseif inst.level > 20 then inst.AddTag("fridge") but now i got little problem with my counter attack code here is the code local function OnBeingAttacked(inst, data) local damage = data.damage if damage then local last_time_first_hit = inst.last_time_first_hit local current_time = GetTime() if inst.level <=40 then inst.components.talker:Say("My skills are sealed... for now. Nya~") end --level 3 if inst.level >40 and inst.level <=70 then if (last_time_first_hit == nil) or (current_time_first_hit > 5) then inst.total_damage_received = damage inst.last_time_first_hit = current_time else inst.total_damage_received = inst.total_damage_received + damage end if inst.total_damage_received > 29.5 then local x, y, z =inst.Transform:GetWorldPosition() inst.components.talker:Say("It hurts! Nya~") local ents = TheSim:FindEntities(x, y, z , 20, {"freezable"}, {"player"}) for i, v in ipairs(ents) do v.components.freezable:SpawnShatterFX() v.components.freezable:AddColdness(3) end inst.total_damage_received = 0 inst.last_time_hit = nil end end --lvl- 4 if inst.level >70 and inst.level <=110 then if (last_time_first_hit == nil) or (current_time_first_hit > 5.5) then inst.total_damage_received = damage inst.last_time_first_hit = current_time else inst.total_damage_received = inst.total_damage_received + damage end if inst.total_damage_received > 34.5 then local x, y, z =inst.Transform:GetWorldPosition() inst.components.talker:Say("It hurts! Nya~") local ents = TheSim:FindEntities(x, y, z , 20, {"freezable"}, {"player"}) for i, v in ipairs(ents) do v.components.freezable:SpawnShatterFX() v.components.freezable:AddColdness(4 ) end inst.total_damage_received = 0 inst.last_time_hit = nil end end --lvl- 5 if inst.level >110 and inst.level <=160 then if (last_time_first_hit == nil) or (current_time_first_hit > 6) then inst.total_damage_received = damage inst.last_time_first_hit = current_time else inst.total_damage_received = inst.total_damage_received + damage end if inst.total_damage_received > 39.5 then local x, y, z =inst.Transform:GetWorldPosition() inst.components.talker:Say("It hurts! Nya~") local ents = TheSim:FindEntities(x, y, z , 20, {"freezable"}, {"player"}) for i, v in ipairs(ents) do v.components.freezable:SpawnShatterFX() v.components.freezable:AddColdness(5) end inst.total_damage_received = 0 inst.last_time_hit = nil end end --lvl-6 if inst.level >160 and inst.level <=220 then if (last_time_first_hit == nil) or (current_time_first_hit > 6.5) then inst.total_damage_received = damage inst.last_time_first_hit = current_time else inst.total_damage_received = inst.total_damage_received + damage end if inst.total_damage_received > 44.5 then local x, y, z =inst.Transform:GetWorldPosition() inst.components.talker:Say("It hurts! Nya~") local ents = TheSim:FindEntities(x, y, z , 20, {"freezable"}, {"player"}) for i, v in ipairs(ents) do v.components.freezable:SpawnShatterFX() v.components.freezable:AddColdness(6 ) end inst.total_damage_received = 0 inst.last_time_hit = nil end end --lvl-7 if inst.level >220 and inst.level <=290 then if (last_time_first_hit == nil) or (current_time_first_hit > 7) then inst.total_damage_received = damage inst.last_time_first_hit = current_time else inst.total_damage_received = inst.total_damage_received + damage end if inst.total_damage_received > 49.5 then local x, y, z =inst.Transform:GetWorldPosition() inst.components.talker:Say("It hurts! Nya~") local ents = TheSim:FindEntities(x, y, z , 20, {"freezable"}, {"player"}) for i, v in ipairs(ents) do v.components.freezable:SpawnShatterFX() v.components.freezable:AddColdness(7) end inst.total_damage_received = 0 inst.last_time_hit = nil end end --lvl-8 if inst.level >290 and inst.level <=370 then if (last_time_first_hit == nil) or (current_time_first_hit > 7.5) then inst.total_damage_received = damage inst.last_time_first_hit = current_time else inst.total_damage_received = inst.total_damage_received + damage end if inst.total_damage_received > 54.5 then local x, y, z =inst.Transform:GetWorldPosition() inst.components.talker:Say("It hurts! Nya~") local ents = TheSim:FindEntities(x, y, z , 20, {"freezable"}, {"player"}) for i, v in ipairs(ents) do v.components.freezable:SpawnShatterFX() v.components.freezable:AddColdness(8) end inst.total_damage_received = 0 inst.last_time_hit = nil end end --lvl-9 if inst.level >370 and inst.level <=460 then if (last_time_first_hit == nil) or (current_time_first_hit > 8) then inst.total_damage_received = damage inst.last_time_first_hit = current_time else inst.total_damage_received = inst.total_damage_received + damage end if inst.total_damage_received > 59.5 then local x, y, z =inst.Transform:GetWorldPosition() inst.components.talker:Say("It hurts! Nya~") local ents = TheSim:FindEntities(x, y, z , 20, {"freezable"}, {"player"}) for i, v in ipairs(ents) do v.components.freezable:SpawnShatterFX() v.components.freezable:AddColdness(9) end inst.total_damage_received = 0 inst.last_time_hit = nil end end --lvl-10 if inst.level >460 and inst.level <=560 then if (last_time_first_hit == nil) or (current_time_first_hit > 10) then inst.total_damage_received = damage inst.last_time_first_hit = current_time else inst.total_damage_received = inst.total_damage_received + damage end if inst.total_damage_received > 69.5 then local x, y, z =inst.Transform:GetWorldPosition() inst.components.talker:Say("It hurts! Nya~") local ents = TheSim:FindEntities(x, y, z , 20, {"freezable"}, {"player"}) for i, v in ipairs(ents) do v.components.freezable:SpawnShatterFX() v.components.freezable:AddColdness(10) end inst.total_damage_received = 0 inst.last_time_hit = nil end end --lvl-11 if inst.level >560 and inst.level <=670 then if (last_time_first_hit == nil) or (current_time_first_hit > 12.5) then inst.total_damage_received = damage inst.last_time_first_hit = current_time else inst.total_damage_received = inst.total_damage_received + damage end if inst.total_damage_received > 74.5 then local x, y, z =inst.Transform:GetWorldPosition() inst.components.talker:Say("It hurts! Nya~") local ents = TheSim:FindEntities(x, y, z , 20, {"freezable"}, {"player"}) for i, v in ipairs(ents) do v.components.freezable:SpawnShatterFX() v.components.freezable:AddColdness(12) end inst.total_damage_received = 0 inst.last_time_hit = nil end end --lvl-12 if inst.level >670 and inst.level <=790 then if (last_time_first_hit == nil) or (current_time_first_hit > 12.5) then inst.total_damage_received = damage inst.last_time_first_hit = current_time else inst.total_damage_received = inst.total_damage_received + damage end if inst.total_damage_received > 74.5 then local x, y, z =inst.Transform:GetWorldPosition() inst.components.talker:Say("It hurts! Nya~") local ents = TheSim:FindEntities(x, y, z , 20, {"freezable"}, {"player"}) for i, v in ipairs(ents) do v.components.freezable:SpawnShatterFX() v.components.freezable:AddColdness(12) end inst.total_damage_received = 0 inst.last_time_hit = nil end end --lvl-13 if inst.level >790 and inst.level <=920 then if (last_time_first_hit == nil) or (current_time_first_hit > 12.5) then inst.total_damage_received = damage inst.last_time_first_hit = current_time else inst.total_damage_received = inst.total_damage_received + damage end if inst.total_damage_received > 94.5 then local x, y, z =inst.Transform:GetWorldPosition() inst.components.talker:Say("It hurts! Nya~") local ents = TheSim:FindEntities(x, y, z , 20, {"freezable"}, {"player"}) for i, v in ipairs(ents) do v.components.freezable:SpawnShatterFX() v.components.freezable:AddColdness(12) end inst.total_damage_received = 0 inst.last_time_hit = nil end end --lvl-14 if inst.level >920 and inst.level <=1060 then if (last_time_first_hit == nil) or (current_time_first_hit > 12.5) then inst.total_damage_received = damage inst.last_time_first_hit = current_time else inst.total_damage_received = inst.total_damage_received + damage end if inst.total_damage_received > 94.5 then local x, y, z =inst.Transform:GetWorldPosition() inst.components.talker:Say("It hurts! Nya~") local ents = TheSim:FindEntities(x, y, z , 20, {"freezable"}, {"player"}) for i, v in ipairs(ents) do v.components.freezable:SpawnShatterFX() v.components.freezable:AddColdness(12) end inst.total_damage_received = 0 inst.last_time_hit = nil end end --lvl-15 if inst.level >1060 and inst.level <=1210 then if (last_time_first_hit == nil) or (current_time_first_hit > 15) then inst.total_damage_received = damage inst.last_time_first_hit = current_time else inst.total_damage_received = inst.total_damage_received + damage end if inst.total_damage_received > 99.5 then local x, y, z =inst.Transform:GetWorldPosition() inst.components.talker:Say("It hurts! Nya~") local ents = TheSim:FindEntities(x, y, z , 20, {"freezable"}, {"player"}) for i, v in ipairs(ents) do v.components.freezable:SpawnShatterFX() v.components.freezable:AddColdness(15) end inst.total_damage_received = 0 inst.last_time_hit = nil end end --lvl-16 if inst.level >1210 and inst.level <=1370 then if (last_time_first_hit == nil) or (current_time_first_hit > 17.5) then inst.total_damage_received = damage inst.last_time_first_hit = current_time else inst.total_damage_received = inst.total_damage_received + damage end if inst.total_damage_received > 124.5 then local x, y, z =inst.Transform:GetWorldPosition() inst.components.talker:Say("It hurts! Nya~") local ents = TheSim:FindEntities(x, y, z , 20, {"freezable"}, {"player"}) for i, v in ipairs(ents) do v.components.freezable:SpawnShatterFX() v.components.freezable:AddColdness(17) end inst.total_damage_received = 0 inst.last_time_hit = nil end end --lvl-17 if inst.level >1370 and inst.level <=1540 then if (last_time_first_hit == nil) or (current_time_first_hit > 17.5) then inst.total_damage_received = damage inst.last_time_first_hit = current_time else inst.total_damage_received = inst.total_damage_received + damage end if inst.total_damage_received > 124.5 then local x, y, z =inst.Transform:GetWorldPosition() inst.components.talker:Say("It hurts! Nya~") local ents = TheSim:FindEntities(x, y, z , 20, {"freezable"}, {"player"}) for i, v in ipairs(ents) do v.components.freezable:SpawnShatterFX() v.components.freezable:AddColdness(17) end inst.total_damage_received = 0 inst.last_time_hit = nil end end --lvl-18 if inst.level >1540 and inst.level <=1720 then if (last_time_first_hit == nil) or (current_time_first_hit > 17.5) then inst.total_damage_received = damage inst.last_time_first_hit = current_time else inst.total_damage_received = inst.total_damage_received + damage end if inst.total_damage_received > 134.5 then local x, y, z =inst.Transform:GetWorldPosition() inst.components.talker:Say("It hurts! Nya~") local ents = TheSim:FindEntities(x, y, z , 20, {"freezable"}, {"player"}) for i, v in ipairs(ents) do v.components.freezable:SpawnShatterFX() v.components.freezable:AddColdness(17) end inst.total_damage_received = 0 inst.last_time_hit = nil end end --lvl-19 if inst.level >1720 and inst.level <= 1910 then if (last_time_first_hit == nil) or (current_time_first_hit > 17.5) then inst.total_damage_received = damage inst.last_time_first_hit = current_time else inst.total_damage_received = inst.total_damage_received + damage end if inst.total_damage_received > 134.5 then local x, y, z =inst.Transform:GetWorldPosition() inst.components.talker:Say("It hurts! Nya~") local ents = TheSim:FindEntities(x, y, z , 20, {"freezable"}, {"player"}) for i, v in ipairs(ents) do v.components.freezable:SpawnShatterFX() v.components.freezable:AddColdness(17) end inst.total_damage_received = 0 inst.last_time_hit = nil end end --lvl-20 if inst.level >1910 and inst.level <=2110 then if (last_time_first_hit == nil) or (current_time_first_hit > 20) then inst.total_damage_received = damage inst.last_time_first_hit = current_time else inst.total_damage_received = inst.total_damage_received + damage end if inst.total_damage_received > 149.5 then local x, y, z =inst.Transform:GetWorldPosition() inst.components.talker:Say("It hurts! Nya~") local ents = TheSim:FindEntities(x, y, z , 20, {"freezable"}, {"player"}) for i, v in ipairs(ents) do v.components.freezable:SpawnShatterFX() v.components.freezable:AddColdness(19) end inst.total_damage_received = 0 inst.last_time_hit = nil end end --lvl-21 if inst.level >2110 and inst.level <=2320 then if (last_time_first_hit == nil) or (current_time_first_hit > 21.5) then inst.total_damage_received = damage inst.last_time_first_hit = current_time else inst.total_damage_received = inst.total_damage_received + damage end if inst.total_damage_received > 169.5 then local x, y, z =inst.Transform:GetWorldPosition() inst.components.talker:Say("It hurts! Nya~") local ents = TheSim:FindEntities(x, y, z , 20, {"freezable"}, {"player"}) for i, v in ipairs(ents) do v.components.freezable:SpawnShatterFX() v.components.freezable:AddColdness(21) end inst.total_damage_received = 0 inst.last_time_hit = nil end end --lvl-22 if inst.level >2320 and inst.level <=2540 then if (last_time_first_hit == nil) or (current_time_first_hit > 21.5) then inst.total_damage_received = damage inst.last_time_first_hit = current_time else inst.total_damage_received = inst.total_damage_received + damage end if inst.total_damage_received > 169.5 then local x, y, z =inst.Transform:GetWorldPosition() inst.components.talker:Say("It hurts! Nya~") local ents = TheSim:FindEntities(x, y, z , 20, {"freezable"}, {"player"}) for i, v in ipairs(ents) do v.components.freezable:SpawnShatterFX() v.components.freezable:AddColdness(21) end inst.total_damage_received = 0 inst.last_time_hit = nil end end --lvl-23 if inst.level >2540 and inst.level <=2770 then if (last_time_first_hit == nil) or (current_time_first_hit > 21.5) then inst.total_damage_received = damage inst.last_time_first_hit = current_time else inst.total_damage_received = inst.total_damage_received + damage end if inst.total_damage_received > 169.5 then local x, y, z =inst.Transform:GetWorldPosition() inst.components.talker:Say("It hurts! Nya~") local ents = TheSim:FindEntities(x, y, z , 20, {"freezable"}, {"player"}) for i, v in ipairs(ents) do v.components.freezable:SpawnShatterFX() v.components.freezable:AddColdness(21) end inst.total_damage_received = 0 inst.last_time_hit = nil end end --lvl-24 if inst.level >2770 and inst.level <=3010 then if (last_time_first_hit == nil) or (current_time_first_hit > 23) then inst.total_damage_received = damage inst.last_time_first_hit = current_time else inst.total_damage_received = inst.total_damage_received + damage end if inst.total_damage_received > 189.5 then local x, y, z =inst.Transform:GetWorldPosition() inst.components.talker:Say("It hurts! Nya~") local ents = TheSim:FindEntities(x, y, z , 20, {"freezable"}, {"player"}) for i, v in ipairs(ents) do v.components.freezable:SpawnShatterFX() v.components.freezable:AddColdness(23) end inst.total_damage_received = 0 inst.last_time_hit = nil end end --lvl-25 if inst.level >3010 and inst.level <=3260 then if (last_time_first_hit == nil) or (current_time_first_hit > 23) then inst.total_damage_received = damage inst.last_time_first_hit = current_time else inst.total_damage_received = inst.total_damage_received + damage end if inst.total_damage_received > 189.5 then local x, y, z =inst.Transform:GetWorldPosition() inst.components.talker:Say("It hurts! Nya~") local ents = TheSim:FindEntities(x, y, z , 20, {"freezable"}, {"player"}) for i, v in ipairs(ents) do v.components.freezable:SpawnShatterFX() v.components.freezable:AddColdness(23) end inst.total_damage_received = 0 inst.last_time_hit = nil end end --lvl-26 if inst.level >3260 and inst.level <=3520 then if (last_time_first_hit == nil) or (current_time_first_hit > 23) then inst.total_damage_received = damage inst.last_time_first_hit = current_time else inst.total_damage_received = inst.total_damage_received + damage end if inst.total_damage_received > 189.5 then local x, y, z =inst.Transform:GetWorldPosition() inst.components.talker:Say("It hurts! Nya~") local ents = TheSim:FindEntities(x, y, z , 20, {"freezable"}, {"player"}) for i, v in ipairs(ents) do v.components.freezable:SpawnShatterFX() v.components.freezable:AddColdness(23) end inst.total_damage_received = 0 inst.last_time_hit = nil end end --lvl-27 if inst.level >3520 and inst.level <=3790 then if (last_time_first_hit == nil) or (current_time_first_hit > 24.5) then inst.total_damage_received = damage inst.last_time_first_hit = current_time else inst.total_damage_received = inst.total_damage_received + damage end if inst.total_damage_received > 209.5 then local x, y, z =inst.Transform:GetWorldPosition() inst.components.talker:Say("It hurts! Nya~") local ents = TheSim:FindEntities(x, y, z , 20, {"freezable"}, {"player"}) for i, v in ipairs(ents) do v.components.freezable:SpawnShatterFX() v.components.freezable:AddColdness(25) end inst.total_damage_received = 0 inst.last_time_hit = nil end end --lvl-28 if inst.level >3790 and inst.level <=4070 then if (last_time_first_hit == nil) or (current_time_first_hit > 24.5) then inst.total_damage_received = damage inst.last_time_first_hit = current_time else inst.total_damage_received = inst.total_damage_received + damage end if inst.total_damage_received > 209.5 then local x, y, z =inst.Transform:GetWorldPosition() inst.components.talker:Say("It hurts! Nya~") local ents = TheSim:FindEntities(x, y, z , 20, {"freezable"}, {"player"}) for i, v in ipairs(ents) do v.components.freezable:SpawnShatterFX() v.components.freezable:AddColdness(25) end inst.total_damage_received = 0 inst.last_time_hit = nil end end --lvl-29 if inst.level >4070 and inst.level <=4360 then if (last_time_first_hit == nil) or (current_time_first_hit > 24.5) then inst.total_damage_received = damage inst.last_time_first_hit = current_time else inst.total_damage_received = inst.total_damage_received + damage end if inst.total_damage_received > 209.5 then local x, y, z =inst.Transform:GetWorldPosition() inst.components.talker:Say("It hurts! Nya~") local ents = TheSim:FindEntities(x, y, z , 20, {"freezable"}, {"player"}) for i, v in ipairs(ents) do v.components.freezable:SpawnShatterFX() v.components.freezable:AddColdness(25) end inst.total_damage_received = 0 inst.last_time_hit = nil end end --lvl-30 if inst.level >4360 and inst.level <=4660 then if (last_time_first_hit == nil) or (current_time_first_hit > 30) then inst.total_damage_received = damage inst.last_time_first_hit = current_time else inst.total_damage_received = inst.total_damage_received + damage end if inst.total_damage_received > 219.5 then local x, y, z =inst.Transform:GetWorldPosition() inst.components.talker:Say("It hurts! Nya~") local ents = TheSim:FindEntities(x, y, z , 20, {"freezable"}, {"player"}) for i, v in ipairs(ents) do v.components.freezable:SpawnShatterFX() v.components.freezable:AddColdness(30) end inst.total_damage_received = 0 inst.last_time_hit = nil end end end end i just tried it when my character has 50+exp and the crush is lost connection here is some of client logs and othre crushes may you need crush with counterattack.txt crush with fridge.txt client_log_2019-06-06-10-24-20.txt client_log_2019-06-06-10-25-05.txt client_log_2019-06-06-10-28-33.txt client_log_2019-06-06-10-33-55.txt client_log_2019-06-06-10-38-33.txt client_log_2019-06-06-05-41-49.txt client_log_2019-06-06-09-31-58.txt client_log_2019-06-06-09-39-57.txt Link to comment Share on other sites More sharing options...
Ultroman Posted June 25, 2019 Share Posted June 25, 2019 (edited) Three things: In order to see the errors, we need the server logs, not the client logs. The client logs are (almost) only helpful when the crash happens in the menu or while loading/creating the server. After entering the game, almost everything is logged in the server logs instead. See my newcomer post for more info and a lot of introductionary stuff for new modders. It's inst:AddTag("fridge") instead of inst.AddTag("fridge"). You used a period instead of a colon. That crashes the client, but not the server. That's way too much code to post directly. It would be much easier to handle, if you attached the file with your code, and gave some line numbers or function names for us to look at. It's just waaay too much. In relation, if I were you I would make functions for each "tier", instead of having all the code be one large if-statement. Then you have all the individual functionality in little boxes, and the big, beastly if-statement can then be considered a separate section of code, which you only ever need to look at, if your level-progression is buggy. local level11to30 = function() -- do something end local level31to50 = function() -- do something end local mainfunction = function() if inst.level > 10 and inst.level <= 30 then level11to30() elseif inst.level > 30 and inst.level <= 50 then level31to50() elseif blablablabla ...... end end Edited June 25, 2019 by Ultroman Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now