Page 1 of 1

Re: Item That Lets You See Humans

Posted: Fri Jan 02, 2009 1:22 am
by Geesu
I don't actually think this is entirely possible - it could throw an icon over their head... but I don't like this idea :P

Re: Item That Lets You See Humans

Posted: Fri Jan 02, 2009 3:22 am
by whosyourdaddy
no geesu it is possible and i have done the code if u would like i can paste it for u

Re: Item That Lets You See Humans

Posted: Tue Jan 06, 2009 4:07 pm
by Geesu
whosyourdaddy wrote:no geesu it is possible and i have done the code if u would like i can paste it for u
Feel free to post it for others - but I don't see this making it to an official release - unless Yami approves :P

Re: Item That Lets You See Humans

Posted: Tue Jan 06, 2009 8:51 pm
by YamiKaitou
maybe as a "unofficial" shopmenu3 item, but I don't think in the official release.

FYI, I have a hidden feature request on the tracker that I am using to gather up ideas for a shopmenu3, but I haven't gotten very far. If you would like to contribute ideas, PM me your bug tracker username and I will add you to the list who can see it.

Re: Item That Lets You See Humans

Posted: Wed Jan 07, 2009 1:13 am
by whosyourdaddy
for some reason theres a rare thing where 1 or 2 players in my server can see humans perfectly and this code wont effect them in looking into it and im guessing its something they have set in there config like cl_update or whatever

Code: Select all

register_forward(FM_AddToFullPack,"ForwardAddToFullPack",1);

public ForwardAddToFullPack(ES,e,Ent,Host,HostFlags,Player,pSet)
{
	if(!Player) 
		return FMRES_IGNORED;

	if(iGlow[Ent])
	{
		set_es(ES, ES_RenderMode, kRenderNormal); 
		set_es(ES, ES_RenderAmt, 25); 
		set_es(ES, ES_RenderColor, g_GlowLevel[Ent]); 
		set_es(ES, ES_RenderFx, kRenderFxGlowShell);
		return FMRES_SUPERCEDE;
	}
	else if(p_data_b[Ent][PB_INVIS] && ITEM_Has(Host,ITEM_GOGGLES) == ITEM_NONE)
	{
		set_es(ES,ES_Solid,SOLID_NOT)
		set_es(ES,ES_RenderMode,kRenderTransAlpha)
		set_es(ES,ES_RenderAmt,Invis_ME(Ent))
		return FMRES_SUPERCEDE;
	}

	return FMRES_IGNORED;
}

// This should be called on weapon change, on new round, when the user selects a new skill, and after an item is purchased
public SHARED_INVIS_Set( id )
{
	// Do not want to set them as invisible if the player is currently rendering
	if ( !p_data_b[id][PB_CAN_RENDER] || !p_data_b[id][PB_ISCONNECTED] )
	{
		return;
	}

	new iInvisLevel = 0;

	static iSkillLevel;
	iSkillLevel = SM_GetSkillLevel( id, SKILL_INVISIBILITY );

	// If they are Human Alliance with Invisibility lets set the level
	if ( iSkillLevel > 0 )
	{
		iInvisLevel = 1;
	}

	// User has a Cloak of Invisibility
	if ( ITEM_Has( id, ITEM_CLOAK ) > ITEM_NONE )
	{
		iInvisLevel = 1;
	}

	if ( iInvisLevel )
	{
		p_data_b[id][PB_INVIS] = true;
	}

	// User should not be invisible
	else
	{

		p_data_b[id][PB_INVIS] = false;
	}

	return;
}

Invis_ME(id)
{
	// Do not want to set them as invisible if the player is currently rendering
	if ( !p_data_b[id][PB_CAN_RENDER] || !p_data_b[id][PB_ISCONNECTED] )
	{
		return 255;
	}

	new iInvisLevel = 0;

	static iSkillLevel;
	iSkillLevel = SM_GetSkillLevel( id, SKILL_INVISIBILITY );

	// If they are Human Alliance with Invisibility lets set the level
	if ( iSkillLevel > 0 )
	{
		iInvisLevel = p_invisibility[iSkillLevel-1];
	}

	// User has a Cloak of Invisibility
	if ( ITEM_Has( id, ITEM_CLOAK ) > ITEM_NONE )
	{
		// Then we are already a little invis, lets give them a little bonus for purchasing the item
		if ( iInvisLevel > 0 )
		{
			iInvisLevel = floatround( float( iInvisLevel ) / INVIS_CLOAK_DIVISOR );
		}
		else
		{
			iInvisLevel = get_pcvar_num( CVAR_wc3_cloak );
		}
	}
	
	// If the player is holding a knife they should be more invisible
	if ( SHARED_IsHoldingKnife( id ) )
	{
		iInvisLevel /= 2;
	}

	if ( iInvisLevel )
	{
		return iInvisLevel;
	}

	// User should not be invisible
	else
	{

		return 255;
	}

	return 255;
}

