PDA

View Full Version : [Trinity C++] Profession npc

Synth
09-24-2013, 10:04 AM
Hello Emudevs,today i'm releasing an profession NPC gotten from Sdyess release some time ago, and it was updated by Jameyboor.So I decided to release it to you guys on Emudevs,it was released on a website by Ghostcrawler336.

Script info:
●This npc will allow you to learn up to two professions noting much about it.

SQL:

-- Professions NPC
INSERT INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction_A`, `faction_H`, `npcflag`, `speed_walk`, `speed_run`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `unit_flags2`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `HoverHeight`, `Health_mod`, `Mana_mod`, `Armor_mod`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `movementId`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`, `WDBVerified`) VALUES (700014, 0, 0, 0, 0, 0, 24454, 0, 0, 0, 'Professions', 'Emudevs', NULL, 0, 80, 80, 0, 35, 35, 1, 1, 1.14286, 1.5, 0, 13, 17, 0, 42, 1, 1500, 0, 1, 512, 2048, 8, 0, 0, 0, 0, 0, 9, 13, 100, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 'Professions_NPC', 12340);

Script:
Professions NPC - C++ - EmuDevs Paste (http://paste.emudevs.com/?paste=88)

If you find any bug or errors once you compile feel free to ask me!
Thank you!
Best regards,
Synth !

Jameyboor
09-24-2013, 11:51 AM
Thanks for sharing :smile:

Synth
09-24-2013, 12:36 PM
Thanks for sharing :smile:
No problem bro :tongue:

Tommy
09-24-2013, 06:07 PM
Thanks for sharing! <3

Synth
09-24-2013, 07:12 PM
Thanks for sharing! <3
No problem :smile:

bromia
12-17-2013, 09:49 PM
Compile error with fresh trinitycore :(

Error 1 error C2039: 'outError' : is not a member of 'Log' C:\Source\TrinityCore2\src\server\scripts\Custom\p rofessions_npc.cpp 89 1 scripts
Error 2 error C2065: 'LOG_FILTER_PLAYER_SKILLS' : undeclared identifier C:\Source\TrinityCore2\src\server\scripts\Custom\p rofessions_npc.cpp 89 1 scripts

Tommy
12-17-2013, 10:06 PM
Fixed: http://paste.emudevs.com/?paste=21

bromia
12-19-2013, 08:55 AM
Thx, working :)

Edit: Npc need SQL update!

I fix, but little custom from stat's. why? I create new row from creature_template, and write new stat... (HP, Mana, Armor) Any stat's copy from original = untouched!

Fix:

INSERT INTO `world`.`creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction_A`, `faction_H`, `npcflag`, `speed_walk`, `speed_run`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `unit_flags2`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `HoverHeight`, `Health_mod`, `Mana_mod`, `Armor_mod`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `movementId`, `RegenHealth`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`, `WDBVerified`) VALUES ('700014', '0', '0', '0', '0', '0', '24454', '0', '0', '0', 'Professions', 'Emudevs', '', '0', '80', '80', '0', '35', '35', '1', '1', '1', '1', '3', '1000', '20000', '0', '0', '1', '2000', '2000', '1', '512', '2048', '8', '0', '0', '0', '0', '0', '0', '0', '0', '13', '100', '7', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '', '1', '1', '1', '3', '3', '3', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '2', 'Professions_NPC', '12340');

Synth
12-21-2013, 10:48 AM
Thx, working :)

Edit: Npc need SQL update!

I fix, but little custom from stat's. why? I create new row from creature_template, and write new stat... (HP, Mana, Armor) Any stat's copy from original = untouched!

Fix:

INSERT INTO `world`.`creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction_A`, `faction_H`, `npcflag`, `speed_walk`, `speed_run`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `unit_flags2`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `HoverHeight`, `Health_mod`, `Mana_mod`, `Armor_mod`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `movementId`, `RegenHealth`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`, `WDBVerified`) VALUES ('700014', '0', '0', '0', '0', '0', '24454', '0', '0', '0', 'Professions', 'Emudevs', '', '0', '80', '80', '0', '35', '35', '1', '1', '1', '1', '3', '1000', '20000', '0', '0', '1', '2000', '2000', '1', '512', '2048', '8', '0', '0', '0', '0', '0', '0', '0', '0', '13', '100', '7', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '', '1', '1', '1', '3', '3', '3', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '2', 'Professions_NPC', '12340');

Thank you :smile:

- - - Updated - - -

Thx, working :)

Edit: Npc need SQL update!

I fix, but little custom from stat's. why? I create new row from creature_template, and write new stat... (HP, Mana, Armor) Any stat's copy from original = untouched!

Fix:
Thank you :smile:

Demonid
12-24-2013, 07:52 AM
This Script needs an Update since Trinitycore Commit: https://github.com/TrinityCore/TrinityCore/commit/107af528536980380c887379b56f6351a9781a2f

This are the errors:

http://puu.sh/5X24W.png

Demonid
12-26-2013, 08:56 AM
To fix the MonsterWhisper error change GetGUID to ToPlayer

For example:

_creature->MonsterWhisper(text, pPlayer->GetGUID());

to

_creature->MonsterWhisper(text, pPlayer->ToPlayer());

jeremymeile
01-04-2014, 07:53 PM
Very nice but...

if you already learned first aid or cooking you cannot learn it from the npc... is there a way to delete these before the npc add you the new profession?

Tommy
01-04-2014, 09:00 PM
To fix the MonsterWhisper error change GetGUID to ToPlayer

For example:

_creature->MonsterWhisper(text, pPlayer->GetGUID());

to

_creature->MonsterWhisper(text, pPlayer->ToPlayer());

Why are you calling 'ToPlayer()' when 'pPlayer' is Player*? It should be:

_creature->MonsterWhisper(text, pPlayer);

Very nice but...

if you already learned first aid or cooking you cannot learn it from the npc... is there a way to delete these before the npc add you the new profession?

What do you mean? Those are secondary skills, why would you want to remove them?

I'll redo the script, it is poorly coded (or updated), outdated and ignores a lot of easy functions to call for some of this for simplification..

Updated: http://paste.emudevs.com/?paste=43

Blazeqts
01-25-2014, 03:15 AM
Tommy, i get compile errors using ur updated script.

http://pastebin.com/hT0qHpBd

any solution?

Tommy
01-25-2014, 03:47 AM
On line 208, it should be 'return false', not 'return', fixed:

http://paste.emudevs.com/?paste=88

Blazeqts
01-25-2014, 04:19 AM
Tommy, can you make it so the amount of skill you get from taking a profession is only 150, and not 450? :) Would appreciate it!

sandyqyh
02-26-2014, 04:33 AM
Very cool!Thank you !
There is a suggestion:
If you learn,you should hide this option or mark it.