Sign in to follow this  

Need help with modding my own Character

Recommended Posts

9kittencorn    0

I posted this already but in a wrong section. So i try it with the "modding"-section again :3
This time I will also upload my scripts not only the error.

"Here is the error-text :

[string *scripts/mainfunctions.lua*]:119: Error loading file prefabs/Ren
[string *../mods/Ren/scripts/prefabs/Ren.lua*]:62: function arguments expected near "="
LUA ERROR strack traceback:
=[C] in function 'assert'
=(tail call) ?
scripts/mods.lua(593.1) in function 'RegisterPrefabs'
scripts/gamelogic.lua(226.1) in function 'LoadAssets'  "




Share this post

Link to post
Share on other sites
ZupaleX    270


function MakePlayerCharacter(name, customprefabs, customassets, common_postinit, master_postinit, starting_inventory)

You do

return MakePlayerCharacter("Ren", prefabs, assets, fn)

By passing your function as the 4th argument, you pass it as the common_postinit which is executed even on the client side. You should not add components in here, this belongs generally to the server side.

The components you are trying to access do not exist at the time when the common_postinit is called, all the components are added later.

Check out player_common.lua from line 1457

common_postinit is called line 1727

the components hunger, sanity, etc... you are trying to access in your function fn are added from line 1795.

I think you have enough elements to fix it now :)

Share this post

Link to post
Share on other sites

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
Sign in to follow this