Re: Item That Lets You See Humans
Posted: Fri Jan 02, 2009 1:22 am
I don't actually think this is entirely possible - it could throw an icon over their head... but I don't like this idea 

Home to war3, war3ft, war3x and uwc3
https://www.wc3mods.net/forums/
Feel free to post it for others - but I don't see this making it to an official release - unless Yami approveswhosyourdaddy wrote:no geesu it is possible and i have done the code if u would like i can paste it for u
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