• TTT TargetID
    2 replies, posted
Working on a Detective weapon for TTT. The Detective can designate someone as a pseudo-Detective (they will lose their status if they kill an Innocent). The issue I'm having is how to deal with designating Traitors as Detectives. My plan is to make them appear as Detectives to everyone except other Traitors when designated. However, I'm not sure what functions I should be overriding from the gamemode. I thought about overriding GM:HUDDrawTargetID(), but I'm not sure if that's a thing custom HUDs often use. I also thought about override GetDetective() in the Player metatable. This way I could set a flag on Traitors (i.e ply.FakeDetective = true) and check for that in GetDetective(). This means that I won't really be causing any issues with HUDs or other addons (unless they also override this). So I tried the second route. After some testing, the override seems to have work but TTT's HUDDRawTargetID() function doesn't seem to be using the overridden functions somehow? Here is what I've tested so far (On PasteBin because code formatting on FP is fucked right now) Here is the relevant code in the TTT gamemode itself with some reasoning as to why what I am doing should work.
After some testing I realized that my IsDetective() override is not taking effect on clients for some reason. Running this on the server (after calling "ttt_deputy_forceall") properly shows the Traitors that are fake Detectives as Detectives (IsDetective() is returning true as it should) lua_run for k,v in pairs(player.GetAll() do print(v:Nick(), v:IsDetective()) end However, after enabling sv_allowcslua and running: lua_run_cl for k,v in pairs(player.GetAll() do print(v:Nick(), v:IsDetective()) end This is NOT properly showing Traitors that are fake Detectives as Detectives (IsDetective() is returning false when it should be true) Could this be the hook I am using to set this up? (InitPostEntity)
Got everything working (had to use net messages to completely fix it). However, whenever SendFullStateUpdate() is called, it seems to reset the Traitors showing as fake Detectives (they go back to just appearing as Innocents to other people).
Sorry, you need to Log In to post a reply to this thread.