Jump to content

[Help] Implementing Vehicles


Recommended Posts

  • Replies 604
  • Created
  • Last Reply

Top Posters In This Topic

they are using more energy types - energy, mana and i heard something about fuel too, but not confirmed. i didnt tried vehicles with energy yet.

// creature.cpp

is to add energy in the table DATA BASE minenergy maxenergy.

I tried and worked but you need the update in the DATA BASE for the NPC VEHICLES, work with energy

// mana

uint32 minmana = std::min(cinfo->maxmana, cinfo->minmana);

uint32 maxmana = std::max(cinfo->maxmana, cinfo->minmana);

uint32 mana = minmana + uint32(rellevel*(maxmana - minmana));

+// energy

+ uint32 minenergy = std::min(cinfo->maxenergy, cinfo->minenergy);

+ uint32 maxenergy = std::max(cinfo->maxenergy, cinfo->minenergy);

+ uint32 energy = minenergy + uint32(rellevel*(maxenergy - minenergy));

SetCreateMana(mana);

SetMaxPower(POWER_MANA, mana); //MAX Mana

SetPower(POWER_MANA, mana);

+ SetCreateEnergy(energy);

+ SetMaxPower(POWER_ENERGY, energy); //MAX Energy

+ SetPower(POWER_ENERGY, energy);

// TODO: set UNIT_FIELD_POWER*, for some creature class case (energy, etc)

SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, health);

SetModifierValue(UNIT_MOD_MANA, BASE_VALUE, mana);

+ SetModifierValue(UNIT_MOD_ENERGY, BASE_VALUE, energy);

// UpdateFields.h

UNIT_FIELD_RANGED_ATTACK_POWER_MODS = OBJECT_END + 0x0079, // Size: 1, Type: TWO_SHORT, Flags: PRIVATE, OWNER

+ UNIT_FIELD_BASE_ENERGY = OBJECT_END + 0x0080, // Size: 1, Type: INT, Flags: PUBLIC

// DATA BASE

ALTER TABLE creature_template

ADD COLUMN minenergy int(10) unsigned NOT NULL default '0' AFTER maxmana,

ADD COLUMN maxenergy int(10) unsigned NOT NULL default '0' AFTER minenergy;

But probleman update create DATA BASE. :(

Link to comment
Share on other sites

// creature.cpp

is to add energy in the table DATA BASE minenergy maxenergy.

I tried and worked but you need the update in the DATA BASE for the NPC VEHICLES, work with energy

// mana

uint32 minmana = std::min(cinfo->maxmana, cinfo->minmana);

uint32 maxmana = std::max(cinfo->maxmana, cinfo->minmana);

uint32 mana = minmana + uint32(rellevel*(maxmana - minmana));

+// energy

+ uint32 minenergy = std::min(cinfo->maxenergy, cinfo->minenergy);

+ uint32 maxenergy = std::max(cinfo->maxenergy, cinfo->minenergy);

+ uint32 energy = minenergy + uint32(rellevel*(maxmana - minenergy));

SetCreateMana(mana);

SetMaxPower(POWER_MANA, mana); //MAX Mana

SetPower(POWER_MANA, mana);

+ SetCreateEnergy(energy);

+ SetMaxPower(POWER_ENERGY, energy); //MAX Energy

+ SetPower(POWER_ENERGY, energy);

// TODO: set UNIT_FIELD_POWER*, for some creature class case (energy, etc)

SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, health);

SetModifierValue(UNIT_MOD_MANA, BASE_VALUE, mana);

+ SetModifierValue(UNIT_MOD_ENERGY, BASE_VALUE, energy);

// UpdateFields.h

UNIT_FIELD_RANGED_ATTACK_POWER_MODS = OBJECT_END + 0x0079, // Size: 1, Type: TWO_SHORT, Flags: PRIVATE, OWNER

+ UNIT_FIELD_BASE_ENERGY = OBJECT_END + 0x0080, // Size: 1, Type: INT, Flags: PUBLIC

// DATA BASE

ALTER TABLE creature_template

ADD COLUMN minenergy int(10) unsigned NOT NULL default '0' AFTER maxmana,

ADD COLUMN maxenergy int(10) unsigned NOT NULL default '0' AFTER minenergy;

