Closed Jarzka closed 4 weeks ago
You will need to use CCSBot.Name
rather than player name I think. You would probably be best to find help on this on the Discord server
How do I access CCSBot.Name
? @event.UserId
returns CCSPlayerController
which has no information about CCSBot
🤔
You'll need to get access to the Pawn and then you can use the .As<CCSBot>()
helper to cast it to a bot.
Thanks for help.
I tried renaming the bot by doing:
CCSBot bot = @event.Userid.Pawn.Value.As<CCSBot>();
bot.Name = "Duke Nukem";
Console.WriteLine("Name changed to: " + bot.Name);
According to the console message, the bot name should have been changed, but when running status
command on my server it seems that nothing has actually changed. Also, when I join my server and add a bot player, the original name is still in place. 😞
I think you may also need to call the SetStateChanged
utility, which basically tells the server that this value has changed and needs to be propagated to clients.
Utilities.SetStateChanged(bot, "CCSBot", "m_name");
I'm not exactly sure how to pass bot
to SetStateChanged
since that function requires a class of CBaseEntity
and CCSBot
is not inherited from it.
I tried using As
casting and I think it worked, but I got an error that m_name
is not networked. I also tried m_Name
and got the same result:
Utilities.SetStateChanged(bot.As<CBaseEntity>(), "CCSBot", "m_name");
Utilities.SetStateChanged(bot.As<CBaseEntity>(), "CCSBot", "m_Name");
17:59:10 [WARN] (cssharp:Core) Field CCSBot:m_name is not networked, but SetStateChanged was called on it.
17:59:10 [WARN] (cssharp:Core) Field CCSBot:m_Name is not networked, but SetStateChanged was called on it.
EDIT: I think there is an easier way to retrieve the bot info from player. Instead of this:
var bot = @event.Userid.Pawn.Value.As<CCSBot>();
I can do this:
var bot = player.PlayerPawn.Value.Bot;
Only the later has the original bot name in bot.Name
so I believe this is the correct way. However, renaming the bot does nothing.
I think it's worth trying to edit that in a earlier game event, like OnPlayerConnect/OnPlayerConnectFull, since this field is not networked.
Good point! I tried the renaming in both OnPlayerConnect
and OnPlayerConnectFull
events but unfortunately neither of these worked any better.
Give me a ping on discord and we'll find a working solution for you 👍
Could you give me the solution here or perhaps suggest what to do? I do not use Discord and even if I did, I think it would be best to solve the problem here so that others can also see it.
Could you give me the solution here or perhaps suggest what to do? I do not use Discord and even if I did, I think it would be best to solve the problem here so that others can also see it.
Was this possible in CS:GO? https://forums.alliedmods.net/showpost.php?p=2035935&postcount=3
Could you give me the solution here or perhaps suggest what to do? I do not use Discord and even if I did, I think it would be best to solve the problem here so that others can also see it.
The main reason I try to keep this kind of discussion off of Github is because I would prefer GH issues to be issues relevant to the framework that can be fixed/added etc. This kind of issue is more a matter of reverse engineering effort and trial & error by individuals to see how Valves code actually works/investigate how these schema values actually propagate values across.
Was this possible in CS:GO?
CS:GO has built-in support for renaming bots on the server without plugins by configuring a file named Botprofile.db
. This file does not exist in CS2, which is why I'm looking for an alternative solution.
This kind of issue is more a matter of reverse engineering effort and trial & error by individuals to see how Valves code actually works
Okay, sorry, I didn't know this might require reverse engineering. I though there is already a way to do it, I just don't know how. 😆
CS:GO has built-in support for renaming bots on the server without plugins by configuring a file named
Botprofile.db
. This file does not exist in CS2, which is why I'm looking for an alternative solution.I was watching this thread hoping you guys found a way. I miss botprofile.db, the file still exists inside the games .pak files but you cannot change it of course (i tried). When this file existed you could change bot names, the pitch of their voice and more. You also used to be able to edit the ai profiles too, but now you also cannot do this either. I wish valve put some of the files back outside the pak files. Maybe one day the server plugins can call their own .db .ai files?
It seems that there IS still a way to rename bots using the good old Botprofile.db in CS2. Look here: https://www.reddit.com/r/GlobalOffensive/comments/16u8175/comment/kxolry1
I found a way that makes it possible for server owners to rename bots.
1. [Download VPKEdit](https://github.com/craftablescience/VPKEdit/releases)
2. Open VPKEdit and open the VPK file .\game\csgo\pak01_000.vpk
3. Extract botprofile.db to an empty folder
4. Make the desired changes in the botprofile.db with a text editor
5. Using VPKEdit, create VPK from folder, select the folder you extracted to in step 3
6. Rename the vpk to botprofile.vpk
7. Copy the new VPK to .\game\csgo\overrides\botprofile.vpk (Create the overrides folder)
8. Modify .\game\csgo\gameinfo.gi file, add the bold line between lowViolence and Game csgo, under FileSystem -> SearchPaths
Game_LowViolence csgo_lv
Game csgo/overrides/botprofile.vpk
Game csgo
It seems that there IS still a way to rename bots using the good old Botprofile.db in CS2. Look here: https://www.reddit.com/r/GlobalOffensive/comments/16u8175/comment/kxolry1
it works, thanks man.
It would be nice to rename bots on the server. Is there any way to do it? I tried the following code, but it did not work (name was not changed):