Jump to content

Bodies Has Hitscan - Only Works With Lightsabers


Recommended Posts

Posted

So i made bowcaster to dismember the limb after hit. But the weird thing is that i cant dismember more than one limb. I checked with the g_debugdamage cheat that bodies have always - none  in the hitscan. How to change that?

Posted

So i made bowcaster to dismember the limb after hit. But the weird thing is that i cant dismember more than one limb. I checked with the g_debugdamage cheat that bodies have always - none  in the hitscan. How to change that?

bowcaster is a saber, or is a shoot weapons? (if is a shoot weapons, really you need to explain me how yoi did a dismember gun D: without coding! )

if is a saber... the solution is to set g_saberrealistcombat cvar to 9 or some value like that. if i remember fines.

Posted

bowcaster is a saber, or is a shoot weapons? (if is a shoot weapons, really you need to explain me how yoi did a dismember gun D: without coding! )

if is a saber... the solution is to set g_saberrealistcombat cvar to 9 or some value like that. if i remember fines.

I made it using Dismember like this - I started to play a little with Openjk and coding but i will not try to change or add something to my Cloud City modification . I have edited Weapons.h and i found out that there is not all options for all weapons.

I wanted to change the damage of the weapons wo be higher and also the speed of the lasers. And i was very proud that it worked out. But when i was looking on the archieved topic that i started - i wanted to make dismember guns. @@eezstreet wrote that i must change in g_combat.cpp this line - 

 

if ( !g_iscensored->integer && ( g_dismemberment->integer || g_saberRealisticCombat->integer > 1 ) && mod == MOD_SABER )//only lightsaber to if ( !g_iscensored->integer && ( g_dismemberment->integer || g_saberRealisticCombat->integer > 1 ))

 

It didnt change anything sadly. But later on i looked in the code more. 

 

In The Wp_Bowcaster.cpp at the bottom  i added this - missile->dflags = DAMAGE_DISMEMBER; like this

 

//---------------------------------------------------------
static void WP_BowcasterMainFire( gentity_t *ent )
//---------------------------------------------------------
{
int damage = weaponData[WP_BOWCASTER].damage, count;
float vel;
vec3_t angs, dir, start;
gentity_t *missile;
 
VectorCopy( muzzle, start );
WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall
 
// Do the damages
if ( ent->s.number != 0 )
{
if ( g_spskill->integer == 0 )
{
damage = BOWCASTER_NPC_DAMAGE_EASY;
}
else if ( g_spskill->integer == 1 )
{
damage = BOWCASTER_NPC_DAMAGE_NORMAL;
}
else
{
damage = BOWCASTER_NPC_DAMAGE_HARD;
}
}
 
count = ( level.time - ent->client->ps.weaponChargeTime ) / BOWCASTER_CHARGE_UNIT;
 
if ( count < 1 )
{
count = 1;
}
else if ( count > 5 )
{
count = 5;
}
 
if ( !(count & 1 ))
{
// if we aren't odd, knock us down a level
count--;
}
 
// if ( ent->client && ent->client->ps.powerups[PW_WEAPON_OVERCHARGE] > 0 && ent->client->ps.powerups[PW_WEAPON_OVERCHARGE] > cg.time )
// {
// // in overcharge mode, so doing double damage
// damage *= 2;
// }
 
WP_MissileTargetHint(ent, start, forwardVec);
for ( int i = 0; i < count; i++ )
{
// create a range of different velocities
vel = BOWCASTER_VELOCITY * ( Q_flrand(-1.0f, 1.0f) * BOWCASTER_VEL_RANGE + 1.0f );
 
vectoangles( forwardVec, angs );
 
if ( !(ent->client->ps.forcePowersActive&(1<<FP_SEE))
|| ent->client->ps.forcePowerLevel[FP_SEE] < FORCE_LEVEL_2 )
{//force sight 2+ gives perfect aim
//FIXME: maybe force sight level 3 autoaims some?
// add some slop to the fire direction
angs[PITCH] += Q_flrand(-1.0f, 1.0f) * BOWCASTER_ALT_SPREAD * 0.2f;
angs[YAW] += ((i+0.5f) * BOWCASTER_ALT_SPREAD - count * 0.5f * BOWCASTER_ALT_SPREAD );
if ( ent->NPC )
{
angs[PITCH] += ( Q_flrand(-1.0f, 1.0f) * (BLASTER_NPC_SPREAD+(6-ent->NPC->currentAim)*0.25f) );
angs[YAW] += ( Q_flrand(-1.0f, 1.0f) * (BLASTER_NPC_SPREAD+(6-ent->NPC->currentAim)*0.25f) );
}
}
 
AngleVectors( angs, dir, NULL, NULL );
 
missile = CreateMissile( start, dir, vel, 10000, ent );
 
missile->classname = "bowcaster_proj";
missile->s.weapon = WP_BOWCASTER;
 
VectorSet( missile->maxs, BOWCASTER_SIZE, BOWCASTER_SIZE, BOWCASTER_SIZE );
VectorScale( missile->maxs, -1, missile->mins );
 
// if ( ent->client && ent->client->ps.powerups[PW_WEAPON_OVERCHARGE] > 0 && ent->client->ps.powerups[PW_WEAPON_OVERCHARGE] > cg.time )
// {
// missile->flags |= FL_OVERCHARGED;
// }
 
missile->damage = damage;
missile->dflags = DAMAGE_DEATH_KNOCKBACK;
missile->dflags = DAMAGE_DISMEMBER;
missile->methodOfDeath = MOD_BOWCASTER;
missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER;
missile->splashDamage = weaponData[WP_BOWCASTER].splashDamage;
missile->splashRadius = weaponData[WP_BOWCASTER].splashRadius;
 
// we don't want it to bounce
missile->bounceCount = 0;
ent->client->sess.missionStats.shotsFired++;
}
}
 
