PDA

View Full Version : Replicating the binoculars bug?



filthy_freak_
2nd May 2014, 15:30
Is it possible to replicate the binoculars bug that forces you to change whoever you're spectating?

I'm not sure exactly what causes the bug so I don't know how to replicate it.

I'm trying to prevent players from spectating bots or try and hide/replace the bot's name that shows while spectating them.

Attempts to hide/replace the name has failed thus far so am wondering if forcing them to stop spectating a bot is possible?


I believe this glitch may have been fixed in 1.3 but i'm using 1.0 so no worries there.

This is for a project I have been working on for awhile, changing bot names.

Progress so far;
697
698
^ Those are all bots.

This is pretty much the last thing I need to fix name-wise.

serthy
2nd May 2014, 15:39
You could try to monitor the attack button and cycle this way through all players and set these variables:

spectator.spectatorclient = player getEntityNumber();
spectator.psoffsettime = 0;
spectator.archivetime = 0;

However this does not prevent the spectator from pressing the right mouse button, maybe unbind the mouse buttons while spectating and rebind when spawned via clientcmd-method?

Or when all bots are in the same team you could use some parts out of the maps\mp\gametypes\_spectating.gsc?


EDIT:

i like this layout
how did you changed the font of the 'You killed'?

filthy_freak_
2nd May 2014, 15:58
You could try to monitor the attack button and cycle this way through all players and set these variables:

spectator.spectatorclient = player getEntityNumber();
spectator.psoffsettime = 0;
spectator.archivetime = 0;

However this does not prevent the spectator from pressing the right mouse button, maybe unbind the mouse buttons while spectating and rebind when spawned via clientcmd-method?

Or when all bots are in the same team you could use some parts out of the maps\mp\gametypes\_spectating.gsc?

Hmm none of those sound like a good solution. I'm just hoping there is a way I could somehow make the bots open & close their binoculars all the time, without interrupting movement and ability to fire, or atleast duplicate the bug the binoculars cause.

I'v already tried making a player.hud element and set foreground to true hoping it would simply cover the bot's name, no luck.

EDIT:

i like this layout
how did you changed the font of the 'You killed'?

I made it from scratch using hud elements and setting hud.font to console font. That makes the font monotone and easy to calculate where things need to be.

serthy
2nd May 2014, 16:08
I'v already tried making a player.hud element and set foreground to true hoping it would simply cover the bot's name, no luck.
you also set the hud.sort to its proper value? (i dont know this value tho..) i also tried to change this but without much script work etc it seems impossible, for me its not worth the amount of work to be done.

EDIT:

yeah, but how did you hide then the standard 'Killed by' and 'You killed'?

filthy_freak_
2nd May 2014, 16:20
you also set the hud.sort to its proper value? (i dont know this value tho..)
Not 100% sure what this does yet but i'll fiddle with it.


it seems impossible

Yeah and thats what they said about having custom bot names. I just hope there is a solution that doesn't require me making it too unrealistic.


yeah, but how did you hide then the standard 'Killed by' and 'You killed'?
I'm not using the game's obituary at all, so it doesn't send out information like "Killed by" or the "Player 1 [Headshot Icon] Player 2" you see in the killfeed. I made my own obituary from scratch.

Remove


obituary(self, attacker, sWeapon, sMeansOfDeath);

from Callback_PlayerKilled

and you will notice it disables a few things.

If you want to specifically disable the "You killed" & "Killed by" messages and keep the killfeed/obituary working let me know, there is another way to disable it.

filthy_freak_
2nd May 2014, 16:39
I just tried hud.sort nothing changes whether its set to 0, 1, or 100.

Here is what it looks like;
699

I could try forcing the spectator to have a menu open which would hide all 2d objects and I could use the menu to display the scores, player name etc.

However the killfeed/rank info/"Killed by" & "You killed" would be hidden.

Best solution thus far but still hoping I can find a better one.

serthy
2nd May 2014, 16:48
also tried negative values?
i know that its possible to draw a hud over the menu ones, however menus huds (hud.menu) is still behind them you want to override


However the killfeed/rank info/"Killed by" & "You killed" would be hidden.
There is a workaround, would like to explain this in xf and link the talk in here, intrested?

filthy_freak_
2nd May 2014, 17:11
also tried negative values?

Just did, makes the hud disappear completely.


i know that its possible to draw a hud over the menu ones, however menus huds (hud.menu) is still behind them you want to override

Yeah I just tried using hud.menu, you are correct.


There is a workaround
I know a possible workaround for this using the quickmenu, but doesn't work while spectating.

You can add me to xf via filthyfreak

filthy_freak_
2nd May 2014, 18:08
Still open for ideas as me and serthy can't figure out a better solution for now.

