Jump to content

Set an effect always visible on the map (Any distance)


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
Link to comment
Share on other sites

  • 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

All wolves are gray in the dark.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



  • Similar Content

  • Activity

    1. 0

      Moving server from FreeBSD 11.2 to 13.2 - lib needed

    2. 0

      I just implemented some costumes and they are not visible

    3. 0

      Skill Tree Problem

    4. 97

      Ulthar SF V2 (TMP4 Base)

    5. 5

      Client Crashes through Offline Shop (Ikarus)

    6. 5

      VIVY-WORLD2 - FARM TO THE TOP

    7. 0

      ToolTip Bug?

    8. 0

      Skill tree build erorr

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • 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.