ZenCoder's fix for PlayerBots
Posted: Tue Apr 27, 2021 2:15 am
I'm not a coder, doing scripts is not my strong suit... but I copy & paste with the best of them!
I was toying with this for awhile, before I actually tried it... and admittedly screwed up a map I'd been editing for a very long time.
The annoying thing about summoning playerbots, or editing them directly onto a map, is they can't be team assigned and they all show up on the scoreboard as "Player". This is especially annoying if you are working with more than one of them. But due to a recent map edit I've been working on, 1 of 4, I discovered there's been a work-around for this that I somehow never noticed before...
...which was especially annoying as I've been asking if this were possible for years and everybody told me it couldn't be done!
Part of the mapping edits I've been working on is this map:
https://unrealarchive.org/maps/unreal-t ... a6ea8.html
That map is especially interesting as it has a playerbot embedded into the map, but it's on the Red Team and it actually has a name. So I studied how that was setup to see if I could do it, while I did a review of more of ZenCoder's work to see if he'd done similar anywhere else.
As I've since learned, this method only works with one player model type at a time, you can setup multiple bots on the map this way but they each have to be a different model... which may explain why ZenCoder only had one on one team. But the basic code is pretty simple:
//=============================================================================
// Ronald.
//=============================================================================
class Ronald expands MaleOneBot;
function PostBeginPlay(){
PlayerReplicationInfo.PlayerName = "Ronald the Clone";
PlayerReplicationInfo.Team = 0;
}
With slight alterations, I've used that on 5 different player models for a few maps already... but as stated, I can only do that with one player model per team (if I've got a Boss model on 1 team I can't have one on the other team). Try to do 2 with that on any map, the map won't work and you'll have to start over from scratch.
I did find another map ZenCoder had done this on:
https://unrealarchive.org/maps/unreal-t ... ea07d.html
This time around it was the Abbey model and it was for more than one of the same model type.
That looks like this...
//=============================================================================
// Amazon.
//=============================================================================
class Amazon expands AbbeyBot;
var() int myTeam;
function PostBeginPlay(){
PlayerReplicationInfo.Team = myTeam;
if ( myTeam == 0 ) {
PlayerReplicationInfo.PlayerName = "Sheena";
multiskins[0] = texture'MyLevel.Amaz1T_0';
} else {
PlayerReplicationInfo.PlayerName = "Xena";
multiskins[0] = texture'MyLevel.Amaz1T_1';
}
}
The screenshot at the top of this post was my attempt to do it, and it worked. I'm doing a re-edit of the CTF-ColaWars map.
Now, I only know how to use it to the extent of making slight variables in what's there, but I'm no coder. I can't make them do auto-taunts, I can't alter their skill level (which is probably a good thing) but I can use them fairly basically for fillers.
Just wanted to share, and to those who told me this was impossible... I will have blood vengeance!
But, moving right along, there are still complications.
For the 1st version you have to skin the model after you place it on the map, but with the 2nd version you can skin it in the code so long as the skin is 1 texture for the entire model. However, if the model is a multi-texture deal then you're better off skinning it as with the 1st version...
...though those better at coding might be able to find work-around for that too.
I was toying with this for awhile, before I actually tried it... and admittedly screwed up a map I'd been editing for a very long time.
The annoying thing about summoning playerbots, or editing them directly onto a map, is they can't be team assigned and they all show up on the scoreboard as "Player". This is especially annoying if you are working with more than one of them. But due to a recent map edit I've been working on, 1 of 4, I discovered there's been a work-around for this that I somehow never noticed before...
...which was especially annoying as I've been asking if this were possible for years and everybody told me it couldn't be done!
Part of the mapping edits I've been working on is this map:
https://unrealarchive.org/maps/unreal-t ... a6ea8.html
That map is especially interesting as it has a playerbot embedded into the map, but it's on the Red Team and it actually has a name. So I studied how that was setup to see if I could do it, while I did a review of more of ZenCoder's work to see if he'd done similar anywhere else.
As I've since learned, this method only works with one player model type at a time, you can setup multiple bots on the map this way but they each have to be a different model... which may explain why ZenCoder only had one on one team. But the basic code is pretty simple:
//=============================================================================
// Ronald.
//=============================================================================
class Ronald expands MaleOneBot;
function PostBeginPlay(){
PlayerReplicationInfo.PlayerName = "Ronald the Clone";
PlayerReplicationInfo.Team = 0;
}
With slight alterations, I've used that on 5 different player models for a few maps already... but as stated, I can only do that with one player model per team (if I've got a Boss model on 1 team I can't have one on the other team). Try to do 2 with that on any map, the map won't work and you'll have to start over from scratch.
I did find another map ZenCoder had done this on:
https://unrealarchive.org/maps/unreal-t ... ea07d.html
This time around it was the Abbey model and it was for more than one of the same model type.
That looks like this...
//=============================================================================
// Amazon.
//=============================================================================
class Amazon expands AbbeyBot;
var() int myTeam;
function PostBeginPlay(){
PlayerReplicationInfo.Team = myTeam;
if ( myTeam == 0 ) {
PlayerReplicationInfo.PlayerName = "Sheena";
multiskins[0] = texture'MyLevel.Amaz1T_0';
} else {
PlayerReplicationInfo.PlayerName = "Xena";
multiskins[0] = texture'MyLevel.Amaz1T_1';
}
}
The screenshot at the top of this post was my attempt to do it, and it worked. I'm doing a re-edit of the CTF-ColaWars map.
Now, I only know how to use it to the extent of making slight variables in what's there, but I'm no coder. I can't make them do auto-taunts, I can't alter their skill level (which is probably a good thing) but I can use them fairly basically for fillers.
Just wanted to share, and to those who told me this was impossible... I will have blood vengeance!
But, moving right along, there are still complications.
For the 1st version you have to skin the model after you place it on the map, but with the 2nd version you can skin it in the code so long as the skin is 1 texture for the entire model. However, if the model is a multi-texture deal then you're better off skinning it as with the 1st version...
...though those better at coding might be able to find work-around for that too.