Woodside235 Posted January 9, 2015 Share Posted January 9, 2015 (edited) Some items have the component components.dapperness.mitigates_rain Is there a way to add a custom component to certain items? My goal is to have something similar to this from wx78.lua: for k, v in pairs(inst.components.inventory.equipslots) do if v.components.dapperness ~= nil and v.components.dapperness.mitigates_rain then --Mitigates rain, no sparks return endend Edited January 9, 2015 by Woodside235 Link to comment Share on other sites More sharing options...
Woodside235 Posted January 10, 2015 Author Share Posted January 10, 2015 (edited) Nevermind, I just created a string array of the items I wanted to have the component and used it. Works just fine. EDIT: however it'd still be nice to know how Edited January 10, 2015 by Woodside235 Link to comment Share on other sites More sharing options...
rezecib Posted January 10, 2015 Share Posted January 10, 2015 (edited) @Woodside235, Maybe I'm not understanding exactly what you want to do, but why not just add the dapperness component? It starts out with dapperness == 0, by default. But when RoG rolls out, this gets separated into its own component. So something like this:wetprotected ={ "flowerhat", "armor_wood", "spear",}for k,v in pairs(wetprotected) do AddPrefabPostInit(v, function(inst) inst:AddComponent("dapperness") inst.components.dapperness.mitigates_rain = true end)end Edited January 10, 2015 by rezecib 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