Need help with Zencoder's bot thing...

Discussions about Coding and Scripting
User avatar
EvilGrins
Godlike
Posts: 9839
Joined: Thu Jun 30, 2011 8:12 pm
Personal rank: God of Fudge
Location: Palo Alto, CA

Need help with Zencoder's bot thing...

Post by EvilGrins »

This is what he used to put 2 bots directly onto a map, team assigned:
//=============================================================================
// 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';
}
}

I'm no coder. I can cut & paste along with the best of them but if something goes wrong I can't tell where.

I tried to extend this to 4 teams, using a different model... and while all 4 bots popped onto the map where placed, the last 3 of them were identical and all on the same team even though it was set for 4 teams.

Done this before for 2 teams no problem.

Is this only possible for 2 teams and nothing more?

What I tried:
//=============================================================================
// SKtroop.
//=============================================================================
class SKtroop expands SkaarjBot;
var() int myTeam;

function PostBeginPlay(){

PlayerReplicationInfo.Team = myTeam;
if ( myTeam == 0 ) {
PlayerReplicationInfo.PlayerName = "Romeo";
multiskins[0] = texture'MyLevel.SKtrooper1';
} else {
PlayerReplicationInfo.PlayerName = "Bravo";
multiskins[0] = texture'MyLevel.SKtrooper2';

PlayerReplicationInfo.PlayerName = "Golf";
multiskins[0] = texture'MyLevel.SKtrooper3';

PlayerReplicationInfo.PlayerName = "Yankee";
multiskins[0] = texture'MyLevel.SKtrooper4';
}
}
http://unreal-games.livejournal.com/
Image
medor wrote:Replace Skaarj with EvilGrins :mrgreen:
Smilies · viewtopic.php?f=8&t=13758
User avatar
OjitroC
Godlike
Posts: 3689
Joined: Sat Sep 12, 2015 8:46 pm

Re: Need help with Zencoder's bot thing...

Post by OjitroC »

I'd say the Else statement has to be set up in a different way to what you have there - the first case after the Else is always going to be read and used with the others being ignored.

No idea if you can use 4 If statements or alternatively Else then If for each of the other 3 teams.

This compiles - I had to take the texture references out as I obviously don't have them and so then it wouldn't compile. No idea if you need to add anything else in the code as a sanity check?

Code: Select all

//=============================================================================
// SkTroop.
//=============================================================================
class SkTroop expands SkaarjBot;

var() int myTeam;

function PostBeginPlay(){

PlayerReplicationInfo.Team = myTeam;
if ( myTeam == 0 ) {
PlayerReplicationInfo.PlayerName = "Romeo";
} 
if ( myTeam == 1 ) {
PlayerReplicationInfo.PlayerName = "Bravo";
}

if ( myTeam == 2) {
PlayerReplicationInfo.PlayerName = "Golf";
}
if ( myTeam == 3) {
PlayerReplicationInfo.PlayerName = "Yankee";
}
}
Don't forget to check the log when something doesn't work - you should find some kind of indication of the error(s).
User avatar
sektor2111
Godlike
Posts: 6420
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Need help with Zencoder's bot thing...

Post by sektor2111 »

I don't see much "Team" deal here - it's the mostly a "Name" thing and... first time they won't jump like players in Hard-Core matches, only after ReSpawn...
MyTeam it's a new variable that doesn't look like it has something in common with "PlayerReplicationInfo.Team".
Does it compile ? If not, look for messages. Engine won't guess what you want anyway.
User avatar
OjitroC
Godlike
Posts: 3689
Joined: Sat Sep 12, 2015 8:46 pm

Re: Need help with Zencoder's bot thing...

Post by OjitroC »

sektor2111 wrote: Sat Mar 04, 2023 12:34 pm
Does it compile ? If not, look for messages. Engine won't guess what you want anyway.
Yes everything compiles - every version of the code shown above compiles.

