Jump to content

[Help] Implementing Vehicles


Recommended Posts

  • Replies 604
  • Created
  • Last Reply

Top Posters In This Topic

the vehicle id is sent in packets, if you dont have it, then guess.

use ingame .debug spawnvehicle 27894 xxx

xxx - guesed vehicle id, in your case try only vehicle ids with one seat

and if he will be seating where he should, use that vehicle id

-> insert it into vehicle_data, add there flags and related spells ( eg. http://www.wowhead.com/?spell=51421 )

and then data into vehicle_seat_data (your seat, flags (3))

(for eg. vehicle id 116 is used for wintergrasp turrets, simmilar to your case)

PS : dont forget to add npc_spellclick for your npc 27894, otherwise you wont be able to enter it

Link to comment
Share on other sites

Wanted to PM you this but unable to do so :S

I'm very interesting in your vehicle developement :) first i could'nt guess how difficult it might be.

Looking at the error in the linux build I wanted to ask why don't put all the headers in the .h file ? and just the vehicle.h in the vehicle.cpp ?

Looking at those two files you have include unit.h in both :)

Link to comment
Share on other sites

a description to the fields of vehicle.dbc is needed.

EDIT: i found this in dbcstructure.h:

struct VehicleEntry
{
   uint32  m_ID;                                           // 0
   uint32  m_flags;                                        // 1
   float   m_turnSpeed;                                    // 2
   float   m_pitchSpeed;                                   // 3
   float   m_pitchMin;                                     // 4
   float   m_pitchMax;                                     // 5
   uint32  m_seatID[8];                                    // 6-13
   float   m_mouseLookOffsetPitch;                         // 14
   float   m_cameraFadeDistScalarMin;                      // 15
   float   m_cameraFadeDistScalarMax;                      // 16
   float   m_cameraPitchOffset;                            // 17
   //int     m_powerType[3];                               //       removed in 3.1
   //int     m_powerToken[3];                              //       removed in 3.1
   float   m_facingLimitRight;                             // 18
   float   m_facingLimitLeft;                              // 19
   float   m_msslTrgtTurnLingering;                        // 20
   float   m_msslTrgtPitchLingering;                       // 21
   float   m_msslTrgtMouseLingering;                       // 22
   float   m_msslTrgtEndOpacity;                           // 23
   float   m_msslTrgtArcSpeed;                             // 24
   float   m_msslTrgtArcRepeat;                            // 25
   float   m_msslTrgtArcWidth;                             // 26
   float   m_msslTrgtImpactRadius[2];                      // 27-28
   char*   m_msslTrgtArcTexture;                           // 29
   char*   m_msslTrgtImpactTexture;                        // 30
   char*   m_msslTrgtImpactModel[2];                       // 31-32
   float   m_cameraYawOffset;                              // 33
   uint32  m_uiLocomotionType;                             // 34
   float   m_msslTrgtImpactTexRadius;                      // 35
   uint32  m_uiSeatIndicatorType;                          // 36
                                                           // 37, new in 3.1
                                                           // 38, new in 3.1
                                                           // 39, new in 3.1
};

EDIT 2:

You can open a DBC file with: [mangos source]\\contrib\\dbcEditer\\bin\\pjDbcEditer.exe

It works only under Windows, I dont know if its a similar app for linux too.

Link to comment
Share on other sites

According to rastikzzz development his Vehicle tble is as follows :