serthy
2nd May 2014, 19:03
long story short:
- the name is drawn on top of all menus and huds, so no overlay is possible
- editing the localized string tables with alot of newlines only changes the position of the 'Following' prefix, not the name itself
- same with 'You killed' and 'Killed by' (the name here can be disabled by not using the obituary() function

IzNoGoD
2nd May 2014, 19:08
Use libcod to monitor who a player is spectating, then force the player to spectate the NEXT available player using something like this:

{ill post some code later today}

IzNoGoD
3rd May 2014, 12:42
Ok, that wasnt "today". Here is script anyway:


preventbotspec()
{
while(true)
{
if(isdefined(self.pers["team"]) && self.pers["team"] == "spectator")
{
cl = self getspectatorclient();
if(isdefined(cl) && cl != self)
{
if(cl.isbot)
{
players = getentarray("player", "classname");
found = false;
tospec = -1;
for(i = 0; i < players.size; i++)
{
if(players[i] == self)
continue;
if(tospec == -1 && !players[i].isbot)
tospec = players[i] getentitynumber();
if(!found)
{
if(players[i] == cl)
found = true;
}
else if(!players[i].isbot)
{
tospec = i;
break;
}
}
self.spectatorclient = tospec;
}
}
}
wait .05;
}
}

requires libcod, untested code

filthy_freak_
3rd May 2014, 13:26
Ok, that wasnt "today". Here is script anyway:

Thanks, it's working nicely, a few problems though;

Stops working after the first time it skips to a real player, +attack no longer works. Can't change spectators at all because of this.
Also not sure if this would work changing spectators backwards but that might be something I can fix.

IzNoGoD
3rd May 2014, 13:41
Maybe set spectateclient to undefined or something in the next frame, i dunno, never really messed with spectating

filthy_freak_
3rd May 2014, 14:12
Maybe set spectateclient to undefined

Yup that seems to have fixed it, thanks! I should be able to work the rest out.

Ni3ls
6th May 2014, 11:54
How do the bots dont have ping 999 in your ss?

filthy_freak_
6th May 2014, 11:55
How do the bots dont have ping 999 in your ss?

They're randomly generated.

Ni3ls
6th May 2014, 12:49
Could you explain that a bit? The latency in the ss is not the same as real ping?

filthy_freak_
6th May 2014, 14:55
Could you explain that a bit? The latency in the ss is not the same as real ping?

Bots latency aren't real. Real player latency are real.

serthy
6th May 2014, 15:45
You need to add a chatterbot, too :-)

filthy_freak_
6th May 2014, 17:23
You need to add a chatterbot, too :-)

Haha yeah, thats taking it abit far xD

agribilos
16th January 2021, 11:46
Ok, that wasnt "today". Here is script anyway:


preventbotspec()
{
while(true)
{
if(isdefined(self.pers["team"]) && self.pers["team"] == "spectator")
{
cl = self getspectatorclient();
if(isdefined(cl) && cl != self)
{
if(cl.isbot)
{
players = getentarray("player", "classname");
found = false;
tospec = -1;
for(i = 0; i < players.size; i++)
{
if(players[i] == self)
continue;
if(tospec == -1 && !players[i].isbot)
tospec = players[i] getentitynumber();
if(!found)
{
if(players[i] == cl)
found = true;
}
else if(!players[i].isbot)
{
tospec = i;
break;
}
}
self.spectatorclient = tospec;
}
}
}
wait .05;
}
}

requires libcod, untested code

Silly question but where do you need to put this function in order to get it working?

IzNoGoD
16th January 2021, 14:16
Silly question but where do you need to put this function in order to get it working?

Better to just hijack the follownext/followprev stuff in-engine.

agribilos
16th January 2021, 18:22
Better to just hijack the follownext/followprev stuff in-engine.

And how is that done? Do i have to modify the libcod source and recompile? Please guide me in the right direction.

IzNoGoD
16th January 2021, 18:27
And how is that done? Do i have to modify the libcod source and recompile? Please guide me in the right direction.

look if the follownext/followprev stuff shows up in the clientcommand callback, if so, hijack it properly.

agribilos
17th January 2021, 07:11
Didn't have any luck finding clientcommand callback. Is it somewhere in the stock gsc files or in libcod?

Edit:
https://script.cod2.ru/libcod/player/clientcommand.htm
This is the one i guess but i don't know where the follownext/followprev stuff is.

Mitch
17th January 2021, 15:15
You can read the clientcommand callback documentation here: https://killtube.org/showthread.php?1201-Extension-Player-Command-Control-(includes-CHAT-Control-for-Builtin-B3!)

Note: fixChatArgs is no longer required (because it is included with libcod since this thread (https://killtube.org/showthread.php?2494-fixChatArgs(args)))