1. Hey Guest, is it this your first time on the forums?

    Visit the Beginner's Box

    Introduce yourself, read some of the ins and outs of the community, access to useful links and information.

    Dismiss Notice

Need help with some classes and vehicles.

Discussion in 'Modding Help' started by Ni, May 7, 2017.

  1. Ni

    Ni Battle Angel Global Moderator Forum Moderator Mapping Moderator Donator Tester Official Server Admin
    1. Active Forum Users

    Messages:
    433
    There are many things I still don't understand, like how to add wheels to a vehicle or set the position where you are going to sit down on it.
    Well if someone is willing to help me leave a comment bellow or PM me :) (I would appreciate it)

    Ps. There are so many questions, I can't even list them up here :c
     
  2. Asu

    Asu THD Team THD Team Forum Moderator

    Messages:
    1,580
    If you're making a custom vehicle you might need to include some scripts within the .cfg file.

    In @$sprite_scripts :
    Code:
    SeatsGUI.as;
    VehicleGUI.as;
    VehicleConvert.as; # If you want enemies to be able to capture the vehicle
    In @$scripts :
    Code:
    Seats.as; # This has to be above Vehicle.as, etc
    Vehicle.as;
    VehicleConvert.as; # If you want enemies to be able to capture the vehicle
    You can look for some other interesting scripts to add from Catapult.cfg, for example RunOverPeople.as, PopWheelsOff.as.

    You can change the shape of the vehicle in the configuration file as well, changing the vertices :
    Code:
    @f32 verticesXY                            =  8.0; 6.0; 
                                                   24.0; 6.0;                                               
                                                   32.0; 24.0;
                                                   24.0; 27.0;
                                                   8.0; 27.0;
                                                   0.0; 24.0;    
    However, some vehicles such as warboats have in fact more shapes that are instantiated onInit in their script.
    This is how it's done in WarBoat.as :
    Code:
        {
            Vec2f[] shape = { Vec2f(43.0f,  4.0f) - pos_off,
                             Vec2f(73.0f,  7.0f) - pos_off,
                             Vec2f(93.0f,  36.0f) - pos_off,
                             Vec2f(69.0f,  24.0f) - pos_off
                           };
            this.getShape().AddShape(shape);
        }
    To create a new vehicle it's necessary to do extra stuff code side. Dinghies might be the easiest one to learn from.

    Seats and other attachments are listed in @$attachment_points (this is Catapult.cfg) :
    Code:
    # name; pixel offset (from center) X; offset Y; socket/plug 0/1; controller; radius
    DRIVER; 0; -3; 0; 1; 12;
    GUNNER; -16; -1; 0; 1; 12;
    MAG; -9; -19; 0; 0; 24;
    VEHICLE; 0; 8; 1; 0; 0;
    Some of these attachments might be handled directly by the common vehicle scripts, or by the catapult scripts in this case.
    You can add custom attachments to attach blobs as you'd like. WarBoat.as does this :
    Code:
        if (getNet().isServer())// && hasTech( this, "mounted bow"))
        {
            CBlob@ bow = server_CreateBlob("mounted_bow");
            if (bow !is null)
            {
                bow.server_setTeamNum(this.getTeamNum());
                this.server_AttachTo(bow, "BOW");
                this.set_u16("bowid", bow.getNetworkID());
            }
        }
     
    norill likes this.
  3. Ni

    Ni Battle Angel Global Moderator Forum Moderator Mapping Moderator Donator Tester Official Server Admin
    1. Active Forum Users

    Messages:
    433
    Wow thank's alot, but i don't get how to set these attachment points D: (What do they mean ?)
     
  4. Asu

    Asu THD Team THD Team Forum Moderator

    Messages:
    1,580
    DRIVER is the seat to drive the vehicle (move it around)
    GUNNER is the seat for the firer (shooting ballista bolts for the ballista, or people, stone, etc in the catapult)
    MAG looks like the attachment for the ammo (to attach blobs put in correctly, e.g. players, bombs)
    VEHICLE is likely a special attachment, I don't think you will need to change it.
     
    norill likes this.
  5. VEHICLE Attachment Point is used when embarking cata/ballista on warboat/longboat/bomber. boats have socket/plug field for this AP set to 0 (socket), while land vehicles are set to 1 (plug). so effectively boats "pick up" other vehicles on contact
     
    Asu likes this.