Jump to content

Recommended Posts

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

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 by Arkathorn

@Arkathorn thank you for replying

yes,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 error

or maybe is it because of the describe string i wrote on modmain?

modmain.lua

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.

@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?

@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

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.

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")    endend
then 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

 

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")    endend
then 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.

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@pickleplayer

and 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 spoiler

i 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 XP

bamboo_tree.lua

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 by ryesoul

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