Hi,I have add a “gasgranade” in my little mod.The skin is ok,weapon change is ok.
Now i have 2 probs.
- How to add damage to the smoke?
- How change the smoke color?
Now,i have 2 smoke_bombs in my mod,lol.
gruss
ksa2000
Hi,I have add a “gasgranade” in my little mod.The skin is ok,weapon change is ok.
Now i have 2 probs.
Now,i have 2 smoke_bombs in my mod,lol.
gruss
ksa2000
take a look at the flamethrower’s code and do something similiar. :lol:
Smoke bomb colours
open cg_effects.c
go to the function qboolean CG_SpawnSmokeSprite( centity_t *cent, float dist )
modify this this 4 values (never > 1 ok !)
smokesprite->colour[0] = .35f; // + crandom() * .1f;
smokesprite->colour[1] = smokesprite->colour[0];
smokesprite->colour[2] = smokesprite->colour[0];
smokesprite->colour[3] = .8f;
By example u can do this
//Axis smokebomb colour
if(smokesprite->smokebomb->currentState.teamNum==1)
{ smokesprite->colour[0] = .4f;
smokesprite->colour[1] = .6f;
smokesprite->colour[2] = .6f;
smokesprite->colour[3] = .5f; //transparancy
}
//Allies smokebomb colour
else if(smokesprite->smokebomb->currentState.teamNum==2) // Allies
{ smokesprite->colour[0] = .5f;
smokesprite->colour[1] = .8f;
smokesprite->colour[2] = .3f;
smokesprite->colour[3] = .5f; //transparancy
}
else // default
{ smokesprite->colour[0] = .35f;
smokesprite->colour[1] = smokesprite->colour[0];
smokesprite->colour[2] = smokesprite->colour[0];
smokesprite->colour[3] = .8f;
}
For the poinson gaz u must create your function.
on my mod (bobot) the smokebombgas has 2 options
RW -> probably ksa2000 meant “Realistic War”.
It had phosphorous and gas grenades, apart from your regular smoke grenade, air strike marker and explosives.
These Code can change the color of the Smoke Bomb, add damage and add when u like a burn modus…
But that add only features to the smokebomb, but dont add a new weapon.
Add a colored Smoke bomb that burns
I) Donner de la couleur au smoke bomb / Make a colored smoke bomb.
1) open cg_effects.c
2) go to the function qboolean CG_SpawnSmokeSprite( centity_t *cent, float dist ) and modify like this.
qboolean CG_SpawnSmokeSprite( centity_t *cent, float dist )
{ smokesprite_t *smokesprite = AllocSmokeSprite();
if( smokesprite )
{ smokesprite->smokebomb = cent;
VectorCopy( cent->origin2, smokesprite->pos );
VectorCopy( bytedirs[rand()%NUMVERTEXNORMALS], smokesprite->dir );
smokesprite->dir[2] *= .5f;
smokesprite->size = 16.f;
if(smokesprite->smokebomb->currentState.teamNum==1) //team Axis = blue smoke
{ smokesprite->colour[0] = .2f;
smokesprite->colour[1] = .3f;
smokesprite->colour[2] = .6f;
smokesprite->colour[3] = .25f; //smoke transparency
}
else if(smokesprite->smokebomb->currentState.teamNum==2) // team Allies = orange smoke
{ smokesprite->colour[0] = .5f;
smokesprite->colour[1] = .2f;
smokesprite->colour[2] = .1f;
smokesprite->colour[3] = .25f; //smoke transparency
}
else
{ smokesprite->colour[0] = .35f; // default
smokesprite->colour[1] = smokesprite->colour[0];
smokesprite->colour[2] = smokesprite->colour[0];
smokesprite->colour[3] = .8f;
}
// Advance sprite
if( !CG_SmokeSpritePhysics( smokesprite, dist ) )
{ DeAllocSmokeSprite( smokesprite );
return( qfalse );
}
else
cent->miscTime++;
}
return( qtrue );
}
II) Brûler l'ennemi / Burn the enemy.
1) open g_active.c
2) create the function (smoke bomb that burns) into g_active.c
void smoke_bomb_burn(gentity_t *ent)
{ gentity_t *dyn;
vec3_t diff;
float dist;
//a smoke bomb is it launched ? Find it.
for (dyn = G_FindSmokeBomb( NULL );dyn;dyn = G_FindSmokeBomb(dyn))
{ VectorSubtract(ent->r.currentOrigin,dyn->r.currentOrigin,diff); // a player is into the smoke ?
dist = VectorLength(diff);
// Example 1) if you want that it only burns adversary team, do this
if(!OnSameTeam(ent,dyn->parent)) // burns only adversary team
{ if (dist <= 300 && dyn->s.effect1Time==640 && ent->takedamage==qtrue) // a player is into the radius smoke (300)
G_BurnMeGood(ent, ent); // the player is burned
}
// Example 2) if you want that it burns all teams, do this.
if (dist <= 300 && dyn->s.effect1Time==640 && ent->takedamage==qtrue) // a player is into the radius smoke (300)
G_BurnMeGood(ent, ent); // the player is burned
// Example 3) You can burn adversary team and regenerate health of your team, like this.
if(!OnSameTeam(ent,dyn->parent)) // burns only adversary team
{ if (dist <= 300 && dyn->s.effect1Time==640 && ent->takedamage==qtrue) // a player is into the radius smoke (300)
G_BurnMeGood(ent, ent); // the player is burned
}
else
{ ent->health+=1;
if ( ent->health > ent->client->ps.stats[STAT_MAX_HEALTH] )
ent->health = ent->client->ps.stats[STAT_MAX_HEALTH] ;
}
}
}
3) Add function smoke_bomb_burn(gentity_t *ent) into the function : void ClientTimerActions( gentity_t *ent, int msec )
/*==================
ClientTimerActions
Actions that happen once a second
==================*/
void ClientTimerActions( gentity_t *ent, int msec )
{ gclient_t *client;
gentity_t *attacker;
int regenRate1, regenRate2,i;
client = ent->client;
client->timeResidual += msec;
while( client->timeResidual >= 1000 )
{
client->timeResidual -= 1000;
// Traitement du smokebomb
smoke_bomb_burn(ent);
// Adrenaline countdown.
if( g_logOptions.integer & LOGOPTS_ADR_COUNT && client->ps.powerups[PW_ADRENALINE] > level.time )
CP(va("cp \"^3Adrenaline (%d)\"", ((client->ps.powerups[PW_ADRENALINE] - level.time)/1000)));
// Determine regenerate
switch(g_medicHealthRegen.integer)
{
case MEDIC_REGENRATE22:
regenRate1 = 2;
regenRate2 = 2;
break;
case MEDIC_REGENRATE21:
regenRate1 = 2;
regenRate2 = 1;
break;
case MEDIC_REGENRATE20:
regenRate1 = 2;
regenRate2 = 0;
break;
case MEDIC_REGENRATE11:
regenRate1 = 1;
regenRate2 = 1;
break;
case MEDIC_REGENRATE10:
regenRate1 = 1;
regenRate2 = 0;
break;
case MEDIC_REGENRATE00:
regenRate1 = 0;
regenRate2 = 0;
break;
default:
regenRate1 = 3;
regenRate2 = 2;
break;
}
// regenerate
if( client->sess.playerType == PC_MEDIC && !(client->ps.eFlags & EF_DEAD) )
{ if( ent->health < client->ps.stats[STAT_MAX_HEALTH])
{ ent->health += regenRate1;
if ( ent->health > client->ps.stats[STAT_MAX_HEALTH] * 1.1)
ent->health = client->ps.stats[STAT_MAX_HEALTH] * 1.1;
}
else if( ent->health < client->ps.stats[STAT_MAX_HEALTH] * 1.12)
{ ent->health += regenRate2;
if( ent->health > client->ps.stats[STAT_MAX_HEALTH] * 1.12 )
ent->health = client->ps.stats[STAT_MAX_HEALTH] * 1.12;
}
}
else
{ if ( ent->health > client->ps.stats[STAT_MAX_HEALTH] )
ent->health--;
}
if(ent->takedamage==qfalse)
{ client->pmext.poisoned = qfalse; }
if(client->pmext.poisoned && ent->health > 0 && g_poison.integer)
{ attacker = g_entities + client->pmext.poisonerEnt;
if(g_poisonSound.string[0])
{ G_AddEvent(ent, EV_GLOBAL_SOUND,G_SoundIndex(g_poisonSound.string)); }
G_Damage(ent, attacker, attacker, NULL, NULL,g_poison.integer, 0, MOD_POISON);
}
if(client->pmext.poisoned && (ent->health <= 0 || client->ps.eFlags & EF_DEAD))
client->pmext.poisoned = qfalse;
}
Dernière mise à jour de cette page le 09/08/2010
Credits to Bobot and PAV
Copied from: http://bobots.e-monsite.com/rubrique,add-smoke-bomb,1160045.html