As I understand it, the purpose of this code for the Bot is to give them names and team colours when placed in CTF maps on the Red and Blue teams. No log errors when played, beyond errors about the VoiceType accessing 'null class content' (because these are Bots but they have no assigned Voice Pack since there is no way to assign them a VP).
User avatar
sektor2111
Godlike
Posts: 6420
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Need help with Zencoder's bot thing...

Post by sektor2111 »

EvilGrins wrote: Fri Mar 03, 2023 9:12 pm the last 3 of them were identical and all on the same team even though it was set for 4 teams.
@Oijtroc
Re-read what he said - to me it's logic...
WHERE is SAID Team ? - I must ask. "MyTeam" is not "Team" and I don't see any relation than a code dealing with name - and the rest of needed things which are nowhere...
Does it compile ? Yes.
Result ? BAD.
Because ? Because there is no code for problem posted just "naming" codes... :lol2:
User avatar
OjitroC
Godlike
Posts: 3689
Joined: Sat Sep 12, 2015 8:46 pm

Re: Need help with Zencoder's bot thing...

Post by OjitroC »

sektor2111 wrote: Sat Mar 04, 2023 3:08 pm
EvilGrins wrote: Fri Mar 03, 2023 9:12 pm the last 3 of them were identical and all on the same team even though it was set for 4 teams.
@Oijtroc
Re-read what he said - to me it's logic...
WHERE is SAID Team ? - I must ask. "MyTeam" is not "Team" and I don't see any relation than a code dealing with name - and the rest of needed things which are nowhere...
Does it compile ? Yes.
Result ? BAD.
Because ? Because there is no code for problem posted just "naming" codes... :lol2:
I know, I know - it's pretty obvious isn't it? Of course there's no reference to Team (except in the 'if' statement) and there needs to be a reference to each Team in order for each Team Bot to have a different name and skin. That's why I said that EG's code needs to be done differently and that, as far as I know, " the first case after the Else is always going to be read and used with the others being ignored."

You asked if it compiled - I said yes it does, which doesn't mean of course that that is a good thing - I didn't think it necessary to state that assuming that you would know better than I that it is not a good thing.

I posited using 4 'If' statements, one for each Team and Team skin - I don't know if that is the correct way to do it but it seemed logical to me.

This code (more particularly the version of it used for the Bots-ColaWars map)

Code: Select all

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';
}
}
works for 2 teams in a normal CTF game and doesn't throw any log errors other than the VoiceType errors I have pointed to. Based on observation in a few games, the Red and Blue Bots appear to function as they should.
User avatar
sektor2111
Godlike
Posts: 6420
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Need help with Zencoder's bot thing...

Post by sektor2111 »

Dude... once again "MyTeam" has nothing to do here with "PlayerReplicationInfo.Team" - the same as the problem pointed toward UTDMT, "Byte" vs "Int" mixed together.

Code: Select all

class PlayerReplicationInfo expands ReplicationInfo
	native nativereplication;

	...
	var byte				Team;			// Player Team, 255 = None for player.
and

Code: Select all

class SKtroop expands SkaarjBot;
	var() int myTeam;
...
Try to compile "PlayerReplicationInfo.Team = MyTeam"... Good luck !

My Opinion: It's just a guess work, with zero logic. This Pawn embedded in map should follow some stages. Bots are joining in games based on a few stages, it's not like this embedded Pawn is doing what has to do. Game is not started but Pawn is already roaming, and so on, more things are missing...
If you think that assigning a Texture without a real "Team" assignment will work, then I'll tell you that you really don't understand what is all about. Texture and Name have ZERO deal with "Team". And this is why they are not working as they should, just like that.
Last edited by sektor2111 on Sat Mar 04, 2023 10:28 pm, edited 2 times in total.
User avatar
EvilGrins
Godlike
Posts: 9839
Joined: Thu Jun 30, 2011 8:12 pm
Personal rank: God of Fudge
Location: Palo Alto, CA

Re: Need help with Zencoder's bot thing...

Post by EvilGrins »

