Jump to content

Making a character invisible to monsters?


Recommended Posts

I know that there's a console command that makes character invisible to monsters, c_makeinvisible(1). I'm trying to figure out how to add this to a character as a feature so that that specific character is always invisible to monsters. I've tried adding the "monster" tag to the character but that doesn't seem to be working as they still get attacked while insane.

How do I do this?

Link to comment
Share on other sites

 

function c_makeinvisible()
    local player = ConsoleCommandPlayer()
    player:AddTag("debugnoattack")
    print("Has debugnoattack tag?", player, player:HasTag("debugnoattack"))
end

From the files.

I haven't checked how far reaching debugnoattack tag has, so there might be other side effects that this introduces.

Link to comment
Share on other sites

On 8/14/2020 at 12:05 AM, CarlZalph said:

 


function c_makeinvisible()
    local player = ConsoleCommandPlayer()
    player:AddTag("debugnoattack")
    print("Has debugnoattack tag?", player, player:HasTag("debugnoattack"))
end

From the files.

I haven't checked how far reaching debugnoattack tag has, so there might be other side effects that this introduces.

Where is the character's prefab file should this go? 

Update: This isn't working regardless of where in the character's prefab or modmain files I put it. I get an error and the game won't load.

Edited by JennaBelle
update
Link to comment
Share on other sites

That is a command you run in the console.

If you want to add it to your prefab, then you can add 

inst:AddTag("debugnoattack")

into your prefab code before the :SetPristine() or TheWorld.ismastersim check.

Also, like Carl said, there's no guarantee that you won't be attacked. For example, frogs appear to ignore that and will attack anyway.

Edited by penguin0616
  • Like 1
Link to comment
Share on other sites

On 8/27/2020 at 1:55 PM, penguin0616 said:

That is a command you run in the console.

If you want to add it to your prefab, then you can add 


inst:AddTag("debugnoattack")

into your prefab code before the :SetPristine() or TheWorld.ismastersim check.

Also, like Carl said, there's no guarantee that you won't be attacked. For example, frogs appear to ignore that and will attack anyway.

I can't find either of ":SetPristine()" or "TheWorld.ismastersim" in the character's prefab file. Are you maybe talking about a different prefab file? Because this needs to be included with the character as a feature.

Link to comment
Share on other sites

20 hours ago, penguin0616 said:

Should have clarified, it would go before the :SetPristine() or TheWorld.ismastersim check in the player_common if you were doing it to each character. 

Assuming this is a vanilla character, you can add it to their master_postinit,

it's actually a custom character, not one of the vanilla characters. Does that change anything?

Link to comment
Share on other sites

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
 Share

×
  • Create New...