sovdirnkovia Posted December 3, 2017 Share Posted December 3, 2017 My rough guess on this is to add a component to the onequip section of the equipment's code I've been trying to search the similar items(top hat) in the /prefab directory but can't seem to find any of them, the related topic I can find about this on the forum says I need to add a component called sanityaura, but I don't understand how to correctly use it, like where should I insert and how to define the attribute of it to restrict it to only have effect strictly only on the character that equipped with it. Can anyone help me? Thanks Link to comment Share on other sites More sharing options...
Lumina Posted December 3, 2017 Share Posted December 3, 2017 All the hats are in the same file, hats.lua Link to comment Share on other sites More sharing options...
K1NGT1GER609 Posted December 3, 2017 Share Posted December 3, 2017 Its simple if I'm reading correctly all you have to do is put the equippable component below: local function fnab() --your main function of your hat if not TheWorld.ismastersim then --this is just here for refence on where to put it return inst end inst.components.equippable.dapperness = TUNING.DAPPERNESS_SMALL --you can put tiny,small,med,large or a decimal value end It should more or less give you a idea where to put the code. Sanityaura is something for giving sanity around a radius of a mob or character so I don't think that's what you wanted seeing you wanted only the character wearing the hat to benefit. Link to comment Share on other sites More sharing options...
sovdirnkovia Posted December 4, 2017 Author Share Posted December 4, 2017 (edited) 9 hours ago, K1NGT1GER609 said: Its simple if I'm reading correctly all you have to do is put the equippable component below: local function fnab() --your main function of your hat if not TheWorld.ismastersim then --this is just here for refence on where to put it return inst end inst.components.equippable.dapperness = TUNING.DAPPERNESS_SMALL --you can put tiny,small,med,large or a decimal value end It should more or less give you a idea where to put the code. Sanityaura is something for giving sanity around a radius of a mob or character so I don't think that's what you wanted seeing you wanted only the character wearing the hat to benefit. 6 Thanks for reply, I've tried to insert the code in the position you suggested, but then when I test it in game, following error occured: Quote [string "../mods/modified coscom/scripts/prefabs/cos..."]:45: attempt to index field 'equippable' (a nil value) LUA ERROR stack traceback: ../mods/modified coscom/scripts/prefabs/coscomsickle.lua:45 in (field) fn (Lua) <24-70> scripts/mainfunctions.lua:185 in () ? (Lua) <174-216> =[C]:-1 in (method) SpawnPrefab (C) <-1--1> scripts/mainfunctions.lua:233 in (global) SpawnPrefab (Lua) <227-235> scripts/prefabs/player_common.lua:866 in (method) OnNewSpawn (Lua) <861-893> scripts/networking.lua:250 in () ? (Lua) <238-256> =[C]:-1 in (method) SendSpawnRequestToServer (C) <-1--1> scripts/mainfunctions.lua:1310 in (local) cb (Lua) <1308-1311> scripts/frontend.lua:598 in (method) DoFadingUpdate (Lua) <562-602> scripts/frontend.lua:650 in (method) Update (Lua) <610-760> scripts/update.lua:92 in () ? (Lua) <33-129> It seems like the field 'equippable' is not defined, but shouldn't it be part of API by default? should I insert/declear something before the function to be able to call this? Thanks --------------------------------------------------------------------------------------- edit: I've found the reason why the error occured, that line of code is placed before the component.equippable is added to the item, so it couldn't find the equippable fields. Edited December 4, 2017 by sovdirnkovia confusion solved Link to comment Share on other sites More sharing options...
sovdirnkovia Posted December 4, 2017 Author Share Posted December 4, 2017 15 hours ago, Lumina said: All the hats are in the same file, hats.lua Thank you for reply, I've found it 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