T端多功能魔兽NPC脚本-Tools Npc脚本代码
已经有很多的功能性的NPC的Trinity-Core魔兽世界私服单机 的脚本代码。这里我在弄一个可能大家都会比较喜欢的NPC脚本代码
1、适用于怀旧魔兽私服Trinity-Core 3.3.5版本最新
2、此脚本是npc 的C++脚本,脚本名称要加到creature_template对应的NPC的脚本处
3、你需要知道如何在T端中增加对应的脚本功能
4、下面是一些该脚本的功能描述
NPC 功能包含:
• 恢复血量和法力值
• 重置所有的副本进度
• 重置所有的技能冷却时间
• 重置战斗状态
• 移除虚弱状态
• 修复所有装备
• 重置天赋
• 重置所有的技能
5、SQL代码
/*
REPLACE 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`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`, `WDBVerified`) VALUES('900000','0','0','0','0','0','26867','0','0','0','Tools NPC','- by mthsena -','Speak','0','80','80','0','35','35','1','1','1.14286','2','3','0','0','0','0','1','0','0','1','0','0','0','0','0','0','0','0','0','0','0','0','4','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','Tools_NPC','1');
- Made by mthsena
*/
或则你另外选一个NPC的ID:例如 伊利丹,例如基尔加丹,这些NPC。
当然,如果是5.X.X的版本的话,。你可以考虑用用 雷神王座 的BOSS的模型什么的!这样弄起来更好看!
6、脚本C++代码:
或则你另外选一个NPC的ID:例如 伊利丹,例如基尔加丹,这些NPC。
当然,如果是5.X.X的版本的话,。你可以考虑用用 雷神王座 的BOSS的模型什么的!这样弄起来更好看!
6、脚本C++代码:
/* REPLACE 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`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`, `WDBVerified`) VALUES('900000','0','0','0','0','0','26867','0','0','0','Tools NPC','- by mthsena -','Speak','0','80','80','0','35','35','1','1','1.14286','2','3','0','0','0','0','1','0','0','1','0','0','0','0','0','0','0','0','0','0','0','0','4','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','Tools_NPC','1'); - Made by mthsena */ #include "ScriptPCH.h" class Tools_NPC : public CreatureScript { public: Tools_NPC() : CreatureScript("Tools_NPC") { } bool OnGossipHello(Player *player, Creature *creature) { player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Restore HP and MP", GOSSIP_SENDER_MAIN, 1); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Reset Instances", GOSSIP_SENDER_MAIN, 2); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Reset Cooldowns", GOSSIP_SENDER_MAIN, 3); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Reset Combat", GOSSIP_SENDER_MAIN, 4); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Remove Sickness", GOSSIP_SENDER_MAIN, 5); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Repair Items", GOSSIP_SENDER_MAIN, 6); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Others...", GOSSIP_SENDER_MAIN, 7); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Exit", GOSSIP_SENDER_MAIN, 8); player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); return true; } bool OnGossipSelect(Player *player, Creature *creature, uint32 sender, uint32 action) { player->PlayerTalkClass->ClearMenus(); switch(action) { case 1: // Restore HP and MP if(player->IsInCombat()) { creature->MonsterWhisper("You're in combat!", player->GetGUID(), false); player->CLOSE_GOSSIP_MENU(); return false; } else if(player->getPowerType() == POWER_MANA) player->SetPower(POWER_MANA, player->GetMaxPower(POWER_MANA)); player->SetHealth(player->GetMaxHealth()); player->CLOSE_GOSSIP_MENU(); break; case 2: // Reset Instances for (uint8 i = 0; i < MAX_DIFFICULTY; ++i) { Player::BoundInstancesMap &binds = player->GetBoundInstances(Difficulty(i)); for (Player::BoundInstancesMap::iterator itr = binds.begin(); itr != binds.end();) { player->UnbindInstance(itr, Difficulty(i)); } } player->CLOSE_GOSSIP_MENU(); break; case 3: // Reset Cooldowns if(player->IsInCombat()) { creature->MonsterWhisper("You're in combat!", player->GetGUID(), false); player->CLOSE_GOSSIP_MENU(); return false; } player->RemoveAllSpellCooldown(); player->CLOSE_GOSSIP_MENU(); break; case 4: // Reset Combat player->CombatStop(); player->CLOSE_GOSSIP_MENU(); break; case 5: // Remove Sickness if(player->HasAura(15007)) player->RemoveAura(15007); player->CLOSE_GOSSIP_MENU(); break; case 6: // Repair Items player->DurabilityRepairAll(false, 0, false); player->CLOSE_GOSSIP_MENU(); break; case 7: // Others player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Reset Talents", GOSSIP_SENDER_MAIN, 71); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Reset Spells", GOSSIP_SENDER_MAIN, 72); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "...Back", GOSSIP_SENDER_MAIN, 73); player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); break; case 8: player->CLOSE_GOSSIP_MENU(); break; case 71: // Reset Talents player->resetTalents(true); player->SendTalentsInfoData(false); player->CLOSE_GOSSIP_MENU(); break; case 72: // Reset Spells player->resetSpells(); player->CLOSE_GOSSIP_MENU(); break; case 73: // ...Back player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Restore HP and MP", GOSSIP_SENDER_MAIN, 1); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Reset Instances", GOSSIP_SENDER_MAIN, 2); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Reset Cooldowns", GOSSIP_SENDER_MAIN, 3); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Reset Combat", GOSSIP_SENDER_MAIN, 4); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Remove Sickness", GOSSIP_SENDER_MAIN, 5); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Repair Items", GOSSIP_SENDER_MAIN, 6); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Others...", GOSSIP_SENDER_MAIN, 7); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "Exit", GOSSIP_SENDER_MAIN, 8); player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); break; } return true; } }; void AddSC_Tools_NPC() { new Tools_NPC(); }