Raised This Month: $ Target: $400
 0% 

l4d2 common inf skin color help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
WhatsAnName
Member
Join Date: Jun 2018
Old 02-09-2022 , 01:35   l4d2 common inf skin color help
Reply With Quote #1

so im trying to edit this plugin https://forums.alliedmods.net/showpo...3&postcount=19 and having no success making the common infected skin/model color change like how a SI plugin could change their color on spawn i tried rendercolor renderfx and rendermode can't seem to figure it out
PHP Code:
#pragma semicolon 1
#pragma newdecls required
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

#define L4D2 Nightmarish Common
#define PLUGIN_VERSION "1.1"
#define DEBUG 1

ConVar cvarNightmareChance;

ConVar cvarType1Size;
ConVar cvarType1HP;
ConVar cvarType1Speed;
ConVar cvarType1Damage;
ConVar cvarType1Armor;

ConVar cvarType2Size;
ConVar cvarType2HP;
ConVar cvarType2Speed;
ConVar cvarType2Damage;
ConVar cvarType2Armor;

ConVar cvarType3Size;
ConVar cvarType3HP;
ConVar cvarType3Speed;
ConVar cvarType3Damage;
ConVar cvarType3Armor;

ConVar cvarType4Size;
ConVar cvarType4HP;
ConVar cvarType4Speed;
ConVar cvarType4Damage;
ConVar cvarType4Armor;

int CommonType[4097];
bool isMapRunning false;
Handle PluginStartTimer null;

public 
Plugin myinfo 
{
    
name "[L4D2] Nightmarish Common",
    
author "Mortiegama",
    
description "Empowering the lowest of the infected to make sure that hordes become your worst nightmare.",
    
version PLUGIN_VERSION,
    
url ""
}

    
//AtomicStryker - Damage Mod (SDK Hooks):
    //https://forums.alliedmods.net/showthread.php?p=1184761
    
    //Bacardi - Cleaning up code:
    //https://forums.alliedmods.net/showpost.php?p=2128853&postcount=4

public void OnPluginStart()
{
    
CreateConVar("l4d_ncm_version"PLUGIN_VERSION"Nightmarish Common Version"FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);

    
cvarNightmareChance CreateConVar("l4d_ncm_nightmarechance""90""Chance that the common infected will be turned into Nightmares. (Def 90)"0true0.0false_);

    
cvarType1SizeCreateConVar("l4d_ncm_type1size""0.7""Type 1: Size of common. (Def 0.7)"0true0.0false_);
    
cvarType1HPCreateConVar("l4d_ncm_type1hp""20""Type 1: HP for the Common. (Def 20)"0true0.0false_);
    
cvarType1SpeedCreateConVar("l4d_ncm_type1speed""1.5""Type 1: speed adjustment for the Common. (Def 1.5)"0true0.0false_);
    
cvarType1DamageCreateConVar("l4d_ncm_type1damage""1.5""Type 1: Multiplier for damage done to the Survivors (Def 1.5)"0true0.0false_);
    
cvarType1ArmorCreateConVar("l4d_ncm_type1armor""1.8""Type 1: Multiplier for damage done by the Survivors. (Def 1.2)"0true0.0false_);

    
cvarType2SizeCreateConVar("l4d_ncm_type2size""0.9""Type 2: Size of zombie. (Def 0.9)"0true0.0false_);
    
cvarType2HPCreateConVar("l4d_ncm_type2hp""65""Type 2: HP for the Common. (Def 65)"0true0.0false_);
    
cvarType2SpeedCreateConVar("l4d_ncm_type2speed""1.2""Type 2: speed adjustment for the Common. (Def 1.2)"0true0.0false_);
    
cvarType2DamageCreateConVar("l4d_ncm_type2damage""0.8""Type 2: Multiplier for damage done to the Survivors (Def 0.8)"0true0.0false_);
    
cvarType2ArmorCreateConVar("l4d_ncm_type2armor""0.7""Type 2: Multiplier for damage done by the Survivors. (Def 0.7)"0true0.0false_);

    
cvarType3SizeCreateConVar("l4d_ncm_type3size""1.1""Type 3: Size of zombie. (Def 1.1)"0true0.0false_);    
    
cvarType3HPCreateConVar("l4d_ncm_type3hp""30""Type 3: HP for the Common. (Def 30)"0true0.0false_);
    
cvarType3SpeedCreateConVar("l4d_ncm_type3speed""1.1""Type 3: speed adjustment for the Common. (Def 1.1)"0true0.0false_);
    
cvarType3DamageCreateConVar("l4d_ncm_type3damage""1.3""Type 3: Multiplier for damage done to the Survivors (Def 1.3)"0true0.0false_);
    
cvarType3ArmorCreateConVar("l4d_ncm_type3armor""1.1""Type 3: Multiplier for damage done by the Survivors. (Def 1.1)"0true0.0false_);

    
cvarType4SizeCreateConVar("l4d_ncm_type4size""1.2""Type 4: Size of zombie. (Def 1.2)"0true0.0false_);    
    
cvarType4HPCreateConVar("l4d_ncm_type4hp""80""Type 4: HP for the Common. (Def 80)"0true0.0false_);
    
cvarType4SpeedCreateConVar("l4d_ncm_type4speed""0.4""Type 4: speed adjustment for the Common. (Def 0.4)"0true0.0false_);
    
cvarType4DamageCreateConVar("l4d_ncm_type4damage""0.6""Type 4: Multiplier for damage done to the Survivors (Def 0.6)"0true0.0false_);
    
cvarType4ArmorCreateConVar("l4d_ncm_type4armor""0.5""Type 4: Multiplier for damage done by the Survivors. (Def 0.5)"0true0.0false_);

    
AutoExecConfig(true"L4D2_Nightmarish_Common");
    
PluginStartTimer CreateTimer(3.0OnPluginStart_Delayed);
}