[b]CREATE[/b] [b]TABLE[/b] [b]`[/b]vehicle_data[b]`[/b] (
 [b]`[/b]entry[b]`[/b] mediumint([color=#009999]5[/color]) unsigned [b]NOT[/b] [b]NULL[/b],
 [b]`[/b]flags[b]`[/b] mediumint([color=#009999]8[/color]) unsigned [b]NOT[/b] [b]NULL[/b] [b]default[/b] [color=#dd1144]'0'[/color],
 [b]`[/b]Spell1[b]`[/b] mediumint([color=#009999]8[/color]) unsigned [b]NOT[/b] [b]NULL[/b] [b]default[/b] [color=#dd1144]'0'[/color],
 [b]`[/b]Spell2[b]`[/b] mediumint([color=#009999]8[/color]) unsigned [b]NOT[/b] [b]NULL[/b] [b]default[/b] [color=#dd1144]'0'[/color],
 [b]`[/b]Spell3[b]`[/b] mediumint([color=#009999]8[/color]) unsigned [b]NOT[/b] [b]NULL[/b] [b]default[/b] [color=#dd1144]'0'[/color],
 [b]`[/b]Spell4[b]`[/b] mediumint([color=#009999]8[/color]) unsigned [b]NOT[/b] [b]NULL[/b] [b]default[/b] [color=#dd1144]'0'[/color],
 [b]`[/b]Spell5[b]`[/b] mediumint([color=#009999]8[/color]) unsigned [b]NOT[/b] [b]NULL[/b] [b]default[/b] [color=#dd1144]'0'[/color],
 [b]`[/b]Spell6[b]`[/b] mediumint([color=#009999]8[/color]) unsigned [b]NOT[/b] [b]NULL[/b] [b]default[/b] [color=#dd1144]'0'[/color],
 [b]`[/b]Spell7[b]`[/b] mediumint([color=#009999]8[/color]) unsigned [b]NOT[/b] [b]NULL[/b] [b]default[/b] [color=#dd1144]'0'[/color],
 [b]`[/b]Spell8[b]`[/b] mediumint([color=#009999]8[/color]) unsigned [b]NOT[/b] [b]NULL[/b] [b]default[/b] [color=#dd1144]'0'[/color],
 [b]`[/b]Spell9[b]`[/b] mediumint([color=#009999]8[/color]) unsigned [b]NOT[/b] [b]NULL[/b] [b]default[/b] [color=#dd1144]'0'[/color],
 [b]`[/b]Spell10[b]`[/b] mediumint([color=#009999]8[/color]) unsigned [b]NOT[/b] [b]NULL[/b] [b]default[/b] [color=#dd1144]'0'[/color],
 [b]`[/b]req_aura[b]`[/b] mediumint([color=#009999]8[/color]) unsigned [b]NOT[/b] [b]NULL[/b] [b]default[/b] [color=#dd1144]'0'[/color],
 [b]PRIMARY[/b] [b]KEY[/b]  ([b]`[/b]entry[b]`[/b])
)

So, looking at the DBC file how should we fill the fields ?

A line looks like follows :

INSERT INTO vehicle_data VALUES (106, 4, 50896, 0, 50652, 0, 0, 0, 0, 0, 0, 0, 0);

As far as i can tell 106 is vehicle ID. for the other fields.....

Link to comment
Share on other sites

According to rastikzzz development his Vehicle tble is as follows :

[b]CREATE[/b] [b]TABLE[/b] [b]`[/b]vehicle_data[b]`[/b] (
 [b]`[/b]entry[b]`[/b] mediumint([color=#009999]5[/color]) unsigned [b]NOT[/b] [b]NULL[/b],
 [b]`[/b]flags[b]`[/b] mediumint([color=#009999]8[/color]) unsigned [b]NOT[/b] [b]NULL[/b] [b]default[/b] [color=#dd1144]'0'[/color],
 [b]`[/b]Spell1[b]`[/b] mediumint([color=#009999]8[/color]) unsigned [b]NOT[/b] [b]NULL[/b] [b]default[/b] [color=#dd1144]'0'[/color],
 [b]`[/b]Spell2[b]`[/b] mediumint([color=#009999]8[/color]) unsigned [b]NOT[/b] [b]NULL[/b] [b]default[/b] [color=#dd1144]'0'[/color],
 [b]`[/b]Spell3[b]`[/b] mediumint([color=#009999]8[/color]) unsigned [b]NOT[/b] [b]NULL[/b] [b]default[/b] [color=#dd1144]'0'[/color],
 [b]`[/b]Spell4[b]`[/b] mediumint([color=#009999]8[/color]) unsigned [b]NOT[/b] [b]NULL[/b] [b]default[/b] [color=#dd1144]'0'[/color],
 [b]`[/b]Spell5[b]`[/b] mediumint([color=#009999]8[/color]) unsigned [b]NOT[/b] [b]NULL[/b] [b]default[/b] [color=#dd1144]'0'[/color],
 [b]`[/b]Spell6[b]`[/b] mediumint([color=#009999]8[/color]) unsigned [b]NOT[/b] [b]NULL[/b] [b]default[/b] [color=#dd1144]'0'[/color],
 [b]`[/b]Spell7[b]`[/b] mediumint([color=#009999]8[/color]) unsigned [b]NOT[/b] [b]NULL[/b] [b]default[/b] [color=#dd1144]'0'[/color],
 [b]`[/b]Spell8[b]`[/b] mediumint([color=#009999]8[/color]) unsigned [b]NOT[/b] [b]NULL[/b] [b]default[/b] [color=#dd1144]'0'[/color],
 [b]`[/b]Spell9[b]`[/b] mediumint([color=#009999]8[/color]) unsigned [b]NOT[/b] [b]NULL[/b] [b]default[/b] [color=#dd1144]'0'[/color],
 [b]`[/b]Spell10[b]`[/b] mediumint([color=#009999]8[/color]) unsigned [b]NOT[/b] [b]NULL[/b] [b]default[/b] [color=#dd1144]'0'[/color],
 [b]`[/b]req_aura[b]`[/b] mediumint([color=#009999]8[/color]) unsigned [b]NOT[/b] [b]NULL[/b] [b]default[/b] [color=#dd1144]'0'[/color],
 [b]PRIMARY[/b] [b]KEY[/b]  ([b]`[/b]entry[b]`[/b])
)

So, looking at the DBC file how should we fill the fields ?

A line looks like follows :

INSERT INTO vehicle_data VALUES (106, 4, 50896, 0, 50652, 0, 0, 0, 0, 0, 0, 0, 0);

As far as i can tell 106 is vehicle ID. for the other fields.....

if you dont know how to open dbc, i have exported it here : http://pastebin.com/m2619ecae

i am using custom vehicle flags and seat flags, because flags in dbc are too unknown

look at shareddefines.h

enum CustomVehicleFLags
{
   VF_CANT_MOVE                    = 0x0001,                   // vehicle cant move, only turn, maybe handle by some auras?
   VF_FACTION                      = 0x0002,                   // vehicle retain its own faction
   VF_DESPAWN_NPC                  = 0x0004,                   // vehicle will delete npc on spellclick
   VF_DESPAWN_AT_LEAVE             = 0x0008,                   // vehicle will be deleted when rider leaves
   VF_CAN_BE_HEALED                = 0x0010,                   // vehicle can be healed
   VF_GIVE_EXP                     = 0x0020,                   // vehicle will give exp for killing enemies
   VF_MOVEMENT                     = 0x0040,                   // vehicle will move on its own, not depending on rider, however rider can cast spells
   VF_NON_SELECTABLE               = 0x0080                    // vehicle will be not selectable after rider enter
   //VF_HAS_FUEL                     = 0x0100,                   // TODO : find out what energy type is fuel and implement this
};

enum CustomVehicleSeatFLags
{
   SF_MAIN_RIDER                   = 0x0001,                   // the one who controlls vehicle, can also cast spells
   SF_UNATTACKABLE                 = 0x0002,                   // hided inside, and unatackable until vehicle is destroyed
   SF_CAN_CAST                     = 0x0004,                   // player/npc can rotate, and cast OWN spells
   SF_UNACCESSIBLE                 = 0x0008                    // player cant enter this seat by normal way (only by script)
};

if you want to make a vehicle, for eg. for npc entry 99999

- first enter data to table npc_spellclick_spells

eg

[b]INSERT INTO[/b] npc_spellclick_spells [b]VALUES[/b] (99999, 60968, 0, 0, 0, 1);

- second, you probably dont have vehicle id for it (real vehicle id is obtained from packets) but you can use any of avaible ids (from vehicle.dbc). As you can see, each vehicle has 1-7 seats.

and for eg. you want a vehicle with 4 enterable seats, so first one is vehicle id 26. what is diference between using id 26 and other vehicle id with 4 seats? its in 2 thinghts - in player UI and in diferent seating animation

(you can always spawn ingame vehicle with .debug spawnvehicle 99999 xxx to try variety of vehicle ids until you will be satisfied)

- then if you have a vehicle id, add it to creature addon template

[b]INSERT IGNORE INTO[/b] creature_template_addon [b]VALUES[/b] (99999, 0, 0, 0, 0, 0, 26, NULL, NULL);

and to vehicle data too, look at flags above and select some, eg.

[b]INSERT[/b] [b]INTO[/b] vehicle_data [b]VALUES[/b] ([color=#009999]26[/color], [color=#009999]4[/color], [color=#009999]51362[/color], [color=#009999]0[/color], [color=#009999]0[/color], [color=#009999]0[/color], [color=#009999]0[/color], [color=#009999]0[/color], [color=#009999]0[/color], [color=#009999]0[/color], [color=#009999]0[/color], [color=#009999]0[/color], [color=#009999]0[/color]);

note :for vehicle spells you can use any spell ingame

and field req_aura - means what aura must have player to be able to enter it (required for wintergrasp vehicles)

- so now if you have vehicle data, add some seat flags, eg.

[b]INSERT[/b] [b]INTO[/b] vehicle_seat_data [b]VALUES[/b] (365, 3); -- rider
[b]INSERT[/b] [b]INTO[/b] vehicle_seat_data [b]VALUES[/b] (366, 2);
[b]INSERT[/b] [b]INTO[/b] vehicle_seat_data [b]VALUES[/b] (367, 2);
[b]INSERT[/b] [b]INTO[/b] vehicle_seat_data [b]VALUES[/b] (368, 2);

i hope this explained enough to understand

Link to comment
Share on other sites

Well, at last it workss!!! What I've to do for the vehicles respawn when they are destroyed or abandoned? I want to do an event and that will be better.

Edit: Why a vehicle can be destroyed by a player without vehicle but it's no damaged by other vehicles?

Link to comment
Share on other sites

Can someone help me for http://www.wowhead.com/?npc=27894 ?

I follow the instruction but I don't find vehicule entry.

I tried all posibilities...

Thank you and sorry for bad english.

PS:

INSERT INTO npc_spellclick_spells VALUES
(28781, 60968, 0, 0, 0, 1);
INSERT IGNORE INTO creature_template_addon VALUES
(28781, 0, 0, 0, 0, 0, 106, NULL, NULL);

for http://www.wowhead.com/?npc=28781

Link to comment
Share on other sites

@Wowka321

I don't think that crash is produced because of this patch, 0.14 mangos is a bit unstable and there are many client and server craches for now. Especially in areas like Wintergrasp, Naxx and others...

No. In this case vehicle cause of crash clent. Try to drive far from spawnplace and all araund u get crash client.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use