Jump to content

Recommended Posts

Hey guys! 3 things today...

1. Like in woodie's transformation, his nightvision only activates in werebeaver form. I'd like to only have my night vision turn on for my lycan transformation but what should I put in my code that would tell it so? I'm using Kzisor/Ysovuka's  transformation code

As of now this is my night vision code 

local function RestoreNightvision(inst)

  inst:DoTaskInTime(3, function(inst)
  inst.Light:Enable(true)
  inst.Light:SetRadius(1)
  inst.Light:SetFalloff(20)
  inst.Light:SetIntensity(.1)
  inst.Light:SetColour(245/255,40/255,0/255)
  end, inst)
end

local function UpdateNightVision(inst, phase)
local enable = phase == "night"
inst:DoTaskInTime(enable and 0 or 1, function(inst)
  inst.components.playervision:ForceNightVision(enable)
  inst.components.playervision:SetCustomCCTable(enable and {} or nil)
end)
end

local function OnInitNightVision(inst)
if TheWorld.ismastersim or inst.HUD then
  inst:WatchWorldState("phase", UpdateNightVision)
  UpdateNightVision(inst, TheWorld.state.phase)
end
end

this is in my local common_postinit

inst:DoTaskInTime(0, OnInitNightVision)


2. Also what colorcube codes should I use to get this sort of look? Original picture from SuperDavid. As of now my night vision is super bright a fully lit as if there were no difference from the day time and night time. I'd like to have it dimmer and bluer similar to how it looks when there's a full moon at night 

20160822222147_1.jpg

3.  I'd also like to only eat raw meats while in lycan form, but I'm not sure where to put that or how to do it. 

Oh one more thing, this is alot to ask but much feedback from steam has been conflicted with people clamoring for night vision or not to have it at all. I'd like to add a configurable setting to the mod where you can choose to play with it or without it. Does anyone know how to do this? 

If anyone has answers I'd love to hear them, thanks so much guys! Much appreciated!

Edited by AiZenaku
local BEAVERVISION_COLOURCUBES =
{
    day = "images/colour_cubes/beaver_vision_cc.tex",
    dusk = "images/colour_cubes/beaver_vision_cc.tex",
    night = "images/colour_cubes/beaver_vision_cc.tex",
    full_moon = "images/colour_cubes/beaver_vision_cc.tex",
}

I know this line of code has something to do with it. I looked all through Woodies files and this was all I had found that had something to do with night vision. There might be more, I can send you Woodies script or the list of night vision color cubes if you'd like.

Just now, Andreasgamming said:

local BEAVERVISION_COLOURCUBES =
{
    day = "images/colour_cubes/beaver_vision_cc.tex",
    dusk = "images/colour_cubes/beaver_vision_cc.tex",
    night = "images/colour_cubes/beaver_vision_cc.tex",
    full_moon = "images/colour_cubes/beaver_vision_cc.tex",
}

I know this line of code has something to do with it. I looked all through Woodies files and this was all I had found that had something to do with night vision. There might be more, I can send you Woodies script or the list of night vision color cubes if you'd like.

Hey Thanks! I have woodie's script right now, I've downloaded a mod that also has configurable night vision but I can't really decipher what goes where since it's components in the lua file are so old. 

 

The mod is called Thana, the night stalker. I'm just confused as to how to get my nightvision refer to the configure-able component in the mod info lua. 

illyria.lua

modinfo.lua

modmain.lua

Here's thana's lua 

thana.lua

1 minute ago, Andreasgamming said:

Okay I made a couple of teaks to the code but as of doing the full configuration I'm still figuring that part out...

illyria.lua

modinfo.lua

modmain.lua

Oh wow! Thanks, just for my sake, which lua did you change? Or what did you tweak?

Modinfo and modmain I had added 'default' to the configuration so people would know which was default. and made sure it was declared  in the modmain. I'm trying to figure out how to make it fully configurable for my own character as well...

Edited by Andreasgamming

@Andreasgamming I know there's some kind of inst.component needed, just not sure what goes after it and I think it goes in common_postinit haha. 

would I have to add something like;

  inst:AddComponent("NIGHTVISION")
    inst.components.heater.heat = TUNING.HEATER_AURA 

but obviously I'd have to change the heater.heat=TUNING.HEATER_AURA

Edited by AiZenaku
local function SetBeaverVision(inst, enable)
    if enable then
        inst.components.playervision:ForceNightVision(true)
        inst.components.playervision:SetCustomCCTable(BEAVERVISION_COLOURCUBES)
    else
        inst.components.playervision:ForceNightVision(false)
        inst.components.playervision:SetCustomCCTable(nil)
    end
end

Just found these lines of codes in woodies script. I think there is another component for it to be added.

5 minutes ago, Andreasgamming said:

