UE1 - UT Mutator reacting on client events

  • 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.

foo

New Member
Dec 7, 2009
2
0
0
Mutator reacting to client events

Hello everybody,

I just want to put an idea into a small mod and learnt some UnrealScript Coding (for UT99). I wrote a subclass of Mutator and it works very well. Only thing missing is:
I want to react to clients:
a) leaving game
b) switching team (teamgame only mod)
by executing some code of my mutator whenever either of these events occur.

Thanks in advance.
 
Last edited:

Zur

surrealistic mad cow
Jul 8, 2002
11,708
8
38
49
Hi,

There's no straightforward way to detect if a player has left a game session (player might disconnect manually but could also be a victim of a network interruption or crash).

However, what you could do is use the Tick() function to check if there's a change in the number of players on the server. Some extra checks might be necessary to avoid the case where a player enters at the same time that another exits the server.

You could use the same approach to check how many players are on each team although there might already be a function that intercepts this change.
 
Last edited:

foo

New Member
Dec 7, 2009
2
0
0
Thanks Azura,

I chose to put a check into the timer loop I setup anyway for my mutator. It checks teamsizes (fast exit) and team composition for changes in IDs(new/left through mismatch) or team membership(switch). This should catch all intended cases.
Your answer helped me alot. I rethought situation:
If I'm right I do just code a subclass of Mutator which can only override event functions receivable by Muator or Actor and the only useful event would be Mutator|ModifyPlayer (Pawn Other), but new players don't bother me initially.
 
Last edited:

Zur

surrealistic mad cow
Jul 8, 2002
11,708
8
38
49
It checks teamsizes (fast exit) and team composition for changes in IDs(new/left through mismatch) or team membership(switch). This should catch all intended cases.

If you are using playerids, an important thing to know is that the value of the id is increased indefinitely. It's best to avoid assuming that the value corresponds with a player slot because it can go beyond 32. As an alternative solution, perhaps you could use a reference to a Pawn instead.

If I'm right I do just code a subclass of Mutator which can only override event functions receivable by Muator or Actor and the only useful event would be Mutator|ModifyPlayer (Pawn Other)

That's more or less it although you could use a combination of functions to detect more complex events like a player having just respawned.

To better understand how Mutator works, export the code of the standard classes and do a text search on UC files to see where the functions are being called. Some of the calls are in GameInfo and it's subclasses (like DeathMatchPlus).

If you're interested in extending Mutator with some new events, get in touch at iamfearless@gmail.com. I was thinking of doing a similar project and decided to let it sleep for a while.
 

War_Master

Member
May 27, 2005
702
0
16
Check out the NexGen110 mod because it does what youre asking for. As soon as a player enters the server it spawns and gives a ClientSide actor to that player and makes it its owner. When the player leaves you can store data of that specific player and give it back as he reconnects to the server. This way is much better then using an array to store PlayerID since it is unlimited and much cleaner.
 

Zur

surrealistic mad cow
Jul 8, 2002
11,708
8
38
49
That is the proper OO way of doing things.