public 
Action OnPluginStart_Delayed(Handle timer)
{
    if(
PluginStartTimer != null)
    {
         
KillTimer(PluginStartTimer);
        
PluginStartTimer null;
    }
    return 
Plugin_Stop;
}

public 
void OnMapStart()
{
    
isMapRunning true;
}

public 
void OnClientPostAdminCheck(int client)
{
    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage_Survivor);
}

public 
void OnEntityCreated(int entity, const char[] classname)
{
    if (!
isMapRunning || IsServerProcessing() == false) return;

    if (
StrEqual(classname"infected"false))
    { 
CreateTimer(0.5Timer_CommonSpawnEntIndexToEntRef(entity), TIMER_FLAG_NO_MAPCHANGE); }
}

public 
Action Timer_CommonSpawn(Handle timerany ref)
{
    
int entity EntRefToEntIndex(ref);
    if(
entity == INVALID_ENT_REFERENCE || !IsValidEntity(entity) || !IsValidEdict(entity))
    { return 
Plugin_Stop; }

    
int NightmareChance GetRandomInt(099);
    
int NightmarePercent = (GetConVarInt(cvarNightmareChance));

    if (
NightmareChance NightmarePercent)
    {
        
int integer GetRandomInt(14); 

        
#if DEBUG
        
PrintToChatAll("Entity is a common infected, type %i."integer);
        
#endif

        
int iHP;
        
float iSpeed;
        
float iScale;
        
int iCP;
        
int c1;
        
int c2;
        
int c3;

        switch (integer)
        {
            case 
1:
            {
                
#if DEBUG
                
PrintToChatAll("Zombie type small strong fast low.");
                
#endif

                
iHP GetConVarInt(cvarType1HP);
                
iSpeed GetConVarFloat(cvarType1Speed);
                
iScale GetConVarFloat(cvarType1Size);
                
iCP = (02000225);
                
CommonType[entity] = 1;
            }
            case 
2:
            {
                
#if DEBUG
                
PrintToChatAll("Zombie type small weak quick sturdy.");
                
#endif

                
iHP GetConVarInt(cvarType2HP);
                
iSpeed GetConVarFloat(cvarType2Speed);
                
iScale GetConVarFloat(cvarType2Size);
                
iCP = (02000225);
                
CommonType[entity] = 2;
            }
            case 
3:
            {
                
#if DEBUG
                
PrintToChatAll("Zombie type big tough quick weak.");
                
#endif

                
iHP GetConVarInt(cvarType3HP);
                
iSpeed GetConVarFloat(cvarType3Speed);
                
iScale GetConVarFloat(cvarType3Size);
                
iCP = (20000225);
                
CommonType[entity] = 3;
            }
            case 
4:
            {
                
#if DEBUG
                
PrintToChatAll("Zombie type large titanic slow titanic.");
                
#endif

                
iHP GetConVarInt(cvarType4HP);
                
iSpeed GetConVarFloat(cvarType4Speed);
                
iScale GetConVarFloat(cvarType4Size);
                
iCP = (20000225);
                
CommonType[entity] = 4;
            }
        }

        
SDKHook(entitySDKHook_OnTakeDamageOnTakeDamage_Infected);
        
SetEntPropFloat(entityProp_Send"m_flModelScale"iScale);
        
SetEntProp(entityProp_Data"m_iMaxHealth"iHP); 
        
SetEntProp(entityProp_Data"m_iHealth"iHP);
        
AcceptEntityInput(entity"Disable");
        
SetEntPropFloat(entityProp_Send"m_flSpeed"1.0*iSpeed);
        
AcceptEntityInput(entity"Enable");
        
SetEntProp(entityProp_Send"m_iGlowType");
        
SetEntProp(entityProp_Send"m_nGlowRange"1000 );
        
SetEntProp(entityProp_Send"m_nGlowRangeMin");
        
SetEntProp(entityProp_Send"m_glowColorOverride"200 + (256) + ( 65536));
        
c1 GetRandomInt(0255);
        
c2 GetRandomInt(0255);
        
c3 GetRandomInt(0255);
        
SetEntityRenderMode(entityRenderMode:2);
        
SetEntityRenderFx(entityRENDERFX_HOLOGRAM);
        
SetEntityRenderColor(entityc1c2c3255);
    }

    return 
Plugin_Continue;
}