//---------------------------------------------------------
static void WP_BowcasterAltFire( gentity_t *ent )
//---------------------------------------------------------
{
vec3_t start;
int damage = weaponData[WP_BOWCASTER].altDamage;
 
VectorCopy( muzzle, start );
WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall
 
WP_MissileTargetHint(ent, start, forwardVec);
 
gentity_t *missile = CreateMissile( start, forwardVec, BOWCASTER_VELOCITY, 10000, ent, qtrue );
 
missile->classname = "bowcaster_alt_proj";
missile->s.weapon = WP_BOWCASTER;
 
// Do the damages
if ( ent->s.number != 0 )
{
if ( g_spskill->integer == 0 )
{
damage = BOWCASTER_NPC_DAMAGE_EASY;
}
else if ( g_spskill->integer == 1 )
{
damage = BOWCASTER_NPC_DAMAGE_NORMAL;
}
else
{
damage = BOWCASTER_NPC_DAMAGE_HARD;
}
}
 
VectorSet( missile->maxs, BOWCASTER_SIZE, BOWCASTER_SIZE, BOWCASTER_SIZE );
VectorScale( missile->maxs, -1, missile->mins );
 
// if ( ent->client && ent->client->ps.powerups[PW_WEAPON_OVERCHARGE] > 0 && ent->client->ps.powerups[PW_WEAPON_OVERCHARGE] > cg.time )
// {
// // in overcharge mode, so doing double damage
// missile->flags |= FL_OVERCHARGED;
// damage *= 2;
// }
 
missile->s.eFlags |= EF_BOUNCE;
missile->bounceCount = 3;
 
missile->damage = damage;
missile->dflags = DAMAGE_DEATH_KNOCKBACK;
missile->dflags = DAMAGE_DISMEMBER;
missile->methodOfDeath = MOD_BOWCASTER_ALT;
missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER;
missile->splashDamage = weaponData[WP_BOWCASTER].altSplashDamage;
missile->splashRadius = weaponData[WP_BOWCASTER].altSplashRadius;
}
 
