Forums WoW Modding Tutorials Miscellaneous [Archive] [TrinityCore] How To Add A Custom Script To Your Core

[Archive] [TrinityCore] How To Add A Custom Script To Your Core

[Archive] [TrinityCore] How To Add A Custom Script To Your Core

rektbyfaith
Administrator
0
11-04-2025, 05:04 PM
#1
Archived author: OMGhixD • Posted: 2025-11-04T18:04:34.163918
Original source

NOTICE! THIS TUTORIAL IS OLD. BUT STILL WORKS

[TrinityCore] How To Add A Custom Script To Your Core

I know its already out there but, i made this a while back and thought it wanted to release it

Hello!

Today Im Here To Show You How To Add A Custom C++ Script To Your Core,

NOTICE: THIS ONLY WORKS FOR TRINITYCORE AND TRINITY BASED CORES!

Step 1: Getting The Script!

''By Getting The Script I Mean Either Copy Paste The Script Content Into *EXAMPLE* Microsoft Ultimate 2012

By Saving The Script As A .cpp File *ÊXAMPLE* NewCustomScript.cpp''

Step 2: Applying It To The Build.

''By Applying It To The Build, I Simply Mean Put It In The Custom Script Folder! -> source/src/server/scripts/custom

Now Thats Where You Place The .cpp File Into, Now You Need To Open Cmakelist.txt And Add The File Name Between Theese Two Column's As Id Like To Call Them!

*EXAMPLE*

Code:
Quote: set(scripts_STAT_SRCS

${scripts_STAT_SRCS}

Custom/NewCustomScript.cpp

)

Click to expand...
EXAMPLE*

Now Save And Your Done With That Part!

Step 3: Adding It To The Scriptloader.cpp

