Jump to content

Enable specular on NPCs and Monsters


Recommended Posts

Through this piece of code you will be able to attach the specular on NPCs and Monsters.

 

// 1. Search:
bool CInstanceBase::Create(const SCreateData& c_rkCreateData)
{
	[...]
	return true;
}

// 2. Add this piece of code above the return true;

struct SAttachSpecularData
{
	DWORD race;
	float specularPower;
};

const int SPECULAR_MAX_NUM = 5;
static SAttachSpecularData structInfo[SPECULAR_MAX_NUM] =
{
	{ 101,	0.09f },
	{ 102,	0.06f },
	{ 9001,	0.04f },
	{ 9002,	0.01f },
	{ 9005,	0.09f },
//	{ npc_vnum,	specular }, Warning: When you add new NPCs / Monsters inside the structure, you must increase the SPECULAR_MAX_NUM
};

for (DWORD i = 0; i < SPECULAR_MAX_NUM; i++)
{
	if (GetRace() == structInfo[i].race)
	{
		SMaterialData data;
		data.pImage = NULL;
		data.isSpecularEnable = TRUE;
		data.fSpecularPower = structInfo[i].specularPower;
		data.bSphereMapIndex = 1;
		m_GraphicThingInstance.SetMaterialData(0, NULL, data);
	}
}

 

Credit: @VegaS™

Edited by Await (see edit history)
Link to post
  • Moderator

 

54 minutes ago, Await said:

struct SAttachSpecularData
{
	DWORD race;
	float specularPower;
};

const int SPECULAR_MAX_NUM = 5;
static SAttachSpecularData structInfo[SPECULAR_MAX_NUM] =
{
	{ 101,	0.09f },
	{ 102,	0.06f },
	{ 9001,	0.04f },
	{ 9002,	0.01f },
	{ 9005,	0.09f },
//	{ npc_vnum,	specular }, Warning: When you add new NPCs / Monsters inside the structure, you must increase the SPECULAR_MAX_NUM
};

for (DWORD i = 0; i < SPECULAR_MAX_NUM; i++)
{
	if (GetRace() == structInfo[i].race)
	{
		SMaterialData data;
		data.pImage = NULL;
		data.isSpecularEnable = TRUE;
		data.fSpecularPower = structInfo[i].specularPower;
		data.bSphereMapIndex = 1;
		m_GraphicThingInstance.SetMaterialData(0, NULL, data);
	}
}

 


Thanks for my release from 2016, soon 5 years since it has been done.
Shame on you... making copy-paste and uploading the code on GitHub, won't make you a "programmer".


spacer.png

 

  • Lmao 10
Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   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.



  • Activity

    1. 1

      [Problem] : System war between kingdoom

    2. 4

      DDos attacks

    3. 4

      DDos attacks

    4. 62

      Shop Ex Renewal

    5. 1

      [Problem] : System war between kingdoom

    6. 4

      DDos attacks

    7. 7

      Dynamic Weather

    8. 7

      How to avoid getting flooded in 2021

  • 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.