1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. 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.

There are no stupid questions...

Discussion in 'Programming' started by yurch, Oct 1, 2001.

  1. yurch

    yurch Swinging the clue-by-four

    Joined:
    May 21, 2001
    Messages:
    5,781
    Likes Received:
    0
    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?
     
  2. navboy

    navboy New Member

    Joined:
    Jan 5, 2001
    Messages:
    340
    Likes Received:
    0
    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
     
  3. yurch

    yurch Swinging the clue-by-four

    Joined:
    May 21, 2001
    Messages:
    5,781
    Likes Received:
    0
    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?
     
  4. navboy

    navboy New Member

    Joined:
    Jan 5, 2001
    Messages:
    340
    Likes Received:
    0
    ack sorry i misunderstood what you're doing. No i've never done that, and ironically i tried last week for a couple days to get a new gametype working (subclassed DeathMatchPlus) but never could (posted about it a few threads down). Good luck, i'm sure someone in here will know the answer.
     
  5. TaoPaiPai

    TaoPaiPai Commisaire Van Loc

    Joined:
    Jun 13, 2000
    Messages:
    1,626
    Likes Received:
    0
    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
     
  6. yurch

    yurch Swinging the clue-by-four

    Joined:
    May 21, 2001
    Messages:
    5,781
    Likes Received:
    0
    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.
     
  7. ca

    ca CHiMERiC Grandmaster

    Joined:
    Oct 11, 1999
    Messages:
    84
    Likes Received:
    0
    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...
     
  8. yurch

    yurch Swinging the clue-by-four

    Joined:
    May 21, 2001
    Messages:
    5,781
    Likes Received:
    0
    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 ;)
     

Share This Page