SHARED_Glow( id, iRed, iGreen, iBlue, iAll )
{
	// Not allowed to glow right now...
	if ( !p_data_b[id][PB_CAN_RENDER] )
	{
		return;
	}
		
	// Don't glow if invisible
	else if ( SM_GetSkillLevel( id, SKILL_INVISIBILITY ) > 0 || ITEM_Has( id, ITEM_CLOAK ) > ITEM_NONE )
	{
		return;
	}

	// Only glow if the task doesn't exist!
	else if ( task_exists( TASK_GLOW + id ) )
	{
		return;
	}
	
	if ( iAll )
	{
		g_GlowLevel[id][0]	= 0;
		g_GlowLevel[id][1]	= 0;
		g_GlowLevel[id][2]	= 0;
		g_GlowLevel[id][3]	+= iAll;
	}
	else if ( iRed )
	{
		g_GlowLevel[id][0]	+= iRed;
		g_GlowLevel[id][1]	= 0;
		g_GlowLevel[id][2]	= 0;
		g_GlowLevel[id][3]	= 0;
	}
	else if ( iGreen )
	{
		g_GlowLevel[id][0]	= 0;
		g_GlowLevel[id][1]	+= iGreen;
		g_GlowLevel[id][2]	= 0;
		g_GlowLevel[id][3]	= 0;
	}
	else if ( iBlue )
	{
		g_GlowLevel[id][0]	= 0;
		g_GlowLevel[id][1]	= 0;
		g_GlowLevel[id][2]	+= iBlue;
		g_GlowLevel[id][3]	= 0;
	}

	// Lets make sure its not over the max!
	g_GlowLevel[id][0] = ( ( g_GlowLevel[id][0] > MAXGLOW ) ? MAXGLOW : g_GlowLevel[id][0] );
	g_GlowLevel[id][1] = ( ( g_GlowLevel[id][1] > MAXGLOW ) ? MAXGLOW : g_GlowLevel[id][1] );
	g_GlowLevel[id][2] = ( ( g_GlowLevel[id][2] > MAXGLOW ) ? MAXGLOW : g_GlowLevel[id][2] );
	g_GlowLevel[id][3] = ( ( g_GlowLevel[id][3] > MAXGLOW ) ? MAXGLOW : g_GlowLevel[id][3] );
	

	_SHARED_Glow( id );
}

public _SHARED_Glow( id )
{
	if ( id >= TASK_GLOW )
	{
		id -= TASK_GLOW;
	}

	// User is no longer connected, so lets not continue this!
	if ( !p_data_b[id][PB_ISCONNECTED] )
	{
		return;
	}
	// Don't glow if invisible
	else if ( SM_GetSkillLevel( id, SKILL_INVISIBILITY ) > 0 || ITEM_Has( id, ITEM_CLOAK ) > ITEM_NONE )
	{
		return;
	}
	
	new iRed	= g_GlowLevel[id][0];
	new iGreen	= g_GlowLevel[id][1];
	new iBlue	= g_GlowLevel[id][2];
	new iAll	= g_GlowLevel[id][3];

	// Then we want to glow
	if ( iRed || iGreen || iBlue )
	{
		iGlow[id] = true;
		g_GlowLevel[id][0] = ( ( iRed > 5 )		? iRed - 5		: 0 );
		g_GlowLevel[id][1] = ( ( iGreen > 5 )	? iGreen - 5	: 0 );
		g_GlowLevel[id][2] = ( ( iBlue > 5 )	? iBlue - 5		: 0 );
	}

	else if ( iAll )
	{
		iGlow[id] = true;
		g_GlowLevel[id][3] = ( ( iAll > 5 )		? iAll - 5		: 0 );
		
	}

	// No more glowing!
	else
	{
		iGlow[id] = false;

		return;
	}

	set_task( 0.2, "_SHARED_Glow", TASK_GLOW + id );

	return;
}

new iGlow[33] << in constants.inl