UE1 - UT Creating a mutator w/ a gametype for 'Team Mutator'

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Danjun1

New Member
Jul 15, 2010
15
0
0
Hello guys, so, First off, this all idea is someone's else, and he has given me permission to remake it. This game is also Unreal-Engine-1 based, it's called Deus Ex, I've posted about it before too. This is the same package of which Admin-Zone is used on.

So anyway, what I am trying to create is, a gametype, and a mutator, which are both connected to each other through various stuff.

What this mutator/gametype do, is allow someone to create teams/groups, and then they can talk to each other on through Teamsay. This all stuff is related to role-playing.

What I succeeded on was to create a mutator, first, and, it had everything like 'mutate createteam <teamname>' and 'mutate invite <PlayerID>' (yes, only invites, none could join manually). It all worked great, but it was confusing and not that stable, we couldn't determine advance stuff like how many members are on the group, who's the team leader, and it was hard to make a 'teamsay' work on something without any gametype/new player class, so I had to create a gametype.

(if you're asking how it would take a name and even find it, I used an unused string on the default player class, which used to change per player, and they'd be there team(teamname) and others could join by typing that string)

So, anyway, I'm not that expert in coding, what I wanted to know was how could I sum this all up, I created a 'structure' with stuff like TeamName, bTeamLeader.. I even localized the structure. (through var <Structure name> TeamArray[32]>) But it'd give me errors when I tried doing something like this..

(<TeamName = Player.TeamArray.TeamName>)

but I got errors.. It was 'Error, Context express: Variable is too large (768 bytes, 255 max)

I know this sounds all confusing, and I don't want to share the code.. but if someone can understand this, and can help me.. I mean like, totally forgot what I used, give me some suggestions of what to do, create a structure, and what to do next.

If anyone doesn't understand it, but is a professional, I'd be happy to share the source, BUT personally, because I don't like sharing it.. I just need help, I'd give it to multiple people trying to help, I'm sure the source might help you guys understand better as you'd get what I totally mean.

Now, if someone doesn't understand this, but could with the source, PM me or post here, I'll think about sharing the code with you so you can help me..

EDIT: Nevermind, scrap that, here's the source. I've messed it up a bit with the array and all, basically there was just 'var string TeamName' on RPGPlayer.uc, there was no structure nor was it localized, and on the mutator it get connected through that. (not *.TeamArray.*) And you might ask why not use 'exec'.. well, I'd do it on future but right now I was working on the mutator first, and it's progressed so I will when I succeed..

<Removed source-code since the people that had to look, looked, and the ones who wanted to help helped. Thanks Brold999 for replying.>

EDIT2: The classes you have to look at are just TeamMutator.uc and RPGPlayer, nothing more worked on.

Thanks!
 
Last edited:

brold9999

New Member
Apr 5, 2009
142
0
0
I didn't look at the source in the RAR, but from what you have posted, it looks like TeamArray is an array, and to access the TeamName you will have to provide an index for which element of the array to access.

That postulation doesn't quite line up with the error message you are getting. It has been a long time since I have gotten that message but I think I have seen it before many years ago and it turned out to be a very misleading message.
 

Danjun1

New Member
Jul 15, 2010
15
0
0
The TeamName is just a string, it's inside a structure, and then this structure is named 'TeamElement'

and then below it I've written 'var TeamElement TeamArray[32];'

which makes this whole element an array.

Then I access it with, say, something like this..

"if(RPGPlayer(DeusExPlayer).TeamArray.TeamName == RPGPlayer(Other).TeamArray.TeamName)"

THAT gives me an error, I think..

But, to be particular, the error is at..

Code:
		if(RPGPlayer(Other).TeamArray.TeamName!="N/A")
		{
		tt++;
		}

EDIT: Oh wait, that was useless, I dint had to use it.. now I removed it, and fixed one thing, now it's an error here:

Code:
	if (TeamArray.TeamName == RPGPlayer(P).TeamArray.TeamName)
		actualDamage = 0;

It's talking about 'TeamArray.TeamName' I think, how do I access it like that? And that's at the RPGPlayer where the element/structure exists. This code is on TakeDamage, if there's a person with our teamname then don't deal damage.

So, anyway, the problem is now, how do I access something through a structure, like.. that?

EDIT: The error is;

Error, Array mismatch in 'if'

EDIT2: I removed that line for a bit, and now I recieve the same first error on this:

Code:
	if ( ( TeamDMGame(DXGame) == None ) && (RPGPlayer(P).TeamArray.TeamName != "N/A") && (TeamArray.TeamName != "N/A") )