sektor2111 wrote: Sat Mar 04, 2023 3:08 pmWHERE is SAID Team ? - I must ask. "MyTeam" is not "Team" and I don't see any relation than a code dealing with name - and the rest of needed things which are nowhere...
Once you place the bot on the map, there's an option in it's properties where you can select which team it goes on.
http://unreal-games.livejournal.com/
Image
medor wrote:Replace Skaarj with EvilGrins :mrgreen:
Smilies · viewtopic.php?f=8&t=13758
User avatar
sektor2111
Godlike
Posts: 6420
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Need help with Zencoder's bot thing...

Post by sektor2111 »

What is the type used ?

Let me see.. you don't even understand what is INT and BYTE and there is ZERO code for "Team" settings - not that Trash called "MyTeam".
It's all based on "PlayerReplicationInfo.Team" - show me where is this variable defined... let me answer: Nowhere.
Resuming: In first post is posted a code that is clearly doubtfull, it's only a "NAME" crap, and ZERO deal with "Team".
If something goes another way, or it's luckily working, this means that something is bugged in execution(/and in compiler)... these vars are not the same type.
For me that lousy "Int" defined in pawn should be a "Byte" - "MyTeam".

I'm not curious what is the result when mapper is adding MyTeam = 20567 and Team is a byte up to 255 :loool: .
If code works for two teams you are lucky, because to me this is no deal...
This is why in 469 patches there is needed a lot of work for mitigating people's "creativity"...

Perhaps - as a return to normality the definition should be like this:

Code: Select all

class SKtroop expands SkaarjBot;

var() byte myTeam;

//function whatever()
if ( Level.Game.bTeamGame )
{
	... //Teams setup
}
else
	PlayerReplicationInfo.Team = 255;
...
Addiction issue: This "TrooperBot" will be restricted in Red Paths...
User avatar
EvilGrins
Godlike
Posts: 9839
Joined: Thu Jun 30, 2011 8:12 pm
Personal rank: God of Fudge
Location: Palo Alto, CA

Re: Need help with Zencoder's bot thing...

Post by EvilGrins »

Actually, 255 is no team.

This is what I meant.
You do not have the required permissions to view the files attached to this post.
http://unreal-games.livejournal.com/
Image
medor wrote:Replace Skaarj with EvilGrins :mrgreen:
Smilies · viewtopic.php?f=8&t=13758
User avatar
sektor2111
Godlike
Posts: 6420
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Need help with Zencoder's bot thing...

Post by sektor2111 »

Yeah, and you don't get snippet from above.
In Team Games you have teams, or else it won't be any team. This is why I pointed an "If" and "Else", what's the purpose of teaming in a simple DeathMatch ?
And "MyTeam" in image should be a "SLIDER" for settings not a "Box". Tell me what Team is assigned for MyTeam = 1200. I think this escaped me in prior versions of those "Embedded Bots", and it's not normal to do things this way. Except other needs concerning initialization of this Pawn, perhaps a flexible/configurable code and not hard-coded data should be something like this:
Trooper_Stage1.PNG
And result and configuration it's like here. Any name can be used any time without recompiling it all the time.
Trooper_Stage2.PNG
Boxes are for names, slider it's for real Team assignment not a Box type - because Team is Byte not INT.
In similar format can be assigned required Textures using a generic code supporting multiple configurations - or they can be assigned directly in settings without any code...
To not forget, code has to be completed with other things concerning VOICE or else it's just a lousy thing - like EPIC did with replacements...
I'm hoping that some day coders will learn coding logic not just typing "Text" lines - myself included...
You do not have the required permissions to view the files attached to this post.
User avatar
OjitroC
Godlike
Posts: 3689
Joined: Sat Sep 12, 2015 8:46 pm

Re: Need help with Zencoder's bot thing...

Post by OjitroC »

EvilGrins wrote: Sun Mar 05, 2023 2:34 am Actually, 255 is no team.

This is what I meant.
troop0003.png
Just to be clear - that only appears because of this code

Code: Select all

var() byte myTeam;
It tells the 'Editor' to add the variable MyTeam to SkTroop Default properties.

