AkaiNight Posted November 12, 2019 Share Posted November 12, 2019 (edited) here is the code i use local function SpeedUp(inst) if inst:HasTag("playerghost") then return end if TheWorld.state.isday then if inst.transformed and inst.components.hunger.current>=5 and inst.components.sanity.current>=5 and inst.level >= 41 then inst.components.hunger.current = inst.components.hunger.current - 5 inst.components.sanity:DoDelta(-5) inst.components.locomotor.walkspeed = 6 inst.components.locomotor.runspeed = 8 inst.components.sanity.night_drain_mult = 1.5 inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 3) inst.components.combat:SetAttackPeriod(0.5) inst.components.talker:Say("Ikuzoo! Nya~", 1, true) elseif inst.transformed and inst.components.hunger.current< 5 then inst.components.talker:Say("Well better eat something before run. Nya~", 1, true) elseif inst.transformed and inst.components.sanity.current< 5 then inst.components.talker:Say("Run? Do i know how to run? Nya~", 1, true) elseif inst.transformed and inst.level < 41 then inst.components.talker:Say("I must be lvl 3 for use this. Nya~", 1, true) end elseif TheWorld.state.isnight then if TheWorld.state.moonphase == "new" then if inst.transformed and inst.components.hunger.current>=5 and inst.components.sanity.current>=5 and inst.level >= 41 then inst.components.hunger.current = inst.components.hunger.current - 5 inst.components.sanity:DoDelta(-5) inst.components.locomotor.walkspeed = 8.5 inst.components.locomotor.runspeed = 12 inst.components.sanity.night_drain_mult = 3 inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 2) inst.components.combat:SetAttackPeriod(0.3) inst.components.talker:Say("Ikuzoo! Nya~", 1, true) elseif inst.transformed and inst.components.hunger.current< 5 then inst.components.talker:Say("Well better eat something before run. Nya~", 1, true) elseif inst.transformed and inst.components.sanity.current< 5 then inst.components.talker:Say("Run? Do i know how to run? Nya~", 1, true) elseif inst.transformed and inst.level < 41 then inst.components.talker:Say("I must be lvl 3 for use this. Nya~", 1, true) end end elseif TheWorld.state.moonphase == "full" then if inst.transformed and inst.components.hunger.current>=15 and inst.components.sanity.current>=15 and inst.level >= 41 then inst.components.hunger.current = inst.components.hunger.current - 10 inst.components.sanity:DoDelta(-10) inst.components.locomotor.walkspeed = 6.5 inst.components.locomotor.runspeed = 7.5 inst.components.sanity.night_drain_mult = 1.7 inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 4) inst.components.combat:SetAttackPeriod(0.5) inst.components.talker:Say("Ikuzoo! Nya~", 1, true) elseif inst.transformed and inst.components.hunger.current< 10 then inst.components.talker:Say("Well better eat something before run. Nya~", 1, true) elseif inst.transformed and inst.components.sanity.current< 10 then inst.components.talker:Say("Run? Do i know how to run? Nya~", 1, true) elseif inst.transformed and inst.level < 41 then inst.components.talker:Say("I must be lvl 3 for use this. Nya~", 1, true) end elseif TheWorld.state.isdusk then if TheWorld.state.moonphase == "new" then if inst.transformed and inst.components.hunger.current>=5 and inst.components.sanity.current>=5 and inst.level >= 41 then inst.components.hunger.current = inst.components.hunger.current - 5 inst.components.sanity:DoDelta(-5) inst.components.locomotor.walkspeed = 7.5 inst.components.locomotor.runspeed = 10 inst.components.sanity.night_drain_mult = 2.5 inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 2.5) inst.components.combat:SetAttackPeriod(0.35) inst.components.talker:Say("Ikuzoo! Nya~", 1, true) elseif inst.transformed and inst.components.hunger.current< 5 then inst.components.talker:Say("Well better eat something before run. Nya~", 1, true) elseif inst.transformed and inst.components.sanity.current< 5 then inst.components.talker:Say("Run? Do i know how to run? Nya~", 1, true) elseif inst.transformed and inst.level < 41 then inst.components.talker:Say("I must be lvl 3 for use this. Nya~", 1, true) end elseif TheWorld.state.moonphase == "full" then if inst.transformed and inst.components.hunger.current>=7 and inst.components.sanity.current>=7 and inst.level >= 41 then inst.components.hunger.current = inst.components.hunger.current - 7 inst.components.sanity:DoDelta(-7) inst.components.locomotor.walkspeed = 7 inst.components.locomotor.runspeed = 8 inst.components.sanity.night_drain_mult = 2 inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE * 3) inst.components.combat:SetAttackPeriod(0.4) inst.components.talker:Say("Ikuzoo! Nya~", 1, true) elseif inst.transformed and inst.components.hunger.current< 7 then inst.components.talker:Say("Well better eat something before run. Nya~", 1, true) elseif inst.transformed and inst.components.sanity.current< 7 then inst.components.talker:Say("Run? Do i know how to run? Nya~", 1, true) elseif inst.transformed and inst.level < 41 then inst.components.talker:Say("I must be lvl 3 for use this. Nya~", 1, true) end end end inst.transformed = not inst.transformed return true end here is the log i cant figure what is wrong (the code is in modmain.lua) client_log_2019-11-12-06-54-35.txt client_log.txt Edited November 12, 2019 by AkaiNight Link to comment Share on other sites More sharing options...
Ultroman Posted December 8, 2019 Share Posted December 8, 2019 [string "scripts/mainfunctions.lua"]:150: Error loading file prefabs/kitsura [string "../mods/Kitsura/scripts/prefabs/kitsura.lua"]:47: '=' expected near 'inst' The million dollar questions are: Which line is line 47? And why does it believe there is a = missing near something with "inst"? Link to comment Share on other sites More sharing options...
AkaiNight Posted December 16, 2019 Author Share Posted December 16, 2019 On 09.12.2019 at 2:07 AM, Ultroman said: [string "scripts/mainfunctions.lua"]:150: Error loading file prefabs/kitsura [string "../mods/Kitsura/scripts/prefabs/kitsura.lua"]:47: '=' expected near 'inst' The million dollar questions are: Which line is line 47? And why does it believe there is a = missing near something with "inst"? inst.components.combat:SetAttackPeriod (0.4) this one and im not sure why Link to comment Share on other sites More sharing options...
Developer bizziboi Posted December 16, 2019 Developer Share Posted December 16, 2019 Are you sure that is the file it's complaining about? I just loaded it in regular lua without any syntax issue. Link to comment Share on other sites More sharing options...
AkaiNight Posted December 16, 2019 Author Share Posted December 16, 2019 3 hours ago, bizziboi said: Are you sure that is the file it's complaining about? I just loaded it in regular lua without any syntax issue. im uploading my mod file im not sure why it gives error Kitsura.rar Link to comment Share on other sites More sharing options...
Ultroman Posted December 16, 2019 Share Posted December 16, 2019 (edited) 6 hours ago, AkaiNight said: inst.components.combat:SetAttackPeriod (0.4) Are you allowed to have a space between the name of the function and the parentheses with parameters? Looking at the code, the function containing it is only used when certain worldstates change, which you have set up in the master_postinit. inst:WatchWorldState("isday", MoonsCurse) inst:WatchWorldState("isdusk", MoonsCurse) inst:WatchWorldState("isnight", MoonsCurse) inst:WatchWorldState("moonphase", MoonsCurse) I can't remember if WatchWorldState calls the given function immediately when hooked up or only when it changes, but if it does, then line 47 is the first line of your code to be called which has that space in it. Whatever the case, you have done the same all over your code. If you get a new error when trying to remove the space on line 47, then you know it fixed it, and that you can change the rest. If you get the same error, then that wasn't the problem. Edited December 16, 2019 by Ultroman Link to comment Share on other sites More sharing options...
AkaiNight Posted December 16, 2019 Author Share Posted December 16, 2019 43 minutes ago, Ultroman said: Are you allowed to have a space between the name of the function and the parentheses with parameters? Looking at the code, the function containing it is only used when certain worldstates change, which you have set up in the master_postinit. inst:WatchWorldState("isday", MoonsCurse) inst:WatchWorldState("isdusk", MoonsCurse) inst:WatchWorldState("isnight", MoonsCurse) inst:WatchWorldState("moonphase", MoonsCurse) I can't remember if WatchWorldState calls the given function immediately when hooked up or only when it changes, but if it does, then line 47 is the first line of your code to be called which has that space in it. Whatever the case, you have done the same all over your code. If you get a new error when trying to remove the space on line 47, then you know it fixed it, and that you can change the rest. If you get the same error, then that wasn't the problem. Really??? All those time i waste for fix it and it was just a space.. thanks a lot Link to comment Share on other sites More sharing options...
Ultroman Posted December 16, 2019 Share Posted December 16, 2019 Did it work? Link to comment Share on other sites More sharing options...
AkaiNight Posted December 16, 2019 Author Share Posted December 16, 2019 4 minutes ago, Ultroman said: Did it work? yes thanks a lot 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