owlluna Posted July 20, 2021 Share Posted July 20, 2021 (edited) Hullo everyone! This is my first time posting on the forums despite reading a ton of threads, so please forgive my formatting if it's still a little rough! To cut to the chase, I'm creating a moleworm character that has a custom pair of sunglasses that negates his molevision. I have this code that functions as it should with the Equip/UnEquip listed under the spoiler. Spoiler local function SetMoleVision(inst, enable) if inst:HasTag("molehuman") then if not inst:HasTag("playerghost") then if TheWorld.state.isday and not TheWorld:HasTag("cave") then seasoncheck(inst) inst.components.playervision:ForceNightVision(true) inst.components.playervision:SetCustomCCTable("MOLEVISION_COLOURCUBES") end local item = inst.replica.inventory and inst.replica.inventory:GetEquippedItem(EQUIPSLOTS.HEAD) if item and item.prefab == "spectamoles" then seasoncheck(inst) inst.components.playervision:ForceNightVision(false) inst.components.playervision:SetCustomCCTable(nil) else seasoncheck(inst) inst.components.playervision:ForceNightVision(true) inst.components.playervision:SetCustomCCTable(MOLEVISION_COLOURCUBES) return end end end end The image examples of what's happening in-game under this spoiler: Spoiler This is how the item is supposed to work - it changes the character vision to "normal" ---- This one is the source of my headaches. lol So far I've tried adding the "WatchWorld/Listen" events in the common_postinit, the master_postinit, as well as in the onload function. I was thinking my next option would be having it save the equipment data...so I tried this: Spoiler local function OnSave (inst, data) data.equip = inst.replica.inventory:GetEquippedItem(EQUIPSLOTS.HEAD) print("data", data.equip) end And that resulted in this error: [00:02:02]: [string "scripts/dumper.lua"]:112: Cannot dump userdata (Transform (1D9C37B8) - unknown) LUA ERROR stack traceback: =[C]:-1 in (global) error (C) <-1--1> scripts/dumper.lua:112 in () ? (Lua) <98-113> =(tail call):-1 in () (tail) <-1--1> scripts/dumper.lua:151 in () ? (Lua) <141-159> =(tail call):-1 in () (tail) <-1--1> scripts/dumper.lua:151 in () ? (Lua) <141-159> =(tail call):-1 in () (tail) <-1--1> scripts/dumper.lua:151 in () ? (Lua) <141-159> =(tail call):-1 in () (tail) <-1--1> scripts/dumper.lua:225 in (global) DataDumper (Lua) <77-245> scripts/networking.lua:282 in (global) SerializeUserSession (Lua) <278-295> scripts/components/playerspawner.lua:92 in (field) fn (Lua) <81-101> scripts/scheduler.lua:177 in (method) OnTick (Lua) <155-207> scripts/scheduler.lua:371 in (global) RunScheduler (Lua) <369-377> scripts/update.lua:185 in () ? (Lua) <164-243> [00:02:02]: data 116935 - spectamoles(LIMBO) [00:02:02]: data 116935 - spectamoles(LIMBO) So at this point I've reached the extent of my noob LUA knowledge... I'm mainly an artist and this is my very first character mod project! My understanding of LUA is literally the age of this project at 2 weeks lol. I'm still growing and my codes could probably be written waaaay more efficiently, but I'm getting there! Thanks in advance for anyone who can help! Edited July 20, 2021 by owlluna Link to comment Share on other sites More sharing options...
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
Already have an account? Sign in here.Sign In Now