dustsuccer Posted March 4, 2019 Share Posted March 4, 2019 How can i use inst.components.builder:UnlockRecipe("prefab") and inst.components.reader:Say("string") inside inst.components.book.onread function? I want to create a book that would unlock recipe after reading but as a result i always get error: [string "../mods/test/scripts/prefabs/book_science.l..."]:85: attempt to index field 'builder' (a nil value) P.S. Sorry for my english Link to comment Share on other sites More sharing options...
Ultroman Posted March 4, 2019 Share Posted March 4, 2019 We need to see your code in order to help you. Zip your mod, and drag 'n' drop it on a reply. Link to comment Share on other sites More sharing options...
CarlZalph Posted March 5, 2019 Share Posted March 5, 2019 inst.components.book.onread = function(owner, reader) if reader.components.builder then reader.components.builder:UnlockRecipe("prefab") end if reader.components.talker then reader.components.talker:Say("Bob") end return true -- Or whatever checks you want to make it not do anything. end I think you're trying to use the book component's inst as a reference to the builder/talker component instead of the reader. 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