Jump to content

Different InGame GM Effects Based on GM Name


Recommended Posts

  • Active+ Member
Posted (edited)

So ashika posted this a few days ago

And since i couldnt find a way to show all of them ingame depending on the GM "class" i decided to make my own, its not that hard tbh, and i think it doesnt fck anything but if u find problems let me know.

Here's the result
4bc9eca32446806099f7fe9482594d4b.png

First of all, the way the system works is by the GM name, so if it has [SA] or [GM] in name it will apply the effect for it.

Server Side
service.h
 

#define ENABLE_CUSTOM_TAG_EFFECTS

 

affect.h

in enum EAffectBits
search for the last enum (in my case is AFF_BITS_MAX)
and before it add
 
#ifdef ENABLE_CUSTOM_TAG_EFFECTS
	AFF_GA,
	AFF_GM,
	AFF_SA,
#endif

 

on char.cpp

Search for m_afAffectFlag.Set(AFF_YMIR);
And replace it with this

#ifdef ENABLE_CUSTOM_TAG_EFFECTS
  
  			
			const char* name = GetName();
			
			// This will only search for the first 4 characters if u want more for tags such as [DEV] you will need to increase this values
			char result[5];
			strncpy(result, name, 4);
			result[4] = '\0';

			// This is where you change the tag
			const char *tagDictionary[] = { 
				"[GM]", 
				"[SA]", 
				"[GA]"
			};

			// This is where you change the effect name to what you put on affect.h
			const EAffectBits nameDictionary[] = {
				AFF_GM,
				AFF_SA,
				AFF_GA
			};

			int tagIndex = -1;
			for (int i = 0; i < sizeof(tagDictionary) / sizeof(tagDictionary[0]); ++i) {
				if (strcmp(result, tagDictionary[i]) == 0) {
					tagIndex = i;
					break;
				}
			}

			if (tagIndex != -1) {
				m_afAffectFlag.Set(nameDictionary[tagIndex]);
			}
			else{
				m_afAffectFlag.Set(AFF_YMIR);
			}
#endif

 

On client side

locale_inc.h

#define ENABLE_CUSTOM_TAG_EFFECTS

 

InstanceBaseEffect.cpp

On CInstanceBase::__SetAffect(
Search case AFFECT_YMIR:
Add below
#ifdef ENABLE_CUSTOM_TAG_EFFECTS
		case AFFECT_GA:
		case AFFECT_GM:
		case AFFECT_SA:
#endif

 

InstanceBase.h

Search for AFFECT_NUM
Add before
#ifdef ENABLE_CUSTOM_TAG_EFFECTS
			AFFECT_GA, // 50
			AFFECT_GM, // 51
			AFFECT_SA, // 52
#endif

 

InstanceBase.cpp

On CInstanceBase::IsGameMaster()
Add before return false
#ifdef ENABLE_CUSTOM_TAG_EFFECTS
	if (m_kAffectFlagContainer.IsSet(AFFECT_GA))
		return true;
	if (m_kAffectFlagContainer.IsSet(AFFECT_GM))
		return true;
	if (m_kAffectFlagContainer.IsSet(AFFECT_SA))
		return true;
#endif

 

PythonCharacterModule.cpp

Add next to the others
#ifdef ENABLE_CUSTOM_TAG_EFFECTS
	PyModule_AddIntConstant(poModule, "AFFECT_GA", CInstanceBase::AFFECT_GA);
	PyModule_AddIntConstant(poModule, "AFFECT_GM", CInstanceBase::AFFECT_GM);
	PyModule_AddIntConstant(poModule, "AFFECT_SA", CInstanceBase::AFFECT_SA);
#endif

 

This file is for the Faster Loading System found here on the forum, if u dont have it, you will need to add the effect on client/root/playersettingsmodule.py, i wont provide a code for cuz i dont really have a way to test it, but shouldn't be that hard

PythonPlayerSettingsModule.cpp

Find {pkBase.EFFECT_REFINED + 1
Before add
#ifdef ENABLE_CUSTOM_TAG_EFFECTS
		  {pkBase.EFFECT_AFFECT + CInstanceBase::AFFECT_GA, "Bip01", "d:/ymir work/effect/team_ranks/ga.mse"},
		  {pkBase.EFFECT_AFFECT + CInstanceBase::AFFECT_GM, "Bip01", "d:/ymir work/effect/team_ranks/gm.mse"},
		  {pkBase.EFFECT_AFFECT + CInstanceBase::AFFECT_SA, "Bip01", "d:/ymir work/effect/team_ranks/sa.mse"},
#endif

 

Lastly, on client you will need to add ashika files where you want (in my case i added to etc/ymir work/effect/team_ranks/ and duplicate the gm.mse file (in this case 2 times), change the name to ga.mse and sa.mse, then will open them and at the end of the file there is going to be this line

List TextureFiles
        {
            "gamemaster.tga"
        }

change them acording to the effect you want, on this case, for GA is gameadmin.tga, for GM is gamemaster.tga and for SA is serveradmin.tga.

 

And thats all, hope you all like it!

 

Edited by Metin2 Dev International
Core X - External 2 Internal
  • Metin2 Dev 2
  • Good 1
  • Love 4
Link to comment
Share on other sites

  • Active+ Member
Posted (edited)

EDIT: I found a better way to search for the tag

On char.cpp

Instead of

#ifdef ENABLE_CUSTOM_TAG_EFFECTS
  	const char* name = GetName();
	char result[5];
	strncpy(result, name, 4);
	result[4] = '\0';

Make it like this
 

#ifdef ENABLE_CUSTOM_TAG_EFFECTS
  	const char* name = GetName();
	size_t len = strcspn(name, "]");
	char result[len+1];
	strncpy(result, name, len +1);
	result[len + 1] = '\0';

 

This way you can have any tag size without having to do any modification on the code, and for what i saw on my tests, if i increased from 4 chars to 5 it will have problems, this way there is no problem at all!!!

Edited by LethalArms
added ifdef
  • Metin2 Dev 1
  • Love 1
Link to comment
Share on other sites

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / 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.