Jump to content

Recommended Posts

Hello everyone, I would like to know if someone know the simpliest way to setting up an effect client side always visible ?
To explain a bit I want to display an effect only clientside (Based on the metin detector code) for a player on a map. I'm using a trick to spawn an invisible NPC and spawn the effect at his position but if i'm not looking directly at the "invisible npc" the effect is not displayed. I'm using the GameForge effect:

 

spacer.png

Here is the code:

	else if (!strcmpi(szCmd, "ShowZone"))
	{
		if (4 != TokenVector.size())
		{
			TraceError("CPythonNetworkStream::ServerCommand(c_szCommand=%s) - Strange Parameter Count : %d", c_szCommand, TokenVector.size());
			return;
		}
		DWORD dwVID = atoi(TokenVector[1].c_str());
		BYTE bType = atoi(TokenVector[2].c_str());
		float iSize = static_cast<float>(atof(TokenVector[3].c_str()));
		IAbstractCharacterManager& rkChrMgr = IAbstractCharacterManager::GetSingleton();

		CInstanceBase* pInstance = rkChrMgr.GetInstancePtr(dwVID);
		if (!pInstance)
		{
			TraceError("CPythonNetworkStream::ServerCommand(c_szCommand=%s) - Not Exist Instance", c_szCommand);
			return;
		}
		pInstance->SetAlwaysRender(true);
			
		TPixelPosition PixelPosition;
		D3DXVECTOR3 v3Rotation(0.0f, 0.0f, 0.0f);
		D3DXVECTOR3 v3Scale(iSize, iSize, iSize);
		pInstance->NEW_GetPixelPosition(&PixelPosition);

		PixelPosition.y *= -1.0f;
		//PixelPosition.z -= 30.0f;
		switch (bType)
		{
			case 1:
			{
				CEffectManager::Instance().RegisterEffect("d:/ymir work/effect/battleroyale/battley_01.mse", true);
				CEffectManager::Instance().CreateEffect("d:/ymir work/effect/battleroyale/battley_01.mse", PixelPosition, v3Rotation, iSize);
			}
			break;
			case 2:
			{
				CEffectManager::Instance().RegisterEffect("d:/ymir work/effect/battleroyale/battley_01_64.mse", true);
				CEffectManager::Instance().CreateEffect("d:/ymir work/effect/battleroyale/battley_01_64.mse", PixelPosition, v3Rotation, iSize);
			}
			break;
			case 3:
			{
				CEffectManager::Instance().RegisterEffect("d:/ymir work/effect/battleroyale/battley_02_sphere.mse", true);
				CEffectManager::Instance().CreateEffect("d:/ymir work/effect/battleroyale/battley_02_sphere.mse", PixelPosition, v3Rotation, iSize);
			}
			break;
		}
	}


Or what is the best way to display this effect at a given position and setting it always visible ?

Thanks in advance

Edited by Metin2 Dev
Core X - External 2 Internal
  • 2 weeks later...

Hi! ?

I dont wanna waste the words, here you are:

Step I.

I. Open the "EffectLib/EffectManager.h" and look for the following lines:

		int CreateEffect(DWORD dwID, const D3DXVECTOR3 & c_rv3Position, const D3DXVECTOR3 & c_rv3Rotation);
		int CreateEffect(const char * c_szFileName, const D3DXVECTOR3 & c_rv3Position, const D3DXVECTOR3 & c_rv3Rotation);

		void CreateEffectInstance(DWORD dwInstanceIndex, DWORD dwID);

 

II. and replace those lines with the following lines:

		int CreateEffect(DWORD dwID, const D3DXVECTOR3 & c_rv3Position, const D3DXVECTOR3 & c_rv3Rotation, bool bSkipSphere = false);
		int CreateEffect(const char * c_szFileName, const D3DXVECTOR3 & c_rv3Position, const D3DXVECTOR3 & c_rv3Rotation, bool bSkipSphere = false);

		void CreateEffectInstance(DWORD dwInstanceIndex, DWORD dwID, bool bSkipSphere = false);

 

