View Full Version : How to combine mods
10th Oct 2004, 04:53 AM
I'm a real noob, so forgive me if this is a really rediculously stupid question to ask. I have two mods. One mod is a mutator that just changes the startup message. I created a new class extending from "StartupMessage" and changed the defaultproperties to what I wanted. The other mod is a gametype mod where I created my new gametype extending from "xTeamGame". Now I want to know how to implement the mutator into the gametype. I tried putting the two .uc files into the same package, but that doesn't do it. Thanks in advance.
10th Oct 2004, 07:48 AM
stick this in the defaultproperties of your gametype...
MutatorClass = "ModName.MutatorName"
...replacing the obvious parts with what's needed and viola!!! =D
10th Oct 2004, 02:43 PM
How do I find out what MutatorClass is? I know that ModName and MutatorName are just the names of my mods, but what is MutatorClass?
10th Oct 2004, 03:08 PM
ok... guess it wasn't as obvious as I thought lol
MutatorClass is MutatorClass. You don't change that part silly, just the bits after the equals sign =3
10th Oct 2004, 04:10 PM
I did what you said, and it compiled fine. Then when I went to play the game, when the game is loading, it crashes to desktop and I get the following error message:
UT2004 Build UT2004_Build_[2004-09-07_17.17]
OS: Windows XP 5.1 (Build: 2600)
CPU: AuthenticAMD Unknown processor @ 2012 MHz with 511MB RAM
Video: GIGABYTE RADEON 9200 (6467)
Could not spawn player
History: MatchViewportsToActors <- (DM-1on1-Albatross) <- ClientInit <- UGameEngine::LoadMap <- LocalMapURL <- UGameEngine::Browse <- ClientTravel <- UGameEngine::Tick <- Level Albatross <- UpdateWorld <- MainLoop <- FMallocWindows::Free <- FMallocWindows::Realloc <- 676F4C57 0 FArray <- FArray::Realloc <- 0*2 <- FMallocWindows::Free
10th Oct 2004, 04:48 PM
That is an error from the gameinfo class, which returned when the attempt to spawn a playercontroller fails. It is possible that your mutator has somehow prevented the playercontroller from being spawned. It could also be the case that your mutator did not get created properly and this is causing a problem with spawning anything. I would check the log file and see what's in there.
11th Oct 2004, 02:37 AM
I tried a hundred different ways, but as long as MutatorClass was in the code, I kept getting the error message. Maybe I haven't been clear with everybody. My mutator is not of "Mutator" class. It is a subclass of "StartupMessage". I just changed a few things in the defaultproperties of StartupMessage. That's all. Now I want to incorporate that into my new gametype. How do I do that?
11th Oct 2004, 11:12 AM
That would be your problem right there. But, err. if it's not a subclass of mutator, why do you keep calling it a mutator? It's easy to see how one might have pointed you in the wrong direction based on that information. Do you already have them working separately? The code looks like you would need integration with the gametype to change the startup message.
11th Oct 2004, 05:42 PM
You're right. I was stupid. So how would I integrate MyStartupMessage into the new gametype? I have the new subclass all written up. I just don't know how to integrate it.
11th Oct 2004, 09:32 PM
Well, the relevant bit of code seems to be in the UnrealPlayer class, in the UnrealGame package. It has a function called PlayStartupMessage which is called by the gametype. Unfortunately, however, the class reference is hard coded so there's no easy way to change it.
There's three ways I can see this being done: you can make your own subclass of xPlayer, and override the function PlayStartupMessage to refer to your own startup message instead. You can override the PlayStartupMessage in your gametype. (which basically does nothing except call the PlayStartupMessage in UnrealPlayer) You can also hijack the default StartupMessage and just insert your text in it's default properties.
The first solution would be the most "object oriented" way to do it. Since you want this in a gametype, the probability of conflicts with mutators, etc. is low. This is a decent solution.
The second method, overriding PlayStartupMessage in the gametype, does not require you to have another class which is tidier, I guess. However, it's slightly hack-ish and not very good programming style. Which isn't to say that it wouldn't work, because it should work just as good as the other methods.
The third method, substituting the default properties of the default StartupMessage, should work and involves no additional processor overhead in the form of having another level of inheritance for all your calls on the Player or the StartupMessage class. Of course, I'm nitpicking as any difference in performance is rediculously insignificant in this instance. This method is probrably the most compatible with mutators, etc, though the likelyhood of a conflict using the other methods is pretty much moot anyway.
So... all three methods should work and should work pretty much evenly. The differences are really philosophical, I guess.
function PlayStartupMessage(byte StartupStage)
ReceiveLocalizedMessage( class'StartupMessage', StartupStage, PlayerReplicationInfo );
12th Oct 2004, 06:25 PM
So if I were to do it like the first method you mentioned, I would need to make a subclass of xPlayer to modify the PlayStartupMessage function. Tell me why I would make this a subclass of xPlayer when the PlayStartupMessage is actually a function of UnrealPlayer?
12th Oct 2004, 06:49 PM
Because xPlayer is a subclass of UnrealPlayer, which is in turn a subclass of PlayerController, etc. so if you subclass xPlayer, you inherit all the stuff from object, actor, controller, playercontroller, unrealplayer and of course xPlayer. If you just subclass UnrealPlayer you will get object, actor, controller, playercontroller and unrealplayer, but you won't get the stuff in xPlayer, which you want.
12th Oct 2004, 06:57 PM
So I create a subclass of xPlayer (call it MyxPlayer). And I just copy the function PlayStartupMessage into the subclass, but I change the class'StartupMessage' to class'MyStartupMessage'. This still is not working for me. It doesn't seem to be using MyxPlayer at all. Is there something else I have to do to make it use MyxPlayer instead of the origonal xPlayer.
13th Oct 2004, 03:30 AM
Yep, now you've got ur MyxPlayer class, you have to tell your gametype to use that class as the player controller instead of xGame.xPlayer. I'm at the office right now so I can't tell you the line you need to add to your gametype. I can tell you that it goes in the defaultproperties block and looks something like:
Have a look in UnrealGame.Deathmatch for the exact line (that will also reside in the default properties block of that class). :)
Once you've got your new gametype on the new player controller, all should be good :D
13th Oct 2004, 02:57 PM
Thank you. It finally worked! Now I should never have that problem again.
vBulletin® v3.8.7, Copyright ©2000-2013, vBulletin Solutions, Inc.