Jump to content

[help?] Sending fake messages into chat of 1 player


Recommended Posts

Working on a new hallucination for my mod. 

Concept: The Dark clone comes to player and talks to him. Phrases he tells appear above his head and  in the chat, only madman sees them.

 

In file worldsanitymonsterspawner.lua I used this:

ThePlayer.HUD.controls.networkchatqueue:OnMessageReceived(0, nameof, pharseforclone, darkclone.textcolour ,true)

Fake phrases appear in the chat, but the problem is: only host sees all fake messages (mad players who should - do not.) 

 

 

I remade code into this ( "ThePlayer" in  worldsanitymonsterspawner.lua refers to host. "player" refers to the mad player.)

local player = playerdata.playerplayer.HUD.controls.networkchatqueue:OnMessageReceived(0, nameof,pharseforclone, darkclone.textcolour ,true)

But this makes game crush, because I  can't call "HUD" using from hosts component... 

 

 

Any ideas how to make this work?

 

Edited by Desblat
Link to comment
Share on other sites

@Desblat, Well, that code needs to be running on the computer of the player who's receiving the message, since only ThePlayer in any given Sim/Sim Replica has HUD.

 

I'm trying to think about how you could handle this... I think you'd want to make a new component on the hallucination prefabs that's local (i.e. added before if not TheWorld.ismastersim then return inst end). You'd probably still need a way to communicate from the host to the client who the hallucination is targeting (via GUID, I think? or userid), which you could do with a tag, but would probably be better done with the networked variables-- the best example of how those work is in player_classified, but I'm still pretty fuzzy on how the overall information flow for them works.

Link to comment
Share on other sites

@Desblat, Well, that code needs to be running on the computer of the player who's receiving the message, since only ThePlayer in any given Sim/Sim Replica has HUD.

 

I'm trying to think about how you could handle this... I think you'd want to make a new component on the hallucination prefabs that's local (i.e. added before if not TheWorld.ismastersim then return inst end). You'd probably still need a way to communicate from the host to the client who the hallucination is targeting (via GUID, I think? or userid), which you could do with a tag, but would probably be better done with the networked variables-- the best example of how those work is in player_classified, but I'm still pretty fuzzy on how the overall information flow for them works.

Sounds legit.

 

Ok, I got this working by adding fake message function to the sanity.lua, need some more tests to find out if only madman sees phrases.

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