• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[SOLVED] Custom script in Cmangos and Modify something!

Status
Not open for further replies.

blackmetal

Exalted Member
Hi, i just started something fun with Cmangos TBC, but i only have exp with trinitycore, they are almost the same but i can not find custom script folder in Cmangos :kiddingme:, i'm going to apply some custom script that change defense skill, wand skill getting max at login, i found some script write by tommy, now i only need a way to apply it :sweaty: Thanks!
 

Tommy

Founder
MaNGOS "scripts" are apart of a submodule in the "modules" folder. For example: https://github.com/mangosone/server/tree/develop21/src/modules - "Eluna" and "SD3" (which SD3 is what you are looking for) show up like so on Github. Imo, might be better to just use Eluna as TrinityCore and MaNGOS C++ AI/other code is a bit different (mainly referring to specific method rename, etc) when it comes to handling custom scripts, just saying.
 

blackmetal

Exalted Member
#not in topic: What you mean on "brain fart" :kiddingme: :kiddingme: :kiddingme::kiddingme::kiddingme:

Anyway, can you give me simple hook how to add your script:

Code:
/***********************************************************************************
*                                                                                  *
*                              Created by,                                         *
*                              Tommy aka QQRofl                                    *
*                              [Reluctant for the idea]                            *
************************************************************************************/
#include "ScriptPCH.h"

enum SkillSpells
{
	SPELL_BLOCK = 107,
	SPELL_BOWS = 264,
	SPELL_CROSSBOWS = 5011,
	SPELL_DAGGERS = 1180,
	SPELL_DUAL_WIELD = 674,
	SPELL_FIST_WEAPONS = 15590,
	SPELL_GUNS = 266,
	SPELL_MAIL = 8737,
	SPELL_PLATE = 750,
	SPELL_ONE_HANDED_AXES = 196,
	SPELL_ONE_HANDED_MACES = 198,
	SPELL_ONE_HANDED_SWORDS = 201,
	SPELL_TWO_HANDED_AXES = 197,
	SPELL_TWO_HANDED_MACES = 199,
	SPELL_TWO_HANDED_SWORDS = 202,
	SPELL_STAVES = 227,
	SPELL_THROW = 2764,
	SPELL_THROWN = 2567,
	SPELL_POLEARMS = 200,
	SPELL_RELIC = 52665,
	SPELL_RELIC_2 = 27764,
	SPELL_RELIC_3 = 27762,
	SPELL_RELIC_4 = 27763,
	SPELL_SHIELD = 9116,
	SPELL_SHOOT = 3018,
	SPELL_SHOOT_WANDS = 5019,
	SPELL_WANDS = 5009
};

class skills_on_login : public PlayerScript
{
    public:
		skills_on_login() : PlayerScript("skills_on_login") { }