public 
Action OnTakeDamage_Infected(int victimint &attackerint &inflictorfloat &damageint &damagetype)
{
    if (!
isMapRunning || IsServerProcessing() == false) return Plugin_Stop;

    if (
IsValidCommon(victim))
    {
        switch (
CommonType[victim])
        {
            case 
1:
            {
                
float damagemod GetConVarFloat(cvarType1Armor);

                
#if DEBUG
                
PrintToChatAll("Damage Caught: %f damage times %f mod."damagedamagemod);
                
#endif

                
if (FloatCompare(damagemod1.0) != 0) { damage damage damagemod; }
            }
            case 
2:
            {
                
float damagemod GetConVarFloat(cvarType2Armor);

                
#if DEBUG
                
PrintToChatAll("Damage Caught: %f damage times %f mod."damagedamagemod);
                
#endif

                
if (FloatCompare(damagemod1.0) != 0) { damage damage damagemod; }
            }
            case 
3:
            {
                
float damagemod GetConVarFloat(cvarType3Armor);

                
#if DEBUG
                
PrintToChatAll("Damage Caught: %f damage times %f mod."damagedamagemod);
                
#endif

                
if (FloatCompare(damagemod1.0) != 0) { damage damage damagemod; }
            }
            case 
4:
            {
                
float damagemod GetConVarFloat(cvarType4Armor);

                
#if DEBUG
                
PrintToChatAll("Damage Caught: %f damage times %f mod."damagedamagemod);
                
#endif

                
if (FloatCompare(damagemod1.0) != 0) { damage damage damagemod; }
            }
        }
    }

    return 
Plugin_Changed;
}

public 
Action OnTakeDamage_Survivor(int victimint &attackerint &inflictorfloat &damageint &damagetype)
{
    if (!
isMapRunning || IsServerProcessing() == false) return Plugin_Stop;

    if (
IsValidCommon(attacker))
    {
        if (
IsValidClient(victim) && GetClientTeam(victim) == 2)
        {
            switch (
CommonType[attacker])
            {
                case 
1:
                {
                    
float damagemod GetConVarFloat(cvarType1Damage);

                    
#if DEBUG
                    
PrintToChatAll("Survivor damage Caught: %f damage times %f mod."damagedamagemod);
                    
#endif

                    
if (FloatCompare(damagemod1.0) != 0) { damage damage damagemod; }
                }
                case 
2:
                {
                    
float damagemod GetConVarFloat(cvarType2Damage);

                    
#if DEBUG
                    
PrintToChatAll("Survivor damage Caught: %f damage times %f mod."damagedamagemod);
                    
#endif

                    
if (FloatCompare(damagemod1.0) != 0) { damage damage damagemod; }
                }
                case 
3:
                {
                    
float damagemod GetConVarFloat(cvarType3Damage);

                    
#if DEBUG
                    
PrintToChatAll("Survivor damage Caught: %f damage times %f mod."damagedamagemod);
                    
#endif

                    
if (FloatCompare(damagemod1.0) != 0) { damage damage damagemod; }
                }
                case 
4:
                {
                    
float damagemod GetConVarFloat(cvarType4Damage);

                    
#if DEBUG
                    
PrintToChatAll("Survivor damage Caught: %f damage times %f mod."damagedamagemod);
                    
#endif

                    
if (FloatCompare(damagemod1.0) != 0) { damage damage damagemod; }
                }
            }
        }
    }

    return 
Plugin_Changed;
}

public 
void OnMapEnd()
{
    
isMapRunning false;
}

int IsValidCommon(int common)
{
    if(
common MaxClients && IsValidEdict(common) && IsValidEntity(common))
    {
        
char classname[32];
        
GetEdictClassname(commonclassnamesizeof(classname));
        if(
StrEqual(classname"infected")) { return true; }
    }
    return 
false;
}

public 
int IsValidClient(int client)
{
    if (
client <= 0) return false;
    if (
client MaxClients) return false;
    if (!
IsClientInGame(client)) return false;
    if (!
IsPlayerAlive(client)) return false;
    return 
true;

WhatsAnName is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 02-09-2022 , 05:26   Re: l4d2 common inf skin color help
Reply With Quote #2

You can't change the common infected color on L4D2, their material file (.vmt) doesn't support color changes unlike L4D1.

Is up to Valve/TLS team to add support to that.
__________________
Marttt is offline
WhatsAnName
Member
Join Date: Jun 2018
Old 02-09-2022 , 10:39   Re: l4d2 common inf skin color help
Reply With Quote #3

well thats sucks thank you anyways
WhatsAnName is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:45.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode