Jump to content

We want our character blind!

Recommended Posts

Is it possible to not make our character see the map? As in, no matter how many times he looks at the map he'll forever see nothing but his Map icon. (Maybe not even his map icon)


Or alternatively, just disable him from using the map completely. Though we much prefer the 1st option.


Link to comment
Share on other sites



You have to make sure this runs on the client, though, so finding the right hook to run the code may be a challenge. Once you find the right place for it to run, you can check that you're on the client with this:

if ThePlayer.prefab == "mycharacterwhocantseethemap" then    --clear minimapend

As for the right place to run... maybe this?

inst:ListenForEvent("setowner", fn)

So to put that all together, in the character's common_postinit, put this:

inst:ListenForEvent("setowner", function()    if ThePlayer.prefab == inst.prefab then        TheWorld.minimap.MiniMap:ContinuouslyClearRevealedAreas(true)    endend)

You might also need a way to restore this behavior on the ghost -> living character transition, but I think it will get preserved without a special case for that.

Link to comment
Share on other sites

@rezecib, Everything is going well! Well, maybe a bit too well.


So during some quick testing I noticed when I entered in console:

local p = ThePlayer DeleteUserSession(p) p:Remove()

Then chose a different character, my Character's No-map awareness perk is still in place. As in, no matter how many times I changed characters it still has his character perk.


Now I thought it was because i didn't replace

  if ThePlayer.prefab == inst.prefab thenwith  if ThePlayer.prefab == "thecharacter" then

but even doing so, other characters still gain his no map awareness perk. I wonder if there's a way to bypass this?

Link to comment
Share on other sites

@rons0n, did you try adding an else statement and setting it to false?

if ThePlayer.prefab == inst.prefab then   TheWorld.minimap.MiniMap:ContinuouslyClearRevealedAreas(true)else   TheWorld.minimap.MiniMap:ContinuouslyClearRevealedAreas(false)end 
Link to comment
Share on other sites

@Kzisor, Or a little bit more easily written as:

TheWorld.minimap.MiniMap:ContinuouslyClearRevealedAreas(ThePlayer.prefab == inst.prefab)

Edit: Also, @rons0n, there's a command for switching characters now, c_despawn(ThePlayer)


rons0n isn't that great with code, so I was using code which might be a little easier to understand when they look back at it in the future. I've been helping them with their mods a lot so I want to make sure they understand how it works. I think using your code would be best rezecib as it's the most optimized and it's understandable now as I've posted the basics of how it works, that is it works like the if-else statement without the if-else statement being there.

Link to comment
Share on other sites

@rons0n, is it affecting all players on the server or just you when you change characters?


If it's affecting all players try:

if not TheWorld.ismastersim then    TheWorld.minimap.MiniMap:ContinuouslyClearRevealedAreas(ThePlayer.prefab == inst.prefab)end

It might be the case of how Lights work, if on non-dedicated servers the host has a light source equipped to their character it affects all players on the server.

Edited by Kzisor
Link to comment
Share on other sites

His TheWorld must keep existing when he changes characters.


When you pick that character, TheWorld gets told to not update.

When you don't pick it, TheWorld gets told nothing.

Not picking that character does not equate to setting revealed areas into false.

Therefore, the perk persists.

TheWorld = GLOBAL.TheWorldAddPlayerPostInit(function(inst)   TheWorld.minimap.MiniMap:ContinuouslyClearRevealedAreas(inst.prefab == "thecharacter")end)

Try this.

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

  • Create New...