ryesoul Posted October 22, 2015 Share Posted October 22, 2015 first thing,sorry if the bbcode doesn't works i'm using evergreen prefab for base of my mod and tweak it at some function.but there's a problem in OnBurn(inst,imm) > changes() function log said[codesyntax] ....104670 with DLC/data/../mods/bambooitem/scripts/prefabs/bamboo_tree.lua:86: '=' expected near 'inst' [/codesyntax] and this is where the log said error (first line are the line 86 in the prefab)[codesyntax] inst.components.lootdropper:SetLoot({})if GetBuild(inst).drop_shoots theninst.components.lootdropper:AddChanceLoot("bambooshoot", 0.1)end [/codesyntax] i don't thing it need any '=' for 'inst'.so can anyone help solve it?i attach the prefab oh,and by the way,what's the meaning of "imm" in onburn(inst,imm) ?bamboo_tree.lua Link to comment https://forums.kleientertainment.com/forums/topic/58634-need-help-with-onburn-function/ Share on other sites More sharing options...
Arkathorn Posted October 22, 2015 Share Posted October 22, 2015 (edited) The issue is arising because you did not complete the syntax of line 84:...inst:RemoveTag("fire")RemovePhysicsCollidersinst.components.lootdropper:SetLoot({})if GetBuild(inst).drop_shoots then...You can likely fix it simply by changing 'RemovePhysicsColliders' to 'RemovePhysicsColliders()'. (Assuming that RemovePhysicsColliders is defined as a function) Edited October 22, 2015 by Arkathorn Link to comment https://forums.kleientertainment.com/forums/topic/58634-need-help-with-onburn-function/#findComment-681897 Share on other sites More sharing options...
Arkathorn Posted October 22, 2015 Share Posted October 22, 2015 In regard to 'imm', it doesn't appear to ever be supplied a value, and even if it were it would only make the function execute half a second earlier. (instantaneously) Just ignore it. Link to comment https://forums.kleientertainment.com/forums/topic/58634-need-help-with-onburn-function/#findComment-681900 Share on other sites More sharing options...
ryesoul Posted October 22, 2015 Author Share Posted October 22, 2015 @Arkathorn thank you for replyingyes,i've forgot giving the (inst) in the end.now the new problem was when i click the burnt stump,it crash the game and log said...Starve v1.104670 with DLC/data/scripts/scheduler.lua:345: attempt to perform arithmetic on local 'time' (a nil value)LUA ERROR stack traceback: D:/Program/Games/Dont Starve v1.104670 with DLC/data/scripts/scheduler.lua(345,1) in function 'Sleep' D:/Program/Games/Dont Starve v1.104670 with DLC/data/scripts/components/talker.lua(49,1) in function 'sayfn' D:/Program/Games/Dont Starve v1.104670 with DLC/data/scripts/components/talker.lua(114,1) even when i turn off the "onentitysleep" and "onentitywake",it still have same erroror maybe is it because of the describe string i wrote on modmain?modmain.lua Link to comment https://forums.kleientertainment.com/forums/topic/58634-need-help-with-onburn-function/#findComment-681934 Share on other sites More sharing options...
Mobbstar Posted October 22, 2015 Share Posted October 22, 2015 It appears the player doesn't have a talking time when the error occurs. Link to comment https://forums.kleientertainment.com/forums/topic/58634-need-help-with-onburn-function/#findComment-681936 Share on other sites More sharing options...
Arkathorn Posted October 22, 2015 Share Posted October 22, 2015 It seems that you need to use a different format for your description tables. This should work:GLOBAL.STRINGS.CHARACTERS.GENERIC.DESCRIBE.BAMBOO.BURNT ={ { message="Looks like 'They' should find a new home...", duration=2.5 }, { message="They turn yellow, eww...", duration=2.5 }}You will need to do this for all of your descriptions. Link to comment https://forums.kleientertainment.com/forums/topic/58634-need-help-with-onburn-function/#findComment-681938 Share on other sites More sharing options...
ryesoul Posted October 22, 2015 Author Share Posted October 22, 2015 @Mobbstar @Arkathorn It seems that you need to use a different format for your description tables. This should work:GLOBAL.STRINGS.CHARACTERS.GENERIC.DESCRIBE.BAMBOO.BURNT = { { message="Looks like 'They' should find a new home...", duration=2.5 }, { message="They turn yellow, eww...", duration=2.5 } }You will need to do this for all of your descriptions. so if i have more than 1 description,i should wrote the string that way? oh,and one more question.if i wan't to make an exception in dig_up_stump function,like only when digging the stump from tall tree or tall burnt tree,i got two item and else will only get one item,what should i mention on "if-then-else-end" state? Link to comment https://forums.kleientertainment.com/forums/topic/58634-need-help-with-onburn-function/#findComment-681942 Share on other sites More sharing options...
Mobbstar Posted October 22, 2015 Share Posted October 22, 2015 @Mobbstar @Arkathorn so if i have more than 1 description,i should wrote the string that way? oh,and one more question.if i wan't to make an exception in dig_up_stump function,like only when digging the stump from tall tree or tall burnt tree,i got two item and else will only get one item,what should i mention on "if-then-else-end" state? I'm not sure, the base game never uses several inspections for the same thing.If you mean what to test for, it's inst.components.growable.stage Link to comment https://forums.kleientertainment.com/forums/topic/58634-need-help-with-onburn-function/#findComment-681943 Share on other sites More sharing options...
Arkathorn Posted October 22, 2015 Share Posted October 22, 2015 I'm not sure, the base game never uses several inspections for the same thing.I'm just guessing that this will work, I pieced it together from the code in 'talker.lua'. In the code, it translates the provided string into a 'Line' class, but can also accept a list of instances of that class. A table should work just as well, though. Link to comment https://forums.kleientertainment.com/forums/topic/58634-need-help-with-onburn-function/#findComment-681946 Share on other sites More sharing options...
ryesoul Posted October 22, 2015 Author Share Posted October 22, 2015 I'm not sure, the base game never uses several inspections for the same thing.If you mean what to test for, it's inst.components.growable.stage sorry i forgot to mention i've already try that and growth_stage = 3, data = 3, stage = 3, inst.animstate("inst.anims.stump")(either for normal or burnt), inst.anims = anim_tall, getBuild(inst).tall_anims and even mentioning the "setTall" and "GrowTall",but in log,most of them declare " 'then' expected near '=/inst' " or just "stage/data/growth_stage are not declare.local function dig_up_stump(inst, chopper) inst:Remove() if inst.anims.stump_tall or inst.anims.burnt_stump_tall then --i put the state here,single or combined inst.components.lootdropper:SpawnLootPrefab("bambooshoot","bambooshoot") else inst.components.lootdropper:SpawnLootPrefab("bambooshoot") endendthen i realize that when it turn to stump,growable component are removed so i think inst.components.growable.stage are unusable.so,is there any other way to tell that only stump from tall build?should i use "if inst:addHastag("tall") and inst:addHastag("stump") then blablabla" ? haven't try it because i don't know how hastag works Link to comment https://forums.kleientertainment.com/forums/topic/58634-need-help-with-onburn-function/#findComment-681949 Share on other sites More sharing options...
Mobbstar Posted October 22, 2015 Share Posted October 22, 2015 sorry i forgot to mention i've already try that and growth_stage = 3, data = 3, stage = 3, inst.animstate("inst.anims.stump")(either for normal or burnt), inst.anims = anim_tall, getBuild(inst).tall_anims and even mentioning the "setTall" and "GrowTall",but in log,most of them declare " 'then' expected near '=/inst' " or just "stage/data/growth_stage are not declare.local function dig_up_stump(inst, chopper) inst:Remove() if inst.anims.stump_tall or inst.anims.burnt_stump_tall then --i put the state here,single or combined inst.components.lootdropper:SpawnLootPrefab("bambooshoot","bambooshoot") else inst.components.lootdropper:SpawnLootPrefab("bambooshoot") endendthen i realize that when it turn to stump,growable component are removed so i think inst.components.growable.stage are unusable.so,is there any other way to tell that only stump from tall build?should i use "if inst:addHastag("tall") and inst:addHastag("stump") then blablabla" ? haven't try it because i don't know how hastag works You're right, the simplest solution might be to add a tag when the bamboo grows tall, and to remove it when grows old again. inst:AddTag("tall") inst:RemoveTag("tall") Then you can test for that tag when digging. inst:HasTag("tall") My only concern would be saving/loading the tag properly. But that's of lesser importance, you had better try the general idea. Link to comment https://forums.kleientertainment.com/forums/topic/58634-need-help-with-onburn-function/#findComment-681952 Share on other sites More sharing options...
pickleplayer Posted October 23, 2015 Share Posted October 23, 2015 If you need help with the saving/loading aspect later on, just ask me. I had this exact problem with my character mod a while back, and I solved it with some dumb beaverness component stuff that's pretty easy to implement. Link to comment https://forums.kleientertainment.com/forums/topic/58634-need-help-with-onburn-function/#findComment-682142 Share on other sites More sharing options...
ryesoul Posted October 26, 2015 Author Share Posted October 26, 2015 before all of it,thanks guys for helping me out~! *huggies~* It seems that you need to use a different format for your description tables. This should work:GLOBAL.STRINGS.CHARACTERS.GENERIC.DESCRIBE.BAMBOO.BURNT = { { message="Looks like 'They' should find a new home...", duration=2.5 }, { message="They turn yellow, eww...", duration=2.5 }}You will need to do this for all of your descriptions. @Arkathorn, oookay,i've tried this metode and in the end it still have the same crash issue (freeze display,but gameplay still working,and in the end being killed by charlie).i'll just stick with the previous worked string...but,well,maybe i'll just give another methode for the burn and chopped string~ @Mobbstar@pickleplayerand hastag actually could be used on save and load function lol.i attach the final prefab i done so you guys could see it :>hope there's no more error thingie in the future,so i could focus redone the texture XD again,thank you for all the help for now guys! >w</ little spoileri plan to add new mob that works a little bit like "them",the shadow creature.there'll be 3 mobs and they'll be based on some common ghost from my country...ops,too much spoiler XPbamboo_tree.lua Link to comment https://forums.kleientertainment.com/forums/topic/58634-need-help-with-onburn-function/#findComment-682657 Share on other sites More sharing options...
Arkathorn Posted October 26, 2015 Share Posted October 26, 2015 Would you mind saying what the error is with those lines? Link to comment https://forums.kleientertainment.com/forums/topic/58634-need-help-with-onburn-function/#findComment-682663 Share on other sites More sharing options...
ryesoul Posted October 26, 2015 Author Share Posted October 26, 2015 (edited) well...my bad i didn't save the log,but i think it's almost like the first one,something about scheduler or something. edit : i've try it again a moment ago and it's working (looks likely the previous error are connected with the prefab error),but this time wilson show the first message and after the duration end he continue show the second message.i'll give it a try on "burnt" and "chopped" strings later,it might be work this time Edited October 26, 2015 by ryesoul Link to comment https://forums.kleientertainment.com/forums/topic/58634-need-help-with-onburn-function/#findComment-682685 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