I need serious help.. is structure an answer, or do I have to use something else? I mean, I just want max teams to be 32, and the person who 'creates' the team is the team leader, and he invites people on his team through 'inviting them' from their PlayerID. and if the leader leaves his team through 'leaveteam' command, then the first player he invited becomes the leader.

I just want to do that, isn't there anything simpler? :O
 
Last edited:

brold9999

New Member
Apr 5, 2009
142
0
0
I've taken a look at the code now and I think that my original suggestion was right. There may be other errors but that is definately one of them.

RPGPlayer's TeamArray variable is an array of TeamElement structs.
You can access TeamArray.TeamName directly because TeamArray is an array of 32 TeamElements each with their own TeamName. You have to supply the index of the team, such as TeamArray[0].TeamName.

Probably what you want to do is for all the teams to be stored in one place, such as your TeamMutator, and have players access that central data store. The way you have it now, each player has their own list of teams.
 

Danjun1

New Member
Jul 15, 2010
15
0
0
So.. you're saying to make the strcture/stuff at the mutator instead? and.. let's say, the mutator has 'mutate createteam'

What do I do, how would I tell it to create an array/use an array on TeamArray[32]?
 
Last edited:

brold9999

New Member
Apr 5, 2009
142
0
0
Each element of TeamArray has it's own TeamElement, and presumably each corresponds to a single team. So for example, TeamArray[0].TeamName is the name of the first team, TeamArray[1].TeamName is the name of the second team, etc. If they are creating a new team you'll probably want to find a space in that array that isn't currently being used by any team and put the info in there.
 

Danjun1

New Member
Jul 15, 2010
15
0
0
Still doesn't clear me up, though, how would I tell it to use one of those indexes from the array?

I'm no expert, sorry.. I'm way too noobish, too.

I don't wanna put any index-numbers myself, I want it to create one automatically when someone types 'mutate createteam <teamname>' and use one slot, maximum teams that would be created would be 32 only. So, how 'exactly' will I tell it to use an index on the array automatically, and don't use any existing one? :S

Yeah, big noob here.. :(

EDIT: And I think you're not getting what I want it to be, what I want is that players ingame can create a team, and the person that creates the 'team' is known as the team leader, which can kick or invite people in his team through PlayerID of theirs. Players cannot join the team by their selves, and can leave though by another command.

I don't want to manually put something, like, you said to put an index.. I know that there are 32 of these, and that's the team count I want to be created.. maximum. I want it on the create-team command to AUTOMATICALLY fill a slot, no index given, and don't use an existing index/slot.

Right, I guess you might be saying the same thing, but I have no idea how would I achieve that, any examples through directly code? :$

Thanks.
 
Last edited:

brold9999

New Member
Apr 5, 2009
142
0
0
I realize that, I was only giving fixed numbers to demonstrate how you need an index to access elements of the array. In practice you'll want to use a variable which holds the number of the team that you are trying to access. For what you are trying to do you'll probably want to loop starting at zero and go through the team index until you find a slot that doesn't have an existing team in it.
 

Danjun1

New Member
Jul 15, 2010
15
0
0
Thanks for the help!

But, I'm afraid I've never done loops or what.. you stated. Can you do a coding example please? :$
 

brold9999

New Member
Apr 5, 2009
142
0
0
Something like this:

Code:
function bool isTeamIndexEmpty(int teamIndex) {
  // return true or false depending on whether or not teamArray[teamIndex] is an empty team.
}

function int getEmptyTeamIndex() {
  // return the index of an empty team slot in teamArray, or -1 if all slots are full
  local int i;

  for (i=0;i<32;i++)
    if (isTeamIndexEmpty(i))
      return i;
  
  return -1;
}

function int createTeam(...) {
  local int newTeamIndex;

  newTeamIndex = getEmptyTeamIndex();
  if (newTeamIndex >= 0) {
    // do whatever you need to do to create the new team in the slot newTeamIndex.
    teamArray[newTeamIndex].teamName = "some new team";
    // ... etc ...
  } else {
    // do whatever you need to do if a team can't be created because there are no free slots.

    // maybe just log an error message if you are certain this will never happen

    // or forget the enclosing if altogether if there is some reason why this absolutely
    // can't happen, like if there can only be 32 players, players can be on only one team,
    // and empty teams can't exist.
  }

  // presuming you want to return the index of the team so that something else can do something with it.
  return newTeamIndex;
}