Post by Abhinash ( Bboy NeO ) on Mar 18, 2016 12:25:43 GMT
Hello Guys .
Everybody here played Zombie Plague 6.2!
And everybody liked the mod also.
I asked to Bakir and Chihuahuax many times How to add He Grenade like in ZP 6.2 ....
But none of them helped me.
I learned myself.
So, Today I decide to share the instruction how to do that.
Lets Go------
First add include Engine like this --
Then add these Defines ---
Then fine this part --
And replace it with --
After that find this part --
Replace it with --
After that find this part--
Replace it with--
After that find this part--
And replace it with--
After that find this part--
After that find this part and delete it --
Then find these variables and delete them too --
Then find this part--
Replace it with --
Finally we are fully done!
Now, just compile and Enjoy your Game!
Dont forget to say me thanks and give me Karma it this Tutorial really helped you!
Have a nice day!
Everybody here played Zombie Plague 6.2!
And everybody liked the mod also.
I asked to Bakir and Chihuahuax many times How to add He Grenade like in ZP 6.2 ....
But none of them helped me.
I learned myself.
So, Today I decide to share the instruction how to do that.
Lets Go------
First add include Engine like this --
#include <engine>
Then add these Defines ---
#define Abhinash(%1,%2) entity_range(%1,%2)
#define HE_MODEL_EXPLODE "sprites/zerogxplode.spr"
#define HE_SOUND_EXPLODE "fvox/flatline.wav"
Then fine this part --
new g_trailSpr, g_exploSpr, g_flameSpr, g_smokeSpr, g_glassSpr // grenade sprites
And replace it with --
new g_trailSpr, g_exploSpr, g_flameSpr, g_smokeSpr, g_glassSpr, g_hExplode // grenade sprites
After that find this part --
const PEV_NADE_TYPE = pev_flTimeStepSound
const NADE_TYPE_INFECTION = 1111
const NADE_TYPE_NAPALM = 2222
const NADE_TYPE_FROST = 3333
const NADE_TYPE_FLARE = 4444
const PEV_FLARE_COLOR = pev_punchangle
const PEV_FLARE_DURATION = pev_flSwimTime
Replace it with --
const PEV_NADE_TYPE = pev_flTimeStepSound
const NADE_TYPE_INFECTION = 1111
const NADE_TYPE_EXPLODE = 2222
const NADE_TYPE_FROST = 3333
const NADE_TYPE_NAPALM = 4444
const PEV_FLARE_COLOR = pev_punchangle
const PEV_FLARE_DURATION = pev_flSwimTime
After that find this part--
// Check if it's one of our custom nades
switch (pev(entity, PEV_NADE_TYPE))
{
case NADE_TYPE_INFECTION: // Infection Bomb
{
infection_explode(entity)
return HAM_SUPERCEDE;
}
case NADE_TYPE_NAPALM: // Napalm Grenade
{
fire_explode(entity)
return HAM_SUPERCEDE;
}
case NADE_TYPE_FROST: // Frost Grenade
{
frost_explode(entity)
return HAM_SUPERCEDE;
}
case NADE_TYPE_FLARE: // Flare
{
// Get its duration
static duration
duration = pev(entity, PEV_FLARE_DURATION)
// Already went off, do lighting loop for the duration of PEV_FLARE_DURATION
if (duration > 0)
{
// Check whether this is the last loop
if (duration == 1)
{
// Get rid of the flare entity
engfunc(EngFunc_RemoveEntity, entity)
return HAM_SUPERCEDE;
}
// Light it up!
flare_lighting(entity, duration)
// Set time for next loop
set_pev(entity, PEV_FLARE_DURATION, --duration)
set_pev(entity, pev_dmgtime, current_time + 5.0)
}
// Light up when it's stopped on ground
else if ((pev(entity, pev_flags) & FL_ONGROUND) && fm_get_speed(entity) < 10)
{
// Flare sound
static sound[64]
ArrayGetString(grenade_flare, random_num(0, ArraySize(grenade_flare) - 1), sound, charsmax(sound))
emit_sound(entity, CHAN_WEAPON, sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
// Set duration and start lightning loop on next think
set_pev(entity, PEV_FLARE_DURATION, 1 + get_pcvar_num(cvar_flareduration)/5)
set_pev(entity, pev_dmgtime, current_time + 0.1)
}
else
{
// Delay explosion until we hit ground
set_pev(entity, pev_dmgtime, current_time + 0.5)
}
}
}
Replace it with--
// Check if it's one of our custom nades
switch (pev(entity, PEV_NADE_TYPE))
{
case NADE_TYPE_INFECTION: // Infection Bomb
{
infection_explode(entity)
return HAM_SUPERCEDE;
}
case NADE_TYPE_EXPLODE: // HE Grenade
{
he_explode(entity)
return HAM_SUPERCEDE;
}
case NADE_TYPE_NAPALM: // Napalm Grenade
{
fire_explode(entity)
return HAM_SUPERCEDE;
}
case NADE_TYPE_FROST: // Frost Grenade
{
frost_explode(entity)
return HAM_SUPERCEDE;
}
}
After that find this part--
// Fire Grenade Explosion
fire_explode(ent)
{
// Get origin
static Float:originF[3]
pev(ent, pev_origin, originF)
// Make the explosion
create_blast2(originF)
// Fire nade explode sound
static sound[64]
ArrayGetString(grenade_fire, random_num(0, ArraySize(grenade_fire) - 1), sound, charsmax(sound))
emit_sound(ent, CHAN_WEAPON, sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
// Collisions
static victim
victim = -1
while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, NADE_EXPLOSION_RADIUS)) != 0)
{
// Only effect alive zombies
if (!is_user_valid_alive(victim) || !g_zombie[victim] || g_nodamage[victim])
continue;
// Heat icon?
if (get_pcvar_num(cvar_hudicons))
{
message_begin(MSG_ONE_UNRELIABLE, g_msgDamage, _, victim)
write_byte(0) // damage save
write_byte(0) // damage take
write_long(DMG_BURN) // damage type
write_coord(0) // x
write_coord(0) // y
write_coord(0) // z
message_end()
}
if (g_nemesis[victim] || g_assassin[victim]) // fire duration (nemesis/assassin is fire resistant)
g_burning_duration[victim] += get_pcvar_num(cvar_fireduration)
else
g_burning_duration[victim] += get_pcvar_num(cvar_fireduration) * 5
// Set burning task on victim if not present
if (!task_exists(victim+TASK_BURN))
set_task(0.2, "burning_flame", victim+TASK_BURN, _, _, "b")
}
// Get rid of the grenade
engfunc(EngFunc_RemoveEntity, ent)
}
And replace it with--
// Fire Grenade Explosion
fire_explode(ent)
{
// Get origin
static Float:originF[3]
pev(ent, pev_origin, originF)
// Make the explosion
create_blast2(originF)
// Fire nade explode sound
static sound[64]
ArrayGetString(grenade_fire, random_num(0, ArraySize(grenade_fire) - 1), sound, charsmax(sound))
emit_sound(ent, CHAN_WEAPON, sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
// Collisions
static victim
victim = -1
while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, NADE_EXPLOSION_RADIUS)) != 0)
{
// Only effect alive zombies
if (!is_user_valid_alive(victim) || !g_zombie[victim] || g_nodamage[victim])
continue;
// Heat icon?
if (get_pcvar_num(cvar_hudicons))
{
message_begin(MSG_ONE_UNRELIABLE, g_msgDamage, _, victim)
write_byte(0) // damage save
write_byte(0) // damage take
write_long(DMG_BURN) // damage type
write_coord(0) // x
write_coord(0) // y
write_coord(0) // z
message_end()
}
if (g_nemesis[victim] || g_assassin[victim]) // fire duration (nemesis/assassin is fire resistant)
g_burning_duration[victim] += get_pcvar_num(cvar_fireduration)
else
g_burning_duration[victim] += get_pcvar_num(cvar_fireduration) * 5
// Set burning task on victim if not present
if (!task_exists(victim+TASK_BURN))
set_task(0.2, "burning_flame", victim+TASK_BURN, _, _, "b")
}
// Get rid of the grenade
engfunc(EngFunc_RemoveEntity, ent)
}
// HE Grenade Explosion
he_explode(ent)
{
static Float: originF[ 3 ]
pev( ent, pev_origin, originF );
message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
write_byte( TE_EXPLOSION );
engfunc( EngFunc_WriteCoord, originF[ 0 ] );
engfunc( EngFunc_WriteCoord, originF[ 1 ] );
engfunc( EngFunc_WriteCoord, originF[ 2 ] );
write_short( g_hExplode );
write_byte( 30 ); //marime
write_byte( 15 ); //viteza
write_byte( 0 );
message_end( );
static attacker
attacker = pev(ent, pev_owner)
for( new victim = 1; victim < 33; victim++ )
{
if( !is_user_connected( victim ) || !is_user_alive( victim ) ) continue;
if( g_zombie[victim] )
{
static Float: fDistance, Float: fDamage;
fDistance = Abhinash( victim, ent );
if( fDistance < 300.0 )
{
fDamage = 667.0 - fDistance;
message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "ScreenFade" ), _, victim );
write_short( 2048 );
write_short( 1024 );
write_short( FFADE_IN );
write_byte( 220 );
write_byte( 0 );
write_byte( 0 );
write_byte( fDistance < 220 ? 220 : 205 );
message_end( );
message_begin( MSG_ONE_UNRELIABLE, g_msgScreenShake, _, victim );
write_short( 4096 * 100 ); // amplitude
write_short( 4096 * 500 ); // duration
write_short( 4096 * 200 ); // frequency
message_end( );
if( float( get_user_health( victim ) ) - fDamage > 0.0 )
{
ExecuteHamB( Ham_TakeDamage, victim, ent, attacker, fDamage, DMG_BLAST );
}
else
{
ExecuteHamB( Ham_Killed, victim, attacker, 4 );
}
if( !g_nemesis[victim] && !g_assassin[victim] )
fDamage *= 0.75;
static name[32]; get_user_name(victim, name, charsmax(name))
zp_colored_print(attacker, "^4[ZP]^1 Damage to^4 %s^1 ::^4 %0.0f^1 damage", name, fDamage)
if (fDamage >= get_pcvar_num(cvar_ammodamage))
g_ammopacks[attacker] += 2
else
g_ammopacks[attacker] += 1
}
}
}
engfunc(EngFunc_RemoveEntity, ent)
}
After that find this part--
// Forward Set Model
public fw_SetModel(entity, const model[])
{
// We don't care
if (strlen(model) < 8)
return;
// Remove weapons?
if (get_pcvar_float(cvar_removedropped) > 0.0)
{
// Get entity's classname
static classname[10]
pev(entity, pev_classname, classname, charsmax(classname))
// Check if it's a weapon box
if (equal(classname, "weaponbox"))
{
// They get automatically removed when thinking
set_pev(entity, pev_nextthink, get_gametime() + get_pcvar_float(cvar_removedropped))
return;
}
}
// Narrow down our matches a bit
if (model[7] != 'w' || model[8] != '_')
return;
// Get damage time of grenade
static Float:dmgtime
pev(entity, pev_dmgtime, dmgtime)
// Grenade not yet thrown
if (dmgtime == 0.0)
return;
// Get whether grenade's owner is a zombie
if (g_zombie[pev(entity, pev_owner)])
{
if (model[9] == 'h' && model[10] == 'e' && get_pcvar_num(cvar_extrainfbomb)) // Infection Bomb
{
// Give it a glow
fm_set_rendering(entity, kRenderFxGlowShell, 0, 250, 0, kRenderNormal, 16);
// And a colored trail
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_BEAMFOLLOW) // TE id
write_short(entity) // entity
write_short(g_trailSpr) // sprite
write_byte(10) // life
write_byte(10) // width
write_byte(0) // r
write_byte(250) // g
write_byte(0) // b
write_byte(200) // brightness
message_end()
// Set grenade type on the thrown grenade entity
set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_INFECTION)
}
}
else if (model[9] == 'h' && model[10] == 'e' && get_pcvar_num(cvar_firegrenades)) // Napalm Grenade
{
// Give it a glow
fm_set_rendering(entity, kRenderFxGlowShell, 200, 0, 0, kRenderNormal, 16);
// And a colored trail
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_BEAMFOLLOW) // TE id
write_short(entity) // entity
write_short(g_trailSpr) // sprite
write_byte(10) // life
write_byte(10) // width
write_byte(200) // r
write_byte(0) // g
write_byte(0) // b
write_byte(200) // brightness
message_end()
// Set grenade type on the thrown grenade entity
set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_NAPALM)
}
else if (model[9] == 'f' && model[10] == 'l' && get_pcvar_num(cvar_frostgrenades)) // Frost Grenade
{
// Give it a glow
fm_set_rendering(entity, kRenderFxGlowShell, 0, 100, 200, kRenderNormal, 16);
// And a colored trail
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_BEAMFOLLOW) // TE id
write_short(entity) // entity
write_short(g_trailSpr) // sprite
write_byte(10) // life
write_byte(10) // width
write_byte(0) // r
write_byte(100) // g
write_byte(200) // b
write_byte(200) // brightness
message_end()
// Set grenade type on the thrown grenade entity
set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_FROST)
}
else if (model[9] == 's' && model[10] == 'm' && get_pcvar_num(cvar_flaregrenades)) // Flare
{
// Build flare's color
static rgb[3]
switch (get_pcvar_num(cvar_flarecolor))
{
case 0: // white
{
rgb[0] = 255 // r
rgb[1] = 255 // g
rgb[2] = 255 // b
}
case 1: // red
{
rgb[0] = random_num(50,255) // r
rgb[1] = 0 // g
rgb[2] = 0 // b
}
case 2: // green
{
rgb[0] = 0 // r
rgb[1] = random_num(50,255) // g
rgb[2] = 0 // b
}
case 3: // blue
{
rgb[0] = 0 // r
rgb[1] = 0 // g
rgb[2] = random_num(50,255) // b
}
case 4: // random (all colors)
{
rgb[0] = random_num(50,200) // r
rgb[1] = random_num(50,200) // g
rgb[2] = random_num(50,200) // b
}
case 5: // random (r,g,b)
{
switch (random_num(1, 6))
{
case 1: // red
{
rgb[0] = 250 // r
rgb[1] = 0 // g
rgb[2] = 0 // b
}
case 2: // green
{
rgb[0] = 0 // r
rgb[1] = 250 // g
rgb[2] = 0 // b
}
case 3: // blue
{
rgb[0] = 0 // r
rgb[1] = 0 // g
rgb[2] = 250 // b
}
case 4: // cyan
{
rgb[0] = 0 // r
rgb[1] = 250 // g
rgb[2] = 250 // b
}
case 5: // pink
{
rgb[0] = 250 // r
rgb[1] = 0 // g
rgb[2] = 250 // b
}
case 6: // yellow
{
rgb[0] = 250 // r
rgb[1] = 250 // g
rgb[2] = 0 // b
}
}
}
}
// Give it a glow
fm_set_rendering(entity, kRenderFxGlowShell, rgb[0], rgb[1], rgb[2], kRenderNormal, 16);
// And a colored trail
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_BEAMFOLLOW) // TE id
write_short(entity) // entity
write_short(g_trailSpr) // sprite
write_byte(10) // life
write_byte(10) // width
write_byte(rgb[0]) // r
write_byte(rgb[1]) // g
write_byte(rgb[2]) // b
write_byte(200) // brightness
message_end()
// Set grenade type on the thrown grenade entity
set_pev(entity, PEV_NADE_TYPE, NADE_TYPE_FLARE)
// Set flare color on the thrown grenade entity
set_pev(entity, PEV_FLARE_COLOR, rgb)
}
}
After that find this part and delete it --
// Flare Lighting Effects
flare_lighting(entity, duration)
{
// Get origin and color
static Float:originF[3], color[3]
pev(entity, pev_origin, originF)
pev(entity, PEV_FLARE_COLOR, color)
if (g_assassinround)
{
// Lighting in assassin round is different
engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, originF, 0)
write_byte(TE_DLIGHT) // TE id
engfunc(EngFunc_WriteCoord, originF[0]) // x
engfunc(EngFunc_WriteCoord, originF[1]) // y
engfunc(EngFunc_WriteCoord, originF[2]) // z
write_byte(get_pcvar_num(cvar_flaresize2)) // radius
write_byte(color[0]) // r
write_byte(color[1]) // g
write_byte(color[2]) // b
write_byte(51) //life
write_byte((duration < 2) ? 3 : 0) //decay rate
message_end()
}
else
{
// Lighting
engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, originF, 0)
write_byte(TE_DLIGHT) // TE id
engfunc(EngFunc_WriteCoord, originF[0]) // x
engfunc(EngFunc_WriteCoord, originF[1]) // y
engfunc(EngFunc_WriteCoord, originF[2]) // z
write_byte(get_pcvar_num(cvar_flaresize)) // radius
write_byte(color[0]) // r
write_byte(color[1]) // g
write_byte(color[2]) // b
write_byte(51) //life
write_byte((duration < 2) ? 3 : 0) //decay rate
message_end()
}
// Sparks
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
write_byte(TE_SPARKS) // TE id
engfunc(EngFunc_WriteCoord, originF[0]) // x
engfunc(EngFunc_WriteCoord, originF[1]) // y
engfunc(EngFunc_WriteCoord, originF[2]) // z
message_end()
}
Then find these variables and delete them too --
cvar_flarecolor
cvar_flareduration
cvar_flaresize
cvar_flaresize2
Then find this part--
// CVARS - Custom Grenades
cvar_firegrenades = register_cvar("zp_fire_grenades", "1")
cvar_fireduration = register_cvar("zp_fire_duration", "10")
cvar_firedamage = register_cvar("zp_fire_damage", "5")
cvar_fireslowdown = register_cvar("zp_fire_slowdown", "0.5")
cvar_frostgrenades = register_cvar("zp_frost_grenades", "1")
cvar_freezeduration = register_cvar("zp_frost_duration", "3")
cvar_frozenhit = register_cvar("zp_frost_hit", "1")
cvar_flaregrenades = register_cvar("zp_flare_grenades","1")
cvar_flareduration = register_cvar("zp_flare_duration", "60")
cvar_flaresize = register_cvar("zp_flare_size", "25")
cvar_flarecolor = register_cvar("zp_flare_color", "5")
cvar_flaresize2 = register_cvar("zp_flare_size_assassin", "15")
Replace it with --
// CVARS - Custom Grenades
cvar_firegrenades = register_cvar("zp_fire_grenades", "1")
cvar_fireduration = register_cvar("zp_fire_duration", "10")
cvar_firedamage = register_cvar("zp_fire_damage", "5")
cvar_fireslowdown = register_cvar("zp_fire_slowdown", "0.5")
cvar_frostgrenades = register_cvar("zp_frost_grenades", "1")
cvar_freezeduration = register_cvar("zp_frost_duration", "3")
cvar_frozenhit = register_cvar("zp_frost_hit", "1")
cvar_flaregrenades = register_cvar("zp_flare_grenades","1")
Finally we are fully done!
Now, just compile and Enjoy your Game!
Dont forget to say me thanks and give me Karma it this Tutorial really helped you!
Have a nice day!