But probleman update create DATA BASE. :(

works this? or can you create a patch?

Link to comment
Share on other sites

workeeeeed!

but had a problem on sql of database :confused:

// DATA BASE

ALTER TABLE creature_template

ADD COLUMN minenergy int(10) unsigned NOT NULL default '0' AFTER maxmana,

ADD COLUMN maxenergy int(10) unsigned NOT NULL default '0' AFTER minenergy;

if someone can help with this pls help =)

Link to comment
Share on other sites

why there are needed new fields for energy? energy is alwasy 100, no? look at rouges or DK ghoul

and why do you added this ?

+ UNIT_FIELD_BASE_ENERGY                   = OBJECT_END + 0x0080, // Size: 1, Type: INT, Flags: PUBLIC

it was a mistake I, but I managed to solve the problem (+ UNIT_FIELD_BASE_ENERGY = OBJECT_END + 0x0080, // Size: 1, Type: INT, Flags: PUBLIC)

I managed to solve the problem of energy for vehicles, thanks for answering me, your work is very good vehicles.

But now only stated that the passengers (creature_templates_addons) could attack the top of the tanks and catapults. you know how it works?

Link to comment
Share on other sites

It's probably not a so good idea to add again fields to creature_template for vehicle.

There is maybe 150 vehicle on around 27000+ template, so more fields = wast of space in memory and more time to query from DB.

Btw, this apply also to some existing fields mainly unused and not in SMSG_CREATURE_QUERY packet like pet spellid and totem spells. We had a long discussion on UDB dev channel between some devs about this.

Nofantasy and me think that a new table should be made to host all Totem/Pet/Vehicle data and get rid of some fields in creature_template like spellx and petspellid.

This is not the purpose of this patch in any way, but just consider not adding fields to creature_template. When we find the existing flag in template which tells if mob is a Totem/Vehicle or Pet I will make another post to explain more what we discussed.

Link to comment
Share on other sites

Support some vehicle (if you need)

Argent tournament:

UPDATE creature_template SET speed = '1.5', unit_flags = 8 WHERE entry IN (33844,33845);
DELETE FROM creature_addon WHERE guid IN (SELECT guid FROM creature WHERE id IN (33844,33845));
DELETE FROM creature WHERE id IN (33844,33845);
DELETE FROM vehicle_data WHERE entry in (349);
INSERT INTO `vehicle_data` VALUES
('349', '24', '62544', '62575', '62960', '62552', '64077', '62863', '0', '0', '0', '0', '62853');
DELETE FROM vehicle_seat_data WHERE seat in (3129);
INSERT INTO `vehicle_seat_data` VALUES
('3129', '1')
INSERT INTO `npc_spellclick_spells` VALUES
('33842', '63791', '13829', '1', '0', '3');
INSERT INTO `npc_spellclick_spells` VALUES
('33842', '63791', '13839', '1', '0', '3');
INSERT INTO `npc_spellclick_spells` VALUES
('33842', '63791', '13838', '1', '0', '3');
INSERT INTO `npc_spellclick_spells` VALUES
('33843', '63792', '13828', '1', '0', '3');
INSERT INTO `npc_spellclick_spells` VALUES
('33843', '63792', '13837', '1', '0', '3');
INSERT INTO `npc_spellclick_spells` VALUES
('33843', '63792', '13835', '1', '0', '3');
DELETE FROM creature_template_addon WHERE entry IN (33844,33845);
INSERT INTO creature_template_addon (`entry`, `mount`, `bytes1`, `bytes2`, `emote`, `moveflags`, `vehicle_id`, `passengers`, `auras`) VALUES
(33844, 0, 0, 2049, 0, 0, 349, '', '');
INSERT INTO creature_template_addon (`entry`, `mount`, `bytes1`, `bytes2`, `emote`, `moveflags`, `vehicle_id`, `passengers`, `auras`) VALUES
(33845, 0, 0, 2049, 0, 0, 349, '', '');

Quest Into the Realm of Shadows (12687):

UPDATE creature_template SET faction_A = 2082, faction_H = 2082, unit_flags = 0 WHERE entry = 28782;
DELETE FROM creature_addon WHERE guid IN (SELECT guid FROM creature WHERE id = 28782);
DELETE FROM vehicle_data WHERE entry in (135);
INSERT INTO vehicle_data VALUES
(135, 12, 52362, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
DELETE FROM vehicle_seat_data WHERE seat in (1871);
INSERT INTO vehicle_seat_data VALUES
(1871, 1);
DELETE FROM npc_spellclick_spells WHERE npc_entry in (28782);
INSERT INTO npc_spellclick_spells VALUES
(28782, 52349, 12687, 1, 12687, 3);
DELETE FROM creature_template_addon WHERE entry IN (28782);
INSERT INTO creature_template_addon (`entry`, `mount`, `bytes1`, `bytes2`, `emote`, `moveflags`, `vehicle_id`, `passengers`, `auras`) VALUES
(28782, 0, 0, 1, 0, 0, 135, '', '');

Quest Grand Theft Palomino (12680):

DELETE FROM creature_addon WHERE guid IN (SELECT guid FROM creature WHERE id IN (28605,28606,28607));
INSERT INTO spell_script_target VALUES
(52264,1,28653);
DELETE FROM vehicle_data WHERE entry in (123);
INSERT INTO vehicle_data VALUES
(123, 12, 52264, 52268, 0, 0, 0, 0, 0, 0, 0, 0, 0);
DELETE FROM vehicle_seat_data WHERE seat in (1782);
INSERT INTO vehicle_seat_data VALUES
(1782, 1);
DELETE FROM npc_spellclick_spells WHERE npc_entry in (28605,28606,28607);
INSERT INTO npc_spellclick_spells VALUES
(28605, 52263, 12680, 1, 12680, 3);
INSERT INTO npc_spellclick_spells VALUES
(28606, 52263, 12680, 1, 12680, 3);
INSERT INTO npc_spellclick_spells VALUES
(28607, 52263, 12680, 1, 12680, 3);
DELETE FROM creature_template_addon WHERE entry IN (28605,28606,28607);
INSERT INTO creature_template_addon (`entry`, `mount`, `bytes1`, `bytes2`, `emote`, `moveflags`, `vehicle_id`, `passengers`, `auras`) VALUES
(28605, 0, 0, 1, 0, 0, 123, '', '');
INSERT INTO creature_template_addon (`entry`, `mount`, `bytes1`, `bytes2`, `emote`, `moveflags`, `vehicle_id`, `passengers`, `auras`) VALUES
(28606, 0, 0, 1, 0, 0, 123, '', '');
INSERT INTO creature_template_addon (`entry`, `mount`, `bytes1`, `bytes2`, `emote`, `moveflags`, `vehicle_id`, `passengers`, `auras`) VALUES
(28607, 0, 0, 1, 0, 0, 123, '', '');

Link to comment
Share on other sites

Support some vehicle (if you need)

Argent tournament:

UPDATE creature_template SET speed = '1.5', unit_flags = 8 WHERE entry IN (33844,33845);
DELETE FROM creature_addon WHERE guid IN (SELECT guid FROM creature WHERE id IN (33844,33845));
DELETE FROM creature WHERE id IN (33844,33845);
DELETE FROM vehicle_data WHERE entry in (349);
INSERT INTO `vehicle_data` VALUES
('349', '24', '62544', '62575', '62960', '62552', '64077', '62863', '0', '0', '0', '0', '62853');
DELETE FROM vehicle_seat_data WHERE seat in (3129);
INSERT INTO `vehicle_seat_data` VALUES
('3129', '1')
INSERT INTO `npc_spellclick_spells` VALUES
('33842', '63791', '13829', '1', '0', '3');
INSERT INTO `npc_spellclick_spells` VALUES
('33842', '63791', '13839', '1', '0', '3');
INSERT INTO `npc_spellclick_spells` VALUES
('33842', '63791', '13838', '1', '0', '3');
INSERT INTO `npc_spellclick_spells` VALUES
('33843', '63792', '13828', '1', '0', '3');
INSERT INTO `npc_spellclick_spells` VALUES
('33843', '63792', '13837', '1', '0', '3');
INSERT INTO `npc_spellclick_spells` VALUES
('33843', '63792', '13835', '1', '0', '3');
DELETE FROM creature_template_addon WHERE entry IN (33844,33845);
INSERT INTO creature_template_addon (`entry`, `mount`, `bytes0`, `bytes1`, `bytes2`, `emote`, `moveflags`, `vehicle_id`, `passengers`, `auras`) VALUES
(33844, 0, 6908544, 0, 2049, 0, 0, 349, '', '');
INSERT INTO creature_template_addon (`entry`, `mount`, `bytes0`, `bytes1`, `bytes2`, `emote`, `moveflags`, `vehicle_id`, `passengers`, `auras`) VALUES
(33845, 0, 6908544, 0, 2049, 0, 0, 349, '', '');

not byte0 field avaiable.

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