local function SetBeaverVision(inst, enable)
    if enable then
        inst.components.playervision:ForceNightVision(true)
        inst.components.playervision:SetCustomCCTable(BEAVERVISION_COLOURCUBES)
    else
        inst.components.playervision:ForceNightVision(false)
        inst.components.playervision:SetCustomCCTable(nil)
    end
end

Just found these lines of codes in woodies script. I think there is another component for it to be added.

Oh nice! I think I want to keep the current color cubes I have which is currently:

inst.Light:SetColour(70/255,255/255,12/255)

I found the color and look I was looking for which was my #2 question, I'd probably have to change these parts 
 

   inst.components.playervision:SetCustomCCTable(BEAVERVISION_COLOURCUBES)


        inst.components.playervision:SetCustomCCTable(nil)

 

2 minutes ago, Aquaterion said:

I think playervision exists on all players, so you shouldn't have to do the "AddComponent" part

Ah right I see, 

So I'd have to add something like 


  inst.components.playervision:AddActionListener("LYCAN", TUNING.ILLYRIA.NIGHTVISION")
  end

this is probably very wrong but, I feel like i'm somewhat on the right path

not sure where you got the AddActionListener

but


local function SetBeaverVision(inst, enable)
    if enable then
        inst.components.playervision:ForceNightVision(true)
        inst.components.playervision:SetCustomCCTable(BEAVERVISION_COLOURCUBES)
    else
        inst.components.playervision:ForceNightVision(false)
        inst.components.playervision:SetCustomCCTable(nil)
    end
end

this method is called when woodie transform to or from beaver, with the if statement dictating if it was into woodie or beaver. So you probably need to call a similar method when you transform, and change what is in the SetCustomCCTable()

@Aquaterion ahh okay, was trying to figure out that component part that links the nightvision configurable setting to it. I'll try it again later, will focus on the nightvision to lycan form, thanks!

Okay so this is probably a stupid question but how do I change the statement to refer to my lycan form? I see beaverness everywhere in woodie's files. I also downloaded a similar mod:

just to see how it works and dracula's mod refers to a bat_form much like the beaver form. So how would I know if my statement works? I'm still quite new at coding. Sorry if this question is dumb. I'm pretty sure I can't just write local function SetlycanVision or something rubbish like that 

Update on this, got the blue nightvision color cubes to work. 

Thanks @Andreasgamming! My other code didn't work, I thought I was doing something wrong but I just saw your comment on this post.

So it looks like this now! Now to configure the night vision and attach it to her lycan form...which I'm really stuck on 

image.thumb.png.46bc9e3d92e42cccb2b8554694bc3e38.png


posting updated lua files for anyone that has a solution to this 

modinfo.lua

modmain.lua

illyria.lua
 

Edited by AiZenaku

So I was experimenting on ways to get my nightvision to turn on in lycan form, I added it in my transformation code which is in my modmain.lua but it turns the nightvision into mole vision (miraculously works though). I'm guessing this makes the nightvision in my character lua redundant...but how do I get the modmain to refer to my nightvision cubes in my character lua? 

local function IllyriaFn(inst)

local player = GLOBAL.ThePlayer

if inst:HasTag("playerghost") then return end
if inst.transformed then
    inst.AnimState:SetBuild("illyria")
        local x, y, z = inst.Transform:GetWorldPosition()
        local fx = SpawnPrefab("maxwell_smoke")
        fx.Transform:SetPosition(x, y, z)
        SpawnPrefab("statue_transition").Transform:SetPosition(inst:GetPosition():Get())
    inst.components.locomotor.walkspeed = 10.1
    inst.components.locomotor.runspeed = 11.1
    inst.components.sanity.absorb = 0.8
    inst.components.combat.damagemultiplier = 1
    inst.Transform:SetScale(1, 1, 1)
    inst.components.hunger:SetRate(TUNING.WILSON_HUNGER_RATE)
	inst.components.playervision:ForceNightVision(false) 
	inst.components.playervision:SetCustomCCTable(nil)

    inst.components.talker:Say("Whoops!", 2.5,true)

    else
            inst.AnimState:SetBuild("lycan")
            inst.SoundEmitter:PlaySound("dontstarve/sanity/creature2/taunt")
            local x, y, z = inst.Transform:GetWorldPosition()
            local fx = SpawnPrefab("maxwell_smoke")
            fx.Transform:SetPosition(x, y, z)
            SpawnPrefab("statue_transition_2").Transform:SetPosition(inst:GetPosition():Get())
        inst.components.locomotor.walkspeed = 11.1
        inst.components.locomotor.runspeed = 12.1
        inst.components.sanity.absorb = 0.15
        inst.components.combat.damagemultiplier = 2.5
        inst.Transform:SetScale(1.3, 1.3, 1.3)
        inst.components.hunger:SetRate(1)
		inst.components.playervision:ForceNightVision(true)
        inst.components.playervision:SetCustomCCTable(BEAVERVISION_COLOURCUBES)

        inst.components.talker:Say("BOOF.", 2.5,true)


end

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
×
  • Create New...