Now There Is ALOT OF WAYS TO DO THIS, But The Best Way (From Own Opinion Is Cmaking it, Then Open The Trinitycore.sln And Go To The Scriptloader From There, Scriptloader Location -> Game -> Source Then Just Scroll Until You See Scriptloader.cpp

Scroll Down Until You See Something Like This

Code:
Quote: #ifdef SCRIPTS

/* This is where custom scripts' loading functions should be declared. */

#endif

Click to expand...
Quote: void AddCustomScripts()

{

#ifdef SCRIPTS

/* This is where custom scripts should be added. */

#endif

Click to expand...
}

And Find The Content That Looks Like This In Your Custom Script At The Bottom!

Code:
Quote: void AddSC_Example()

{

new Example;

}

Click to expand...
I Just Used Example, But On Your Script There Would Be Something Else! [Image: 1f642.png]

After That. Copy The '' void AddSC_Example() '' Part!

NOW! That Uve Copied That, You Simply Want To Add It To The Scriptloader.cpp *EXAMPLE UNDER*

Code:
Quote: #ifdef SCRIPTS

/* This is where custom scripts' loading functions should be declared. */

void AddSC_Example();

#endif

Click to expand...
Quote: void AddCustomScripts()

{

#ifdef SCRIPTS

/* This is where custom scripts should be added. */

AddSC_Example();

#endif

}

Click to expand...
Remember! '' void '' Wil Only Stay On The #ifdef SCRIPTS part!

ALSO REMEMBER THAT YOU NEED TO ADD ; Behind ()

Thats How It Wil Look In The End! Now Hit The Save Button. AND COMPILE!

Thanks For Reading!

As always HAVE A NICE DAY!

OMGhixD!
rektbyfaith
11-04-2025, 05:04 PM #1

Archived author: OMGhixD • Posted: 2025-11-04T18:04:34.163918
Original source

NOTICE! THIS TUTORIAL IS OLD. BUT STILL WORKS

[TrinityCore] How To Add A Custom Script To Your Core

I know its already out there but, i made this a while back and thought it wanted to release it

Hello!

Today Im Here To Show You How To Add A Custom C++ Script To Your Core,

NOTICE: THIS ONLY WORKS FOR TRINITYCORE AND TRINITY BASED CORES!

Step 1: Getting The Script!

''By Getting The Script I Mean Either Copy Paste The Script Content Into *EXAMPLE* Microsoft Ultimate 2012

By Saving The Script As A .cpp File *ÊXAMPLE* NewCustomScript.cpp''

Step 2: Applying It To The Build.

''By Applying It To The Build, I Simply Mean Put It In The Custom Script Folder! -> source/src/server/scripts/custom

Now Thats Where You Place The .cpp File Into, Now You Need To Open Cmakelist.txt And Add The File Name Between Theese Two Column's As Id Like To Call Them!

*EXAMPLE*

Code:

Quote: set(scripts_STAT_SRCS

${scripts_STAT_SRCS}

Custom/NewCustomScript.cpp

)

Click to expand...
EXAMPLE*

Now Save And Your Done With That Part!

Step 3: Adding It To The Scriptloader.cpp

Now There Is ALOT OF WAYS TO DO THIS, But The Best Way (From Own Opinion Is Cmaking it, Then Open The Trinitycore.sln And Go To The Scriptloader From There, Scriptloader Location -> Game -> Source Then Just Scroll Until You See Scriptloader.cpp

Scroll Down Until You See Something Like This

Code:
Quote: #ifdef SCRIPTS

/* This is where custom scripts' loading functions should be declared. */

#endif

Click to expand...
Quote: void AddCustomScripts()

{

#ifdef SCRIPTS

/* This is where custom scripts should be added. */

#endif

Click to expand...
}

And Find The Content That Looks Like This In Your Custom Script At The Bottom!

Code:
Quote: void AddSC_Example()

{

new Example;

}

Click to expand...
I Just Used Example, But On Your Script There Would Be Something Else! [Image: 1f642.png]

After That. Copy The '' void AddSC_Example() '' Part!

NOW! That Uve Copied That, You Simply Want To Add It To The Scriptloader.cpp *EXAMPLE UNDER*

Code:
Quote: #ifdef SCRIPTS

/* This is where custom scripts' loading functions should be declared. */

void AddSC_Example();

#endif

Click to expand...
Quote: void AddCustomScripts()

{

#ifdef SCRIPTS

/* This is where custom scripts should be added. */

AddSC_Example();

#endif

}

Click to expand...
Remember! '' void '' Wil Only Stay On The #ifdef SCRIPTS part!

ALSO REMEMBER THAT YOU NEED TO ADD ; Behind ()

Thats How It Wil Look In The End! Now Hit The Save Button. AND COMPILE!

Thanks For Reading!

As always HAVE A NICE DAY!

OMGhixD!

rektbyfaith
Administrator
0
11-04-2025, 05:04 PM
#2
Archived author: OMGhixD • Posted: 2025-11-04T18:04:34.163918
Original source

what i need to do this ? i use emucoach_v8_vip 4.3.4
rektbyfaith
11-04-2025, 05:04 PM #2

Archived author: OMGhixD • Posted: 2025-11-04T18:04:34.163918
Original source

what i need to do this ? i use emucoach_v8_vip 4.3.4

rektbyfaith
Administrator
0
11-04-2025, 05:04 PM
#3
Archived author: OMGhixD • Posted: 2025-11-04T18:04:34.163918
Original source

Quote:darkariam said:

what i need to do this ? i use emucoach_v8_vip 4.3.4

Click to expand...
That would be a REPACK. you cannot add scripts to repacks, unless you have the source code
rektbyfaith
11-04-2025, 05:04 PM #3

Archived author: OMGhixD • Posted: 2025-11-04T18:04:34.163918
Original source

Quote:darkariam said:

what i need to do this ? i use emucoach_v8_vip 4.3.4

Click to expand...
That would be a REPACK. you cannot add scripts to repacks, unless you have the source code

rektbyfaith
Administrator
0
11-04-2025, 05:04 PM
#4
Archived author: OMGhixD • Posted: 2025-11-04T18:04:34.163918
Original source

Thanks I have all these custom scripts that I never knew how to implement now I do lol thanks <3
rektbyfaith
11-04-2025, 05:04 PM #4

Archived author: OMGhixD • Posted: 2025-11-04T18:04:34.163918
Original source

Thanks I have all these custom scripts that I never knew how to implement now I do lol thanks <3

rektbyfaith
Administrator
0
11-04-2025, 05:04 PM
#5
Archived author: OMGhixD • Posted: 2025-11-04T18:04:34.163918
Original source

Thanks bro it was very usefull
rektbyfaith
11-04-2025, 05:04 PM #5

Archived author: OMGhixD • Posted: 2025-11-04T18:04:34.163918
Original source

Thanks bro it was very usefull

rektbyfaith
Administrator
0
11-04-2025, 05:04 PM
#6
Archived author: OMGhixD • Posted: 2025-11-04T18:04:34.163918
Original source

Very easy to understand, thank you.
rektbyfaith
11-04-2025, 05:04 PM #6

Archived author: OMGhixD • Posted: 2025-11-04T18:04:34.163918
Original source

Very easy to understand, thank you.

rektbyfaith
Administrator
0
11-04-2025, 05:04 PM
#7
Archived author: OMGhixD • Posted: 2025-11-04T18:04:34.163918
Original source

Thank you for your work
rektbyfaith
11-04-2025, 05:04 PM #7

Archived author: OMGhixD • Posted: 2025-11-04T18:04:34.163918
Original source

Thank you for your work

Recently Browsing
 1 Guest(s)
Recently Browsing
 1 Guest(s)