There are no stupid questions...

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

yurch

Swinging the clue-by-four
May 21, 2001
5,781
0
0
USA, Maryland.
Visit site
Alright. I wanna know.
Is there a way to replace/override a function without reclassing everything after it?
For example: changing some attributes of TournamentWeapon without reclassing all the weapons...
(Not the exact thing I am doing, but it would be a similar process)
Or do I have to take the "industrious" way out?
 
Pretty new to this myself, but i've subclassed several actors at this point and have a general idea how that goes ...

If you subclass an actor, you only need to script the functions, events, states etc. that you wish to change. Those will override their counterparts in the parent, everything else will be inherited just fine.

One thing to watch out for is that certain functions (particularly ones like PreBeginPlay etc) do important housekeeping tasks, and you have to be careful not to wipe them out unless that's really what you want to do. That's why you'll often see stuff like "Super.PreBeginPlay()" or "Super.ActorEntered()" and so forth in child functions ... You make your changes then let the parent run its normal tasks. HTH
 

yurch

Swinging the clue-by-four
May 21, 2001
5,781
0
0
USA, Maryland.
Visit site
I can make a class file that overrides the parent class fine, but none of the subordinate classes are using the changes.
Why do I need to put in the mutator child in order to get the program to "accept" these changes?
BTW, I am editing a mod. Is that any different?
 

TaoPaiPai

Commisaire Van Loc
Jun 13, 2000
1,626
0
0
Matnik
Visit site
What's your problem? I don't understand...
If you want to make a function that doesn't overwrite a parent function...well just make it another function with another name.
If you want to overwrite a function in a way that it makes something particular with class A but with cother classes (B and C ) it does the usual work from the parent class,this would not be difficult:
(let's suppose we're talking about the fire function)
make it like that:
step 1.add a booleanvariable in the class declaration
Code:
var bool bStandardWeapon;

step 2. rewrite the function you want like that:
Code:
function fire(float value)
{
if (bStandardWeapon)
    super.fire(value);
else
    doWhatYouWantHere
}

then in the default properties of class B and C write
Code:
defaultProperties
{
bStandardWeapon=true
}
(don't need to alter the default properties of weapon A
 

yurch

Swinging the clue-by-four
May 21, 2001
5,781
0
0
USA, Maryland.
Visit site
I will use tournament weapon again as an example...
Lets say I wanted to change
function DropFrom(vector StartLocation)
I want to change this function around, and have all child classes inherit these changes.
I would make a subclass of TournamentWeapon, no?
Now I wan't to have it so I Do not have to mess with the child classes they need to be able to inherit these things without my intervention. I cannot make any changes to them. This would destroy any support for additional weapons and requre me to do a helluva lot of extra subclassing.
I may just lack the simple knowlage of a certain function, or perhaps this can't be done this way.
I need to know a way of making the child of TournamentWeapon, without messing with anything else. Right now I can add the subclass, but the desired changes are not there in-game.
This can be mutator or gametype implementation, I don't mind.
 

ca

CHiMERiC Grandmaster
Oct 11, 1999
84
0
0
www.unrealscript.com
No this isn't possible. You would have to subclass tournamentweapon, make your changes, then make subclasses for all of UT's weapons and make them children of your new tournamentweapon subclass while just copying over the code. Then throw in a mutator or something to replace the normal UT weapons with your new set.

It's a pain, but it's about as close as you can get to doing what you want...
 

yurch

Swinging the clue-by-four
May 21, 2001
5,781
0
0
USA, Maryland.
Visit site
Arg...
Alright then, thought so. Its even harder considering I have to reclass all the infiltration weapons and attachments and ammo and everythin else :D
Why can't I just make a normal mutator ;)