Jump to content

Recommended Posts

What exactly do you want?
You can make things transparent and also colourize it with:

inst.AnimState:SetMultColour(R/255, G/255, B/255, alpha)

just insert RGB values for R/G/B and alpha between 0 and 1.
If you execute this only for one client, only this client will see that change (eg. check if the player.prefab is xy or if players sanity is at specific level and so on.)

Edited by Serpens
5 hours ago, Serpens said:

What exactly do you want?
You can make things transparent and also colourize it with:


inst.AnimState:SetMultColour(R/255, G/255, B/255, alpha)

just insert RGB values for R/G/B and alpha between 0 and 1.
If you execute this only for one client, only this client will see that change (eg. check if the player.prefab is xy or if players sanity is at specific level and so on.)

Trying to find a way to make shadow creatures always visible. I will test this code when I return from school.

 

ah, ok for shadowcreatures you should use "transparentonsanity" as penguin0616 already suggested.
And no need to create a new thread, you also could use your old thread "What is the code that dictates how visible nightmare creatures are?"

I'm currently trying around with that component, but it is not that easy. Already tried several ways, will report back if I found a good one.
But:
even if we succeed to change this component to make shadows visible, that does not mean your chararcter will always see them. Because if no one is insane, there are no shadows (they are not invisible, they are not even there). And even if there are there, your character will see them, but will be unable to attack them.


So the question is, if this is still what you want or not.
You have to be more precise, why you want the shadows to be seen. Do you also want to be able to attack them? Do you want to see some, although no one is insane (which would mean we need to spawn them) and so on.

edit:
my working code to make them visible is this (in modmain.lua):

local TheNet = GLOBAL.TheNet
local SERVER_SIDE, DEDICATED_SIDE, CLIENT_SIDE, ONLY_CLIENT_SIDE
if TheNet:GetIsServer() then
    SERVER_SIDE = true
    if TheNet:IsDedicated() then
        DEDICATED_SIDE = true
    else
        CLIENT_SIDE = true
    end
elseif TheNet:GetIsClient() then
    SERVER_SIDE = false
    CLIENT_SIDE = true
    ONLY_CLIENT_SIDE = true
end

if CLIENT_SIDE then -- only continue for clients (because the TransparentOnSanity component does not exist at server according to Note in file, and we only want to change it for a specific client, not for everyone)
    AddComponentPostInit("transparentonsanity",function(self) -- change this component, to always show everything that uses "transparentonsanity".
        local player = GLOBAL.ThePlayer
        if player~=nil and player.prefab=="wilson" then -- if we are this character, 
            self.inst:DoTaskInTime(0.1,function() self.calc_percent_fn = function() return 1 end end) -- do it with delay, because some inst are defining calc_percent_fn shortly after init
        end
    end)
end

Replace "wilson" with your character prefab.
this is setting a calc_percent_fn to that component that returns 1 and thanks to the devs this overwrites the sanity check, so everything that uses this component will be always visible.
To test it you can open the console and write " c_spawn("crawlinghorror") " , you should be able to see it although you are not insane. But as  said, you won't be able to attack him or they won't spawn shaodws in its own, unless you are insane.

If you instead want insanity effects without being insane, you should take a look at that amulet that does this.

Edited by Serpens
16 minutes ago, Earthyburt said:

I do want my character to be able to attack them at all times, and I suppose have them spawn around him too. So I will have a look at that amulet when I finish school

The easiest would be of course to apply the amulet effect unchanged to your character with
inst.components.sanity:SetInducedInsanity(inst, true)
Then think carefully what of the effects from this you don't want. And only for the ones that are really breaking your character, we could try to disable it (for example the screen effects, no one want to play with this active all the time)

Edited by Serpens

The effects I dont want would be the screen effect, nightmare hand (**** that thing), the color blindness, insane idle animation, and having shadow creatures attack, until when my character is insane enough to suffer from those. I would probably have to use if then statements to do this, or if Lua supports them, switch statements, which honestly, I doubt Lua supports switch statements.

Edited by Earthyburt

ok.... I think it might be doable to disable all these, if it is your character, but it is a hell of work (eg. overwrite playerhud GoInsane function to remove the screen effects if it is your character and so on)

It might be easier to copy the code of the nightmare creatures you want to spawn around your character and make them a new prefab, that is alawys visible to your character and does not attack (so not overwrite the old, but make a new mob, with the same look).  Then your code can spawn them around your character from time to time. But also this is not easy.

Both is that much work, that I can't write you the code for that.

So maybe you should make a simpler character. If you just want a source for nightmarefuel, maybe you have another idea for this.

Edited by Serpens
  • Thanks 1

Yeah, thats what I was afriad of. But I can live with it. Besides, the nightmare fuel was the main reason why I wanted this feature, so I am willing to find another way stat for my character. Maybe in the future, I can remake this character when I have a lot more experience. I am willing to use something similar to Wormwood does, since it is relevant to the character.

Alright, my new stat for this is that he is able to create some monster fuel with 1 flint and 20 health. I am also gonna scrap the day blindness mechanic aswell, and stick with the idea of my character being alot weaker during the day.

Edited by Earthyburt

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...