Announcement

Collapse
No announcement yet.

Subclassing?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    try here I think even experienced coders may find this page useful

    Leave a comment:


  • replied
    No, make a new .uc file and write a line at the top that reads like this:
    Code:
    class YourClassNameHere extends WhateverYouWantToBaseItOn;
    Below that, do whatever you like to make your class different from the class you extended. Your class will be exactly like the class it extends in all other aspects, no further code is needed for that.

    Practical example: ONSHoverTank (Goliath) does not contain any code that tells people how to enter it. That is handled in its base classes. There is no need to code that in the Goliath's code, unless it has to be different.

    Leave a comment:


  • replied
    So basically I just copy it then rename it?

    Leave a comment:


  • replied
    why copy it when u can subclass lol, it will be just like the one ur copying just change the functions and properties you want so it works the way u want, unless ur changing like everything then copy it

    Leave a comment:


  • replied
    Can I copy the uc files? Cause I asked someone about that, & he said to not copy & paste, but subclass them.

    Leave a comment:


  • replied
    Here's a few practical examples:

    An example chain of subclassing from the Goliath down to Object:

    ONSHoverTank (Goliath) subclasses ONSTreadCraft (generic tank) subclasses ONSVehicle (generic Onslaught vehicle) subclasses SVehicle (generic skeletal vehicle) subclasses Vehicle (generic vehicle) subclasses Pawn (thingy that can be controlled by a player or AI) subclasses Actor (thingy that can "do stuff" in the game) subclasses Object (basis for all classes)

    Suppose you want to make a new tank... You could do two things. Either you subclass ONSHoverTank (Goliath) and change the things you want (like a new model, better top speed, more armor), or you subclass ONSTreadCraft (generic tank) and write your own tank stuff without the Goliath code getting in the way.

    Leave a comment:


  • replied
    almost everything in the game subclasses Actor, which means it is an extended version of Actor modified to meet what it was made for.

    Say, Class A extends Actor

    A is a subclass of actor, it is exactly like Actor in everyway, except for your modifications in properties and changed functions and added ones of your own.

    Leave a comment:


  • replied
    The original object you want to modified suclassed like so:


    class youobject extends oldobject;



    within it's new package, this way you don' break the compatabiliy of the base files

    Leave a comment:


  • started a topic Subclassing?

    Subclassing?

    When you talk about scripting, what do they mean by subclassing?
Working...
X