Step II.

I. Open the "EffectLib/EffectManager.cpp" and look for the following line:

int CEffectManager::CreateEffect(const char * c_szFileName, const D3DXVECTOR3 & c_rv3Position, const D3DXVECTOR3 & c_rv3Rotation)

 

II. and replace that line with the following line:

int CEffectManager::CreateEffect(const char * c_szFileName, const D3DXVECTOR3 & c_rv3Position, const D3DXVECTOR3 & c_rv3Rotation, bool bSkipSphere)

 

III. and now, you have to look for the folowing line:

	return CreateEffect(dwID, c_rv3Position, c_rv3Rotation);

 

IV. and replace that line with the following line:

	return CreateEffect(dwID, c_rv3Position, c_rv3Rotation, bSkipSphere);

 

V. and now, you have to look for the folowing line:

int CEffectManager::CreateEffect(DWORD dwID, const D3DXVECTOR3 & c_rv3Position, const D3DXVECTOR3 & c_rv3Rotation)

 

VI. and replace that line with the following line:

int CEffectManager::CreateEffect(DWORD dwID, const D3DXVECTOR3 & c_rv3Position, const D3DXVECTOR3 & c_rv3Rotation, bool bSkipSphere)

 

VII. and now, you have to look for the folowing line:

	CreateEffectInstance(iInstanceIndex, dwID);

 

VIII. and replace that line with the following line:

	CreateEffectInstance(iInstanceIndex, dwID, bSkipSphere);

 

IV. and now, you have to look for the folowing line:

void CEffectManager::CreateEffectInstance(DWORD dwInstanceIndex, DWORD dwID)

 

X. and replace that line with the following line:

void CEffectManager::CreateEffectInstance(DWORD dwInstanceIndex, DWORD dwID, bool bSkipSphere)

 

XI. and now, you have to look for the folowing line:

	pEffectInstance->SetEffectDataPointer(pEffect);

 

XII. and replace that line with the following line:

	pEffectInstance->SetEffectDataPointer(pEffect, bSkipSphere);

 

Step III.

I. Open the "EffectLib/EffectInstance.h" and look for the following line:

		void SetEffectDataPointer(CEffectData * pEffectData);

 

II. and replace that line with the following line:

		void SetEffectDataPointer(CEffectData * pEffectData, bool bSkipSphere = false);

 

Step IV.

I. Open the "EffectLib/EffectInstance.cpp" and look for the following line:

void CEffectInstance::SetEffectDataPointer(CEffectData * pEffectData)

 

II. and replace that line with the following line:

void CEffectInstance::SetEffectDataPointer(CEffectData * pEffectData, bool bSkipSphere)

 

III. and now, you have to look for the folowing line:

	if (m_fBoundingSphereRadius > 0.0f)

 

IV. and replace that line with the following line:

	if (!bSkipSphere && m_fBoundingSphereRadius > 0.0f)

 

We are done now ! ?

 

You can use the effects without bounding, like the following (in your situation):

CEffectManager::Instance().RegisterEffect("d:/ymir work/effect/battleroyale/battley_01.mse", true);
CEffectManager::Instance().CreateEffect("d:/ymir work/effect/battleroyale/battley_01.mse", PixelPosition, v3Rotation, iSize, true);

 

HAVE A GOOD LUCK! ?

  • Metin2 Dev 2
  • Love 1
  • Love 1

All wolves are gray in the dark.

27 minutes ago, PetePeter said:

Thanks @UdvAtt108 your way not work but you give me a good hint to know where to check ! I will update the topic if I find out

I tested it, and it is working for me. But okay. ?

All wolves are gray in the dark.

1 hour ago, UdvAtt108 said:

I tested it, and it is working for me. But okay. ?

I'm sure it's work for you because as I see you used a clean base which is not my case so I guess something doing conflict

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • 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.