For direct access use https://forums.oldunreal.com
It's been quite a while since oldunreal had an overhaul, but we are moving to another server which require some updates and changes. The biggest change is the migration of our old reliable YaBB forum to phpBB. This system expects you to login with your username and old password known from YaBB.
If you experience any problems there is also the usual "password forgotten" function. Don't forget to clear your browser cache!
If you have any further concerns feel free to contact me: Smirftsch@oldunreal.com

OOPs, there it isn't.

The section related to UnrealScript and modding. This board is for coders to discuss and exchange experiences or ask questions.
User avatar
JD
OldUnreal Member
Posts: 23
Joined: Wed Dec 26, 2007 4:48 pm

OOPs, there it isn't.

Post by JD »

I am trying to make some modifications to UT, learning as I go, and I have hit a roadblock that I need some help with.  For starters I made some modifications to CTF by changing the CTFGame.uc and CTFFlag.uc files and compiling them into a custom package (Mod.u).  My modified CTFGame extends the stardard CTFGame, and my modified CTFFlag does the same with the standard CTFFlag.  I am able to select my modified CTF gametype from the GUI and run it, but the problem I have is that rather than my CTFGame using my package's modified CTFFlag object, it is using the standard BotPack.CTFFlag for some reason.  I have tried renaming my modified CTFFlag back to just CTFFlag, and it makes no difference.  It still is not being used.  I also tried renaming the CTFFlag calls in my modified CTFGame to the name of my modified CTFFlag, and it still used BotPack.CTFFlag instead of mine.  Theoretically it would seem that I could rename and modify every single *.uc file which references CTFFlag to use the name of my modified version instead, but that would require a lot of work and end up essentially recreating an entirely separate CTFFlag for little reason since the changes I have made to the original aren't that extensive.  So, what is the proper and/or easiest way to make my modified CTFGame.uc file use my modified CTFFlag.uc file instead of the one in BotPack.u?

On a related note if I want to extend an existing object but make some changes to the definition of one or more of its member functions in my modified version, how do I do that without getting "Redefinition of function differs from original" errors?  For example, take the SendHome() function in CTFFlag.uc.  If I want to change SendHome so that it will accept a paramater such as a string as input that I will use inside the function, I can change it from "function SendHome() {}" to something  like "function SendHome( string Event ) {}",  but UCC won't compile it due to the redefinition error.  How can I change a function definition in that manner and still make use of the rest of the existing object?
Last edited by JD on Thu Jan 17, 2008 8:32 am, edited 1 time in total.
User avatar
Raven
OldUnreal Member
Posts: 311
Joined: Fri Jun 10, 2005 5:10 am

Re: OOPs, there it isn't.

Post by Raven »

You can not change function definition in it's subclasses. You can change function name, and make use of it, or just change every .uc which refers to CRFFlag.
Image
User avatar
TCP_Wolf
Administrator
Posts: 1078
Joined: Sun Mar 03, 2002 12:04 pm

Re: OOPs, there it isn't.

Post by TCP_Wolf »

Simple solution:

look in the original gametype where the flags are spawned. Override the function doing it and adjust it to your needs.
-=]HONESTY PAYS[=-
User avatar
JD
OldUnreal Member
Posts: 23
Joined: Wed Dec 26, 2007 4:48 pm

Re: OOPs, there it isn't.

Post by JD »

You can not change function definition in it's subclasses
You can't?  My knowledge of OOP and UnrealScript is pretty basic, but I thought that is what "Function Overloading" is about.  
You can change function name, and make use of it, or just change every .uc which refers to CRFFlag.
Before I posted above I also tried changing the function name in addition to adding the parameter input, and it wouldn't compile due to some missing member error which I attributed to the fact that the baseclass (CTFFlag) didn't also have a function with my changed name.
Last edited by JD on Thu Jan 17, 2008 12:00 pm, edited 1 time in total.
User avatar
JD
OldUnreal Member
Posts: 23
Joined: Wed Dec 26, 2007 4:48 pm

Re: OOPs, there it isn't.

Post by JD »

Simple solution:

look in the original gametype where the flags are spawned. Override the function doing it and adjust it to your needs.
That sounds basically like what I am trying to do as I am editing the entire original CTFGame.uc and CTFFlag.uc files but using custom names and extending the originals, i.e. "CTFGameMod extends CTFGame" and "CTFFlagMod extends CTFFlag), and placing them in my own package (Mod.u), so my functions should be overriding the original ones already. The problem I am having is that my modified CTFFlag isn't actually being used by my custom CTFGame which does work otherwise. It is using the original CTFFlag from Botpack.u which bypasses all of the changes in my CTFFlag. I have tried renaming my CTFFlagMod back to CTFFlag and not extending the original (since my version is the entire original code plus changes), but even that doesn't work. I also tried changing the references in my modified CTFGame from CTFFlag to CTFFlagMod, but that doesn't work either. I can get all of these different variations to compile without error, but for some damn reason UT won't actually use my CTFFlag with my CTFGame. It keeps using BotPack's even though both of my compiled scripts files are in the same package (Mod.u).

Return to “UScript Board”