Prajdo Posted April 20, 2021 Share Posted April 20, 2021 Hi there! I'm currently working on a mod that adds some stuff from singleplayer dlcs to DST. Despite the fact that I know barely nothing about .lua I decided to at least try. Almost all my work is based on comparing my codes to those from original game or other mods and so far it was working but today I got stuck. I was adding Teatrees from Hamlet DLC based on Deciduoustree prefab from original DST, because when I used code from singleplayer teatree, prefab was working but was invisible. I managed to dealt with numerous troubles but with this one I simply don't know what is wrong. Server log is saying "variable 'anim' is not declared". I have no idea which one and I'm tired of changing everything completely random and with my skills I'll probably make everything even worse without a help of someone who actually know how it works. So if anyone who is good at coding could take a look at this prefab and log and tell me what I need to do for it to work then I would be very grateful. server_log.txt teatrees.lua Link to comment https://forums.kleientertainment.com/forums/topic/129105-variable-anim-is-not-declared/ Share on other sites More sharing options...
alainmcd Posted April 20, 2021 Share Posted April 20, 2021 Hi there. You are trying to access a variable anim in lines 864, 866, 875 and 878, but you haven't declared it. The original teatrees.lua from Hamlet declares it in line 1013 ( local anim = inst.entity:AddAnimState() ). However, if you compare the deciduoustrees.lua from DST and Hamlet you'll notice that Hamlet also uses an anim variable (ll. 1178-1204) whereas DST doesn't. Instead, in DST the AnimState is initialised without assigning it to a variable (l. 1229) and inst.AnimState is accessed directly (ll. 1247-1278). Since you already have inst.entity:AddAnimState() in line 850, simply change the four instances of anim to inst.AnimState (so inst.AnimState:SetBank("tree_leaf") and so on). Untested, hence not guaranteed to work. Good luck! 1 Link to comment https://forums.kleientertainment.com/forums/topic/129105-variable-anim-is-not-declared/#findComment-1450629 Share on other sites More sharing options...
Prajdo Posted April 20, 2021 Author Share Posted April 20, 2021 As I thought I couldn't be able to notice that by myself. There was some more mistakes with burned state for those who are very perceptive, but those I managed to solve easily. Thanks a lot for help! Everything is working fine. 1 Link to comment https://forums.kleientertainment.com/forums/topic/129105-variable-anim-is-not-declared/#findComment-1450632 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