		void OnLogin(Player * player)
		{
			if(player->HasAtLoginFlag(AT_LOGIN_FIRST))
			{
				switch(player->getClass())
				{
				   case CLASS_PALADIN:
					   {
						   player->learnSpell(SPELL_BLOCK, true);
						   player->learnSpell(SPELL_ONE_HANDED_AXES, true);
						   player->learnSpell(SPELL_ONE_HANDED_MACES, true);
						   player->learnSpell(SPELL_ONE_HANDED_SWORDS, true);
						   player->learnSpell(SPELL_PLATE, true);
						   player->learnSpell(SPELL_POLEARMS, true);
						   player->learnSpell(SPELL_RELIC_3, true);
						   player->learnSpell(SPELL_SHIELD, true);
						   player->learnSpell(SPELL_TWO_HANDED_AXES, true);
						   player->learnSpell(SPELL_TWO_HANDED_MACES, true);
						   player->learnSpell(SPELL_TWO_HANDED_SWORDS, true);
					   }break;

				   case CLASS_SHAMAN:
					   {
						   player->learnSpell(SPELL_BLOCK, true);
						   player->learnSpell(SPELL_FIST_WEAPONS, true);
						   player->learnSpell(SPELL_MAIL, true);
						   player->learnSpell(SPELL_ONE_HANDED_AXES, true);
						   player->learnSpell(SPELL_ONE_HANDED_MACES, true);
						   player->learnSpell(SPELL_RELIC_4, true);
						   player->learnSpell(SPELL_SHIELD, true);
						   player->learnSpell(SPELL_STAVES, true);
						   player->learnSpell(SPELL_TWO_HANDED_AXES, true);
						   player->learnSpell(SPELL_TWO_HANDED_MACES, true);
					   }break;

				   case CLASS_WARRIOR:
					   {
						   player->learnSpell(SPELL_BLOCK, true);
						   player->learnSpell(SPELL_BOWS, true);
						   player->learnSpell(SPELL_CROSSBOWS, true);
						   player->learnSpell(SPELL_DUAL_WIELD, true);
						   player->learnSpell(SPELL_FIST_WEAPONS, true);
						   player->learnSpell(SPELL_GUNS, true);
						   player->learnSpell(SPELL_ONE_HANDED_AXES, true);
						   player->learnSpell(SPELL_ONE_HANDED_MACES, true);
						   player->learnSpell(SPELL_ONE_HANDED_SWORDS, true);
						   player->learnSpell(SPELL_PLATE, true);
						   player->learnSpell(SPELL_POLEARMS, true);
						   player->learnSpell(SPELL_SHIELD, true);
						   player->learnSpell(SPELL_SHOOT, true);
						   player->learnSpell(SPELL_STAVES, true);
						   player->learnSpell(SPELL_THROW, true);
						   player->learnSpell(SPELL_THROWN, true);
						   player->learnSpell(SPELL_TWO_HANDED_AXES, true);
						   player->learnSpell(SPELL_TWO_HANDED_MACES, true);
						   player->learnSpell(SPELL_TWO_HANDED_SWORDS, true);
					   }break;

				   case CLASS_HUNTER:
					   {
						   player->learnSpell(SPELL_BOWS, true);
						   player->learnSpell(SPELL_CROSSBOWS, true);
						   player->learnSpell(SPELL_DUAL_WIELD, true);
						   player->learnSpell(SPELL_FIST_WEAPONS, true);
						   player->learnSpell(SPELL_GUNS, true);
						   player->learnSpell(SPELL_MAIL, true);
						   player->learnSpell(SPELL_ONE_HANDED_AXES, true);
						   player->learnSpell(SPELL_ONE_HANDED_SWORDS, true);
						   player->learnSpell(SPELL_POLEARMS, true);
						   player->learnSpell(SPELL_STAVES, true);
						   player->learnSpell(SPELL_TWO_HANDED_AXES, true);
						   player->learnSpell(SPELL_TWO_HANDED_SWORDS, true);
					   }break;

				   case CLASS_ROGUE:
					   {
						   player->learnSpell(SPELL_BOWS, true);
						   player->learnSpell(SPELL_CROSSBOWS, true);
						   player->learnSpell(SPELL_DUAL_WIELD, true);
						   player->learnSpell(SPELL_FIST_WEAPONS, true);
						   player->learnSpell(SPELL_GUNS, true);
						   player->learnSpell(SPELL_ONE_HANDED_AXES, true);
						   player->learnSpell(SPELL_ONE_HANDED_MACES, true);
						   player->learnSpell(SPELL_ONE_HANDED_SWORDS, true);
						   player->learnSpell(SPELL_SHOOT, true);
						   player->learnSpell(SPELL_THROW, true);
						   player->learnSpell(SPELL_THROWN, true);
					   }break;

				   case CLASS_DRUID:
					   {
						   player->learnSpell(SPELL_DAGGERS, true);
						   player->learnSpell(SPELL_FIST_WEAPONS, true);
						   player->learnSpell(SPELL_ONE_HANDED_MACES, true);
						   player->learnSpell(SPELL_POLEARMS, true);
						   player->learnSpell(SPELL_RELIC_2, true);
						   player->learnSpell(SPELL_STAVES, true);
						   player->learnSpell(SPELL_TWO_HANDED_MACES, true);
					   }break;

				   case CLASS_MAGE:
					   {
						   player->learnSpell(SPELL_DAGGERS, true);
						   player->learnSpell(SPELL_ONE_HANDED_SWORDS, true);
						   player->learnSpell(SPELL_SHOOT_WANDS, true);
						   player->learnSpell(SPELL_STAVES, true);
						   player->learnSpell(SPELL_WANDS, true);
					   }break;

				   case CLASS_WARLOCK:
					   {
						   player->learnSpell(SPELL_DAGGERS, true);
						   player->learnSpell(SPELL_ONE_HANDED_SWORDS, true);
						   player->learnSpell(SPELL_SHOOT_WANDS, true);
						   player->learnSpell(SPELL_STAVES, true);
						   player->learnSpell(SPELL_WANDS, true);
					   }break;

				   case CLASS_PRIEST:
					   {
						   player->learnSpell(SPELL_DAGGERS, true);
						   player->learnSpell(SPELL_ONE_HANDED_MACES, true);
						   player->learnSpell(SPELL_SHOOT_WANDS, true);
						   player->learnSpell(SPELL_STAVES, true);
						   player->learnSpell(SPELL_WANDS, true);
					   }break;

				   case CLASS_DEATH_KNIGHT:
					   {
						   player->learnSpell(SPELL_DUAL_WIELD, true);
						   player->learnSpell(SPELL_ONE_HANDED_AXES, true);
						   player->learnSpell(SPELL_ONE_HANDED_MACES, true);
						   player->learnSpell(SPELL_ONE_HANDED_SWORDS, true);
						   player->learnSpell(SPELL_PLATE, true);
						   player->learnSpell(SPELL_POLEARMS, true);
						   player->learnSpell(SPELL_RELIC, true);
						   player->learnSpell(SPELL_TWO_HANDED_AXES, true);
						   player->learnSpell(SPELL_TWO_HANDED_MACES, true);
						   player->learnSpell(SPELL_TWO_HANDED_SWORDS, true);
					   }break;
				}
			    player->MonsterWhisper("You now have all of your skills and they are also maxed out!", player->GetGUID());
			    player->UpdateSkillsToMaxSkillsForLevel();
			}
		}
};

