[UT2k4] Server Actor vs. 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.

TBone_77

New Member
Mar 12, 2004
33
0
0
Can someone please point me in the direction of some discussion/tutorials/examples of creating a ServerActor? I can't seem to locate any material, though I seem to recall coming across some a LONG time ago... just can't remember where.

I want to take a mutator of mine and make it a ServerActor instead, but I want to make sure that it's possible and that it's appropriate.

TIA,
Bone
 

Shambler[sixpack]

New Member
May 3, 2001
564
0
0
Ireland
Visit site
Simple, open up UT2004.ini and do a search for ServerActors=
When you find that add your own one in below all that: ServerActors=YourPackageName.YourClassName

That should do the trick. (and I'm quite sure you don't even need to change any code, just put the mutator classname in there)
 

TBone_77

New Member
Mar 12, 2004
33
0
0
[Sixpack]-Shambler- said:
Simple, open up UT2004.ini and do a search for ServerActors=
When you find that add your own one in below all that: ServerActors=YourPackageName.YourClassName

That should do the trick. (and I'm quite sure you don't even need to change any code, just put the mutator classname in there)

Interesting... I'll give that a try!
 

TBone_77

New Member
Mar 12, 2004
33
0
0
Well, unfortunately it wasn't that easy. The problem is that my mutator uses the Mutate function quite extensively, and taking it out of the mutator chain causes 'Mutate' to never get called for this mutator.

The knee-jerk alternative is to create exec functions to replace calls to Mutate (which I would love to do, actually), but the problem there is that this isn't a Total Conversion, which really doesn't leave me anywhere to put an exec function since I'd have to create my own PlayerController to implement them properly (which is a no-no in mutators, yes?).

If anyone has any ideas or places I should look to research this, I am all ears. The reason I'm trying to do this is that my mutator (UAdminMod) doesn't actually alter gameplay, and Bry from unrealadmin.org made that comment that, while the mutator is nice, it causes the server to no longer be categorized as a standard server and that I should consider making it a server actor. I thought that was a pretty good point since my mutator is merely a tool rather than a gameplay element.

So I guess my real question is how bad would it be for a server actor to sublass PlayerController? I know it's a bold question, but I'm in a bind :( .
 
Last edited:

RegularX

Master of Dagoth Lies
Feb 2, 2000
1,215
0
0
Chicago, IL
A server actor shouldn't replace PlayerController any more than mutes should, which is generally considered a no-no, yes (although you wouldn't be the first to release a mute to do this...)

I think the general method is to create commands around the "mutate" function and then have someone bind to that ... but I've never used it, so I can't give you specifics.
 

TBone_77

New Member
Mar 12, 2004
33
0
0
RegularX said:
A server actor shouldn't replace PlayerController any more than mutes should, which is generally considered a no-no, yes (although you wouldn't be the first to release a mute to do this...)

I think the general method is to create commands around the "mutate" function and then have someone bind to that ... but I've never used it, so I can't give you specifics.

Oh well... I figured that it was a no-no, but I guess I needed to be told in order to resist the temptation. My apologies for even considering it; I should know better.

I guess I'll just have to resign myself to the fact that I can't turn UAdminMod into a server actor, and admins that wish to use it will have to resign themselves to the fact that their servers won't be considered 'standard'.

I don't suppose anyone knows of any other location to put an exec function to be used in a mutator? I read the Wiki where it has a list - a very short list - of places that exec functions will work. I'm futily hoping that there's some place that the author forgot to mention LOL.
 

RegularX

Master of Dagoth Lies
Feb 2, 2000
1,215
0
0
Chicago, IL
Oh don't apologize - like I said, you wouldn't be the first to replace Controllers via mutes and undoubtably not the last.

But look at the mutate command for the mutator: http://wiki.beyondunreal.com/wiki/Mutator

It gives you handle to the PlayerController, which give you access to put the exec on the mutator itself.
 

TBone_77

New Member
Mar 12, 2004
33
0
0
RegularX said:
Oh don't apologize - like I said, you wouldn't be the first to replace Controllers via mutes and undoubtably not the last.