You can use sektor's code there to replace what you have in SkTroop and set the skins in the default properties Display->multiskins for each of the four Skaarj Bots (presumably to be used in a four-way Domination version of AppalachianWonderland?). You can also use that code for any other 'team bots' you make for CTF, etc.

The voices remain an issue in the sense that there will be log errors because of the lack of a voice for each of the 'bots'.
You do not have the required permissions to view the files attached to this post.
User avatar
EvilGrins
Godlike
Posts: 9839
Joined: Thu Jun 30, 2011 8:12 pm
Personal rank: God of Fudge
Location: Palo Alto, CA

Re: Need help with Zencoder's bot thing...

Post by EvilGrins »

Okay, so that worked as far as it goes but I'm planning on switching from the SkaarjBot to the SkaarjPlayerBot.

Turns out the SkaarjBot has a tendency to periodically jump and freeze in mid-air. Sound familiar?

That and when the SkaarjBot dies it loses its skin.
You do not have the required permissions to view the files attached to this post.
http://unreal-games.livejournal.com/
Image
medor wrote:Replace Skaarj with EvilGrins :mrgreen:
Smilies · viewtopic.php?f=8&t=13758
User avatar
sektor2111
Godlike
Posts: 6420
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Need help with Zencoder's bot thing...

Post by sektor2111 »

EvilGrins wrote: Sun Mar 05, 2023 10:28 pm Turns out the SkaarjBot has a tendency to periodically jump and freeze in mid-air. Sound familiar?

That and when the SkaarjBot dies it loses its skin.
As far as I recall Buggie did something for these "Bots"... or you have to rewrite that messed up code in your pawn.

#2 Skin on death problem is truly old and allow me to refresh an old "speech" somewhere at Hermskii's forum.
Every sudden addicted mapper or whatever alleged modder wants to setup Pawns... 90% of them have no clue what else is needed for a Pawn.
Pawn when it gets killed it's simply gone/vanished, what you see falling on the ground like a Pawn dying it's already another thing - it's a stupid carcass which not more modders cares about it. Sample ? Did you see "Mullog" in MonsterHunt ? - to me that's crap. Bigger Mulllog has issues at firing projectiles - it might hurt itself (if projectile spawns somehow by chance). When this "monster" is dying, it's leaving a sort of green cow sh!t in place. Carcass will copy skin from Pawn but original code has nothing for MultiSkins[x] subject, just like that. Stupid Trivia: It looks good when it's armed with a weapon, but I have never see it firing, compared to other stock ones that can fire a weapon at random even if weapon is invisible for their models - just give a weapon to a stock "Intelligent" monster and see what it does... SkaarjWarriors and some Warlord killed me like that :lol2: . For whoever says that I'm talking crap, I warmly invite him to look carefully at ScriptedPawn code... State "TacticalMove" label "RecoverEnemy".

Resuming: Do you have a new Pawn ? How about his carcass ? Nothing ? Okay, then live with bugs.
Last edited by sektor2111 on Mon Mar 06, 2023 3:50 pm, edited 1 time in total.
User avatar
OjitroC
Godlike
Posts: 3689
Joined: Sat Sep 12, 2015 8:46 pm

Re: Need help with Zencoder's bot thing...

Post by OjitroC »

sektor2111 wrote: Mon Mar 06, 2023 3:27 pm
EvilGrins wrote: Sun Mar 05, 2023 10:28 pm Turns out the SkaarjBot has a tendency to periodically jump and freeze in mid-air. Sound familiar?

That and when the SkaarjBot dies it loses its skin.
Carcass will copy skin from Pawn but original code has nothing for MultiSkins[x] subject, just like that.
I think I have solved that by putting the skin used in Multiskins in Display->Skin as well. As far as I recall, it certainly works with Pawns with a one-piece skin like the Skaarj Trooper.

Of course sometimes, depending on the Pawn, I take the carcass out so, yeah, when killed the Pawn disappears :P Fits with things like ghosts, fairies, angels, etc (in my opinion anyway).