//---------------------------------------------------------
void WP_FireBowcaster( gentity_t *ent, qboolean alt_fire )
//---------------------------------------------------------
{
if ( alt_fire )
{
WP_BowcasterAltFire( ent );
}
else
{
WP_BowcasterMainFire( ent );
}

 

}

 

 

That made my bowcaster killing shot to dismember the limb. Headshots makes heads flying (This is rly fun change.. but brutal ;)

 

Also i found out that changing these lines in weapon.h :

 

#define BOWCASTER_SPLASH_DAMAGE 0
#define BOWCASTER_SPLASH_RADIUS 0

 

to 

 

#define BOWCASTER_SPLASH_DAMAGE 20
#define BOWCASTER_SPLASH_RADIUS 100

Makes Bowcaster very powerful and more fun weapon but less fun when i am fightning the lighstaber user. I think it is in the code that enemies with force powers are trying to push or jump/evade the weapons with splash damage. adding this made lightsaber user to force push - even if they cannot do it. Would be cool to change that too for weapons that are pushable (imagine jedi pushing Your main flechette shots)

 

I also changed the damage of the melee. Now - player and enemis deals always the same damage. Still it was weird andhard for me to understand. I found out that player was dealing only 6... dmg. And sometimes even less- 3 . But Grans Boxers for example were dealing something like 40 and 60 It is very weird because everything changed after i made some changes in the Wp_melee.cpp . Now boxers and player deals the same amount of damage and it will always be 40. But i wanted to find out..  why it is made this way?  

 

In the Wp_melee (again at the bottom):

 

void WP_Melee( gentity_t *ent )
//---------------------------------------------------------
{
gentity_t *tr_ent;
trace_t tr;
vec3_t mins, maxs, end;
int damage = ent->s.number ? (g_spskill->integer*2)+1 : 3; <- this 3 is somehow x2 sometimes . That is why player deals - 6 dmg  too. I think it is because of the line that is below.
float range = ent->s.number ? 64 : 32;
 
VectorMA( muzzle, range, forwardVec, end );
 
VectorSet( maxs, 6, 6, 6 );
VectorScale( maxs, -1, mins );
 
gi.trace ( &tr, muzzle, mins, maxs, end, ent->s.number, MASK_SHOT, (EG2_Collision)0, 0 );
 
if ( tr.entityNum >= ENTITYNUM_WORLD )
{
if ( tr.entityNum == ENTITYNUM_WORLD )
{
G_PlayEffect( G_EffectIndex( "melee/punch_impact" ), tr.endpos, forwardVec );
}
return;
}
 
tr_ent = &g_entities[tr.entityNum];
 
if ( ent->client && !PM_DroidMelee( ent->client->NPC_class ) )
{
if ( ent->s.number || ent->alt_fire )
{
damage *= Q_irand( 2, 3 ); here i think it is for the enemies. You may ask why? I dont know.. i am a noob but it works for me. If Gran Boxer deals 40 and 60 i looked down below on the : damage *= 4; Lets do the math : 4x10=40 4x15=60 .. and i changed in my wp_melee file this line to *= Q_irand( 2, 2 ); and guess what. Gran was dealing only 40dmg ONLY!
}
else
{
damage *= Q_irand( 1, 2 ); remember that i what i was saying before ? I think this line is for player - in my wp_melee i changed these line to damage *= Q_irand( 2, 2 );
}
}
 
if ( tr_ent && tr_ent->takedamage )
{
int dflags = DAMAGE_NO_KNOCKBACK;
G_PlayEffect( G_EffectIndex( "melee/punch_impact" ), tr.endpos, forwardVec );
//G_Sound( tr_ent, G_SoundIndex( va("sound/weapons/melee/punch%d", Q_irand(1, 4)) ) );
if ( ent->NPC && (ent->NPC->aiFlags&NPCAI_HEAVY_MELEE) )
{ //4x damage for heavy melee class
damage *= 4; this damage is not damage for the player. This is the damage of the npcs. Weird fact that it was .. x10 and x15
dflags &= ~DAMAGE_NO_KNOCKBACK;
dflags |= DAMAGE_DISMEMBER;
}
 
G_Damage( tr_ent, ent, ent, forwardVec, tr.endpos, damage, dflags, MOD_MELEE );
}
}

 

