Jump to content
×
×
  • Create New...
  • 0

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


PetePeter

Question

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

5 answers to this question

Recommended Posts

  • 0

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.


  • Metin2 Dev Github
  • Activity

    1. 0

      max level exp

    2. 8

      Quest States Core Crash Item Dupe Bug Fix

    3. 23

      Umbra / Soft4Win / SNap! scammer exposed!

    4. 46

      Ship Defense (Hydra Dungeon)

    5. 10

      Rodnia Glory | A REAL SPEED SERVER | Start 02.09.2022

    6. 0

      Avery seeks an experienced team manager

    7. 0

      Wear (use) item only on specific map

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.