Rivecoder Posted December 15, 2018 Share Posted December 15, 2018 I know i can just add the tag "nightvision" and the mask will work, however i'm looking for a way to get a different colourcube and not that strange negative color effect moggles have I rather not to add a light, I'd really like the real nightvision, how could I be able to do that? i'm still newbie with this kind of stuff Sorry for bad english tho Link to comment https://forums.kleientertainment.com/forums/topic/100618-help-nightvision-mask/ Share on other sites More sharing options...
Tosh Posted December 18, 2018 Share Posted December 18, 2018 (edited) I'm actually trying to do something similar for a mod I've been repairing, though I don't know enough about lua yet to do it. The easiest way to do it should be to inject your custom nightvision values into components/playervision.lua with a tag that you can put in your modded item. This is how it is done in-game for non-player prefabs (e.g. the nightvision and goggles tags). If I find out how to do it, I'll post the solution here. For example, I want to try create a custom "gearvision" tag and give it nightvision and a custom colour cube. I understand how to set this up correctly from within components/playervision.lua, but I have no idea how to get it to behave correctly outside of that file. Is there a way to set this up in either modmain.lua, the prefab file or through a custom component? I've been searching for a solution, but all the examples I could find only work for modded characters (which already reference components/playervision.lua). This is the current gears_hat_goggles prefab file: Quote local assets = { Asset("ANIM", "anim/gears_hat_goggles.zip"), --Asset("IMAGE", "images/colour_cubes/goggles_on_cc.tex"), --Asset("IMAGE", "images/colour_cubes/goggles_off_cc.tex"), } local function generic_perish(inst) local fin = SpawnPrefab("ruins_battery") fin.Transform:SetPosition(inst.Transform:GetWorldPosition()) inst:Remove() end local function goggles_perish(inst) if inst.components.equippable ~= nil and inst.components.equippable:IsEquipped() then local owner = inst.components.inventoryitem ~= nil and inst.components.inventoryitem.owner or nil if owner ~= nil then goggles_turnoff(owner) end end inst:Remove() end local function ontakefuel(inst) inst.SoundEmitter:PlaySound("dontstarve/common/nightmareAddFuel") end local function fn() local function onequip(inst, owner) owner.AnimState:OverrideSymbol("swap_hat", "gears_hat_goggles", "swap_hat") owner.AnimState:Show("HAT") owner.AnimState:Show("HAT_HAIR") inst.components.fueled:StartConsuming() end local function onunequip(inst, owner) owner.AnimState:Hide("HAT") owner.AnimState:Hide("HAT_HAIR") if owner:HasTag("player") then owner.AnimState:Show("HEAD") owner.AnimState:Hide("HEAD_HAIR") end inst.components.fueled:StopConsuming() end local function goggles_onequip(inst, owner) onequip(inst, owner) owner.SoundEmitter:PlaySound("dontstarve_DLC001/common/moggles_on") end local function goggles_onunequip(inst, owner) onunequip(inst, owner) owner.SoundEmitter:PlaySound("dontstarve_DLC001/common/moggles_off") end local inst = CreateEntity() inst:AddTag("gearvision") inst:AddTag("goggles") inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddNetwork() MakeInventoryPhysics(inst) The current WIP mod is attached below. If anyone is able to help us with this, that'd be amazing. gears_hat_goggles.zip Edited December 18, 2018 by Tosh Link to comment https://forums.kleientertainment.com/forums/topic/100618-help-nightvision-mask/#findComment-1133249 Share on other sites More sharing options...
Tosh Posted December 18, 2018 Share Posted December 18, 2018 Bumping this. I've been looking around for a solution to this, but I don't think there's a way I can do it without help at my current skill level. The two potential routes I can think of are: Using AddComponentPostInit in the modmain to set up my custom 'Gearvision' values in components/playervision.lua. Finding a way to reference components.playervision properly. Link to comment https://forums.kleientertainment.com/forums/topic/100618-help-nightvision-mask/#findComment-1133698 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