So as i was thinking - maybe i will just look for the line in the code that makes enemies somehow dealing x10 and x15 with this mase damage. It was getting out of control when Gran Boxer punched me and killed me with one hit... dealing 750 damage. Wow. 

But i cant found it anywhere. I thought it is in AI_Grendardier but nope. 

 

But back to the main topic : - Dismember work once. After the enemy is killed the Hit_Loc of the body is turned off. Which means that - shooting at the head of the DEAD body will not deal extra damage (because headshots are 2x damage right?) . When i turned on the g_debugdamage to 1 i saw that game reads it as the : none . Not a head or leg or arm.. Because of that game does not know to actually cut the limb because damage is not based on the hit_loc anymore :/ I might be wrong here but this is my observation.

Vade Parvis likes this
Posted

 

I made it using Dismember like this - I started to play a little with Openjk and coding but i will not try to change or add something to my Cloud City modification . I have edited Weapons.h and i found out that there is not all options for all weapons.

I wanted to change the damage of the weapons wo be higher and also the speed of the lasers. And i was very proud that it worked out. But when i was looking on the archieved topic that i started - i wanted to make dismember guns. @@eezstreet wrote that i must change in g_combat.cpp this line - 

 

if ( !g_iscensored->integer && ( g_dismemberment->integer || g_saberRealisticCombat->integer > 1 ) && mod == MOD_SABER )//only lightsaber to if ( !g_iscensored->integer && ( g_dismemberment->integer || g_saberRealisticCombat->integer > 1 ))

 

It didnt change anything sadly. But later on i looked in the code more. 

 

In The Wp_Bowcaster.cpp at the bottom  i added this - missile->dflags = DAMAGE_DISMEMBER; like this

 

 

That made my bowcaster killing shot to dismember the limb. Headshots makes heads flying (This is rly fun change.. but brutal ;)

 

Also i found out that changing these lines in weapon.h :

 

#define BOWCASTER_SPLASH_DAMAGE 0
#define BOWCASTER_SPLASH_RADIUS 0

 

to 

 

#define BOWCASTER_SPLASH_DAMAGE 20
#define BOWCASTER_SPLASH_RADIUS 100

Makes Bowcaster very powerful and more fun weapon but less fun when i am fightning the lighstaber user. I think it is in the code that enemies with force powers are trying to push or jump/evade the weapons with splash damage. adding this made lightsaber user to force push - even if they cannot do it. Would be cool to change that too for weapons that are pushable (imagine jedi pushing Your main flechette shots)

 

I also changed the damage of the melee. Now - player and enemis deals always the same damage. Still it was weird andhard for me to understand. I found out that player was dealing only 6... dmg. And sometimes even less- 3 . But Grans Boxers for example were dealing something like 40 and 60 It is very weird because everything changed after i made some changes in the Wp_melee.cpp . Now boxers and player deals the same amount of damage and it will always be 40. But i wanted to find out..  why it is made this way?  

 

In the Wp_melee (again at the bottom):

 

So as i was thinking - maybe i will just look for the line in the code that makes enemies somehow dealing x10 and x15 with this mase damage. It was getting out of control when Gran Boxer punched me and killed me with one hit... dealing 750 damage. Wow. 

But i cant found it anywhere. I thought it is in AI_Grendardier but nope. 

 

But back to the main topic : - Dismember work once. After the enemy is killed the Hit_Loc of the body is turned off. Which means that - shooting at the head of the DEAD body will not deal extra damage (because headshots are 2x damage right?) . When i turned on the g_debugdamage to 1 i saw that game reads it as the : none . Not a head or leg or arm.. Because of that game does not know to actually cut the limb because damage is not based on the hit_loc anymore :/ I might be wrong here but this is my observation.

 

Pretty Interessing and exaustive explanation. i worked on code for last years. but you teach me a lot of things that i ignored before.

thanks.