But look at the mutate command for the mutator: http://wiki.beyondunreal.com/wiki/Mutator

It gives you handle to the PlayerController, which give you access to put the exec on the mutator itself.

Actually, the current release implements the Mutate function, and it works like a charm. The problem is that Bry from UA suggested that the next release be made into a ServerActor so that server admins can run UAdminMod without causing their server to fall out of the 'standard servers only' filter. But to do that, I lose access to the Mutate command (since the Mutator is no longer in the chain, it's Mutate function would never be called when someone typed mutate <command> in their console).

It's all good though... just can't have my cake and eat it too!
 

Shambler[sixpack]

New Member
May 3, 2001
564
0
0
Ireland
Visit site
Hmm..
What you COULD try (but this would probably leave you back at the beginning, I'm not sure) is add this in the PostBeginPlay function:
Code:
function PostBeginPlay()
{
     if (Level.Game.BaseMutator == None)
          Level.Game.BaseMutator = Self;
     else
          Level.Game.BaseMutator.AddMutator(Self);
}

If that leave you back at the beginning then try changing the PlayerInput class of the PlayerController.
This is especially hacky as you'll have to do some very tricky code to get it working right (and while still counting for other mods changing the PlayerInput) here is the code you will need. (I do not know if this works)
Code:
// This is just to give you the gist of how to replace PlayerInput
function ReplacePlayerInput(PlayerController PC)
{
     local PlayerInput InpToReplace, PI;

     // NOTE: It seems un-necesarily complicated but PC.PlayerInput is PRIVATE variable (untested too!!)
     foreach AllActors(Class'PlayerInput', PI)
          if (PI.Pawn == PC.Pawn)
               InpToReplace = PI;

     PC.InputClass = Class'YourPackage.YourPlayerInput';
     PC.InitInputSystem();

     foreach AllActors(Class'YourPlayerInput', PI)
          if (PI.Pawn == PC.Pawn)
               YourPlayerInput(PI).ReplacedInput = InpToReplace;

}
Code:
// Add any exec functions you want here.
Class YourPlayerInput extends PlayerInput;

var PlayerInput ReplacedInput;

function bool InvertLook()
{
     Return ReplacedInput.InvertLook();
}

event PlayerInput(float DeltaTime)
{
     ReplacedInput.PlayerInput(DeltaTime);
}

exec function SetSmoothingMode(byte B)
{
     ReplacedInput.SetSmoothingMode(byte B);
}

exec function SetSmoothingStrength(float F)
{
     ReplacedInput.SetSmoothingStrength(F);
}

function float AccelerateMouse(float aMouse)
{
     Return ReplacedInput.AccelerateMouse(aMouse);
}

function float SmoothMouse(float aMouse, float DeltaTime, out byte SampleCount, int Index)
{
     Return ReplacedInput.SmoothMouse(aMouse, DeltaTime, SampleCount, Index);
}

function UpdateSensitivity(float F)
{
     ReplacedInput.UpdateSensitivity(F);
}

function UpdateAccel(float F)
{
     ReplacedInput.UpdateAccel(F);
}

function UpdateSmoothing(int Mode)
{
     ReplacedInput.UpdateSmoothing(Mode);
}

function InvertMouse(optional string Invert)
{
     ReplacedInput.InvertMouse(Invert);
}

function ChangeSnapView(bool B)
{
     ReplacedInput.ChangeSnapView(B);
}

function Actor.eDoubleClickDir CheckForDoubleClickMove(float DeltaTime)
{
     Return ReplacedInput.CheckForDoubleClickMove(DeltaTime);
}

If that doesn't help then I really do not know what will, if you find the code there doesn't work then play about with it..persistence is the way! :)
 
Last edited by a moderator:

EvilDrWong

Every line of code elevates you
Jun 16, 2001
932
0
0
40
Inside the machine
Visit site
check Mutator.GetServerDetails(). It adds the mutator to the server's details by default, but you could probably jimmy it and prevent the mutator showing up, thus keeping the server 'Standard'