void AddSC_skills_on_first_login()
{
	new skills_on_login;
}
to Cmangos, i have no idea with Cmangos script :megusta:,
 
Last edited:

Tommy

Founder
#not in topic: What you mean on "brain fart" :kiddingme: :kiddingme: :kiddingme::kiddingme::kiddingme:

Really? How can you not see that? XD - Brain fart = being derp basically. Supposed to be humor, right? :/

That script is pretty old. I never messed with cMaNGOS much, nor do I have a cMaNGOS source to convert the script.
 

Rochet2

Moderator / Eluna Dev
If you look at the scripts here and around this folder
https://github.com/cmangos/mangos-tbc/tree/master/src/scriptdev2/scripts/examples

you should see how the scripts are.

After adding the script to there (in some folder under the scripts folder, for example the one I linked) you should add it to the scriptloader like all other scripts are:
https://github.com/cmangos/mangos-tbc/blob/master/src/scriptdev2/system/ScriptLoader.cpp

And unless you use cmake, you need to either edit the solution file or open the solution in visual studio and drag and drop the script file or otherwise add it to the scriptdev2 project.
Looks like Cmake should be able to get all cpp and h files from all directories in the scripts directory recursively so no cmakelists.txt editing would be needed.


PS. Looks to me like the script you linked in this thread is for TrinityCore and would need some edits to be converted to MaNGOS/cMaNGOS
 
Status
Not open for further replies.
Top