for dismemberment... i remember many yearsa ago a mod MP called the great honor where there was an MP weapon that when kill enemy all body parts was dismembered... pity i never found the code of this mod and so i not know how to figure how to do that for help you to injure the corpe or improve dismemberment.

sure your knowledge is useful also for me. i will apply soon on my mod the dismemberment stuff to all magics that blow ups or heavily hit foes. should be really funs!

 

thanks also for wp_melee i never figured how to change the value.

 

s.number however regard the entities NPC on a map i guess. consider that entity zero is player so if s.number = 0 the code affected olayer, other values affected generic NPCs. \ other entity on maps.

Posted

So i saw there are only two weapons that actually. I can dismember the body after the kill. The reason i want this is not to torture bodies on the floor .. but to actually dismember enemies while shooting a barrage of missles at them. 

The Disruptor - main and alt fire and also conussion rifle - only alt fire. These two are similar - laser that instantly goes through entire map. But i also saw in a code this line.
 


int hitLoc = G_GetHitLocFromTrace(&tr, MOD_CONC_ALT);
qboolean noKnockBack = (qboolean)((traceEnt->flags&FL_NO_KNOCKBACK) != 0);//will be set if they die, I want to know if it was on *before* they died
if (traceEnt && traceEnt->client && traceEnt->client->NPC_class == CLASS_GALAKMECH)
{//hehe
G_Damage(traceEnt, ent, ent, forwardVec, tr.endpos, 10, DAMAGE_NO_KNOCKBACK | DAMAGE_NO_HIT_LOC, MOD_CONC_ALT, hitLoc);
break;
}
G_Damage(traceEnt, ent, ent, forwardVec, tr.endpos, damage, DAMAGE_NO_KNOCKBACK | DAMAGE_NO_HIT_LOC, MOD_CONC_ALT, hitLoc);

 

 

and for disruptor
 

if (render_impact)
{
if (tr.entityNum < ENTITYNUM_WORLD && traceEnt->takedamage)
{
// Create a simple impact type mark that doesn't last long in the world
G_PlayEffect(G_EffectIndex("disruptor/flesh_impact"), tr.endpos, tr.plane.normal);
 
if (traceEnt->client && LogAccuracyHit(traceEnt, ent))
{
ent->client->ps.persistant[PERS_ACCURACY_HITS]++;
}
 
int hitLoc = G_GetHitLocFromTrace(&tr, MOD_DISRUPTOR);
if (traceEnt && traceEnt->client && traceEnt->client->NPC_class == CLASS_GALAKMECH)
{//hehe
G_Damage(traceEnt, ent, ent, forwardVec, tr.endpos, 3, DAMAGE_DEATH_KNOCKBACK, MOD_DISRUPTOR, hitLoc);
}
else
{
G_Damage(traceEnt, ent, ent, forwardVec, tr.endpos, damage, DAMAGE_DEATH_KNOCKBACK, MOD_DISRUPTOR, hitLoc);
}
}
else
{
G_PlayEffect(G_EffectIndex("disruptor/wall_impact"), tr.endpos, tr.plane.normal);
}
}

 


This lines are similar. One thing that i dont understand is those traces. Well.. i dont understand many things. Like why the hell i see GALAK_MECH class??? Dunno . 

Still cant understand why bodies loss for most of the weapons hitscan but for saber, disruptor and concussion dont. 

EDIT: fixed this weird issue .. in g_combat.cpp line : 2348 i wrote - qboolean doDismemberment = qtrue; oriignally there is qboolean doDismemberment = qfalse; .. it bugged the dismember mechanic by simply dismember the playermodel after hurting an enemy even if we hit the tags that are not for dismemberment. Still cant find this syupid line in the code that turns off the hitloc for the dead enemies..
  • 5 weeks later...
Posted

The missle enities lose the hitscan after the enemy is killed. ... And i screwed soemthing up now... If i will shoot enemies chest - the whole model is like dismember without a reason... It was dismembering the enemies but no whole bodies .. it looks weird. How to fix this and activated hitscan for bodies?

  • 4 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...