Jump to content

Different and filtered effect on drop item


Recommended Posts

Hi all.

I would like to share this little modification with this community.

This idea came from a queastion what i saw today, u can see and read about it at dropitem effect.

By this modification u can attach filtered effect to drop item on the ground.

U can easy filter an item by item's vnum, item type and subtype then give different effect to the items. With this method for example you can seperate items by rarity, but the border is the starry sky.

 

Let's see:

Step I.

 I. Open the "UserInterface/PythonItem.h" and look for the following line:

		typedef struct SGroundItemInstance

 

 II.  and before that line add the following lines:

		enum EDropItemEffects
		{
			DROP_ITEM_EFFECT_NORMAL,
			DROP_ITEM_EFFECT_RARE,
			DROP_ITEM_EFFECT_EPIC,
			DROP_ITEM_EFFECT_LEGENARY,
			DROP_ITEM_EFFECT_NUM,
		};

 

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

		DWORD	__Pick(const POINT& c_rkPtMouse);

 

 IV. and before that line add the following lines:

		void	__RegisterEffect(int iIndex, const char* szFile);
		int		__AttachEffect(DWORD dwVnum, BYTE byType, BYTE bySubType);

 

 V. last one in this step, look for the following line:

		DWORD m_dwDropItemEffectID;

 

 VI. and replace that line with the following line:

		DWORD m_dwDropItemEffectID[DROP_ITEM_EFFECT_NUM];

 

Step II.

 I. Open the "UserInterface/PythonItem.cpp" and look for the following lines:

		// attaching effect
		CEffectManager & rem =CEffectManager::Instance();
		pGroundItemInstance->dwEffectInstanceIndex = 
		rem.CreateEffect(m_dwDropItemEffectID, D3DXVECTOR3(x, -y, z), D3DXVECTOR3(0,0,0));

 

 II. and replace those lines with the following lines:

		// attaching effect
		DWORD dwEffectIndex = __AttachEffect(dwVirtualNumber, pItemData->GetType(), pItemData->GetSubType());
		if(dwEffectIndex < DROP_ITEM_EFFECT_NUM && dwEffectIndex >= 0)
		{
			dwEffectIndex = m_dwDropItemEffectID[dwEffectIndex];
			if(dwEffectIndex != 0)
			{
				CEffectManager & rem =CEffectManager::Instance();
				pGroundItemInstance->dwEffectInstanceIndex = 
				rem.CreateEffect(dwEffectIndex, D3DXVECTOR3(x, -y, z), D3DXVECTOR3(0,0,0));		
			}
		}

 

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

void CPythonItem::Create()

 

 IV. and replace that whole function with the following:

void CPythonItem::Create()
{
	//Default
	__RegisterEffect(DROP_ITEM_EFFECT_NORMAL, "d:/ymir work/effect/etc/dropitem/dropitem.mse");
	
	//Rare
	__RegisterEffect(DROP_ITEM_EFFECT_RARE, "d:/ymir work/effect/etc/dropitem/dropitem_rare.mse");
	
	//Epic
	__RegisterEffect(DROP_ITEM_EFFECT_EPIC, "d:/ymir work/effect/etc/dropitem/dropitem_epic.mse");
	
	//Epic
	__RegisterEffect(DROP_ITEM_EFFECT_LEGENARY, "d:/ymir work/effect/etc/dropitem/dropitem_legendary.mse");
}

 

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

	m_dwPickedItemID = INVALID_ID;

 

 VI. and after that line add the following lines:

	memset(m_dwDropItemEffectID, 0, sizeof(m_dwDropItemEffectID));

 

 VII. last one in this step, look for the following lines:

CPythonItem::~CPythonItem()
{
	assert(m_GroundItemInstanceMap.empty());
}

 

 VIII. and after that lines add the following lines:

void CPythonItem::__RegisterEffect(int iIndex, const char* szFile)
{
	if(iIndex >= DROP_ITEM_EFFECT_NUM || iIndex < 0)
	{
		TraceError("CPythonItem::__RegisterEffect - Invalid index: %d - %s", iIndex, szFile);
		return;
	}
	
	CEffectManager::Instance().RegisterEffect2(szFile, &m_dwDropItemEffectID[iIndex]);
}

int CPythonItem::__AttachEffect(DWORD dwVnum, BYTE byType, BYTE bySubType)
{
	//Examples:
	
	//Determine the effect by item VNUM
	switch(dwVnum)
	{
		//Rare - These are the rare item vnums
		case 101:
		case 2001:
			return DROP_ITEM_EFFECT_RARE;
			
		//Epic - These are the epic item vnums
		case 3025:
		case 3229:
			return DROP_ITEM_EFFECT_EPIC;
	}
	
	//Determine the effect by item type/subtype
	switch(byType)
	{
		//Epic - This is the epic item type
		case CItemData::ITEM_TYPE_ARMOR:
			return DROP_ITEM_EFFECT_EPIC;

		//Filter by the material item type
		case CItemData::ITEM_TYPE_MATERIAL:
		{
			switch(bySubType)
			{
				//Epic - This is the epic item subtype
				case CItemData::MATERIAL_LEATHER:
					return DROP_ITEM_EFFECT_EPIC;
					
				//Legendary - This is the legendary item subtype
				case CItemData::MATERIAL_JEWEL:
					return DROP_ITEM_EFFECT_LEGENARY;
			}
			
			//Rare - All other ITEM_TYPE_MATERIAL type items
			return DROP_ITEM_EFFECT_RARE; //Default
		}
	}
	
	return DROP_ITEM_EFFECT_NORMAL; //Default
}

 

We are done now ! 🙂

Important: In the "int CPythonItem::__AttachEffect" function you can see some example, that is not the final code, you have to config it like you want it to work! And you have to create those effect files what you register in the "void CPythonItem::Create()" function!

You can add more effect separation by extending the "Step I. - II. - EDropItemEffects" enum.

 

 

Preview:

spacer.png

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 22
  • Scream 1
  • Good 9
  • Love 2
  • Love 13

All wolves are gray in the dark.

Link to comment
Share on other sites

  • 10 months later...

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.