Jump to content

Stopping a blaster projectile in mid-air


Recommended Posts

Posted

Hmm about this topic i want to go back to the Jedi Outcast.

I dont know if i am the only one that find out that You can push the blaster bolts with force push.

d7b6af156231bd0e5efb24261135c58f.jpg

Back to the topic .. It is definitely the coding work. :S
 

Posted

I would begin by trying to modify force push to stop the bullet instead of sending it back. Then most of the work would be done for you already. You would also need to find a way to keep it from timing out, but I'm sure one of the structs for bullets have some kind of timer you could modify.

 

One of the entity structs should have an array called "velocity" (use ctrl F to find usages of it).

Nulling out the velocity should be a matter of

 

bullet->something->velocity[0] = 0;

bullet->something->velocity[1] = 0;

bullet->something->velocity[2] = 0.

 

Then if that works, you could perhaps try to make it a new force power afterwards.

Posted

Noooope . In Jk3 You can only push - Concussion,rockets, detpacks and trip mines (ONLY in id air) , Repeater alt fire (default You cant), flechette (i think both).

Blasters - rifle and pistol cannot be pushed. Same with demp2,bowcaster ,repeater and other laser weapons. In Jk3 SP Of course.

Look .. without god mode i would be dead as bantha poop..

8088b9c0ab38bbfece5a3a599535f44a.jpg
8c643e9bf5cc168a5919f368b769ccdf.jpg
 

Posted

JA SP code: you can change projectiles pushable editing a little function on g_missile.cpp about it, if i remember fine.

:)

 

mmm also in void forcethrow on wp_saber.cpp there are some interessing setting about homing rockets.

 

else if ( push_list[x]->s.eType == ET_MISSILE
                    && push_list[x]->s.pos.trType != TR_STATIONARY
                    && (push_list[x]->s.pos.trType != TR_INTERPOLATE||push_list[x]->s.weapon != WP_THERMAL) )//rolling and stationary thermal detonators are dealt with below
                {
                    vec3_t dir2Me;
                    VectorSubtract( self->currentOrigin, push_list[x]->currentOrigin, dir2Me );
                    float dot = DotProduct( push_list[x]->s.pos.trDelta, dir2Me );
                    if ( pull )
                    {//deflect rather than reflect?
                    }
                    else
                    {
                        if ( push_list[x]->s.eFlags&EF_MISSILE_STICK )
                        {//caught a sticky in-air
                            push_list[x]->s.eType = ET_MISSILE;
                            push_list[x]->s.eFlags &= ~EF_MISSILE_STICK;
                            push_list[x]->s.eFlags |= EF_BOUNCE_HALF;
                            push_list[x]->splashDamage /= 3;
                            push_list[x]->splashRadius /= 3;
                            push_list[x]->e_ThinkFunc = thinkF_WP_Explode;
                            push_list[x]->nextthink = level.time + Q_irand( 500, 3000 );
                        }
                        if ( dot >= 0 )
                        {//it's heading towards me
                            G_ReflectMissile( self, push_list[x], forward );
                        }
                        else
                        {
                            VectorScale( push_list[x]->s.pos.trDelta, 1.25f, push_list[x]->s.pos.trDelta );
                        }
                        //deflect sound
                        //G_Sound( push_list[x], G_SoundIndex( va("sound/weapons/blaster/reflect%d.wav", Q_irand( 1, 3 ) ) ) );
                        //push_list[x]->forcePushTime = level.time + 600; // let the push effect last for 600 ms
                    }
                    if ( push_list[x]->s.eType == ET_MISSILE
                        && push_list[x]->s.weapon == WP_ROCKET_LAUNCHER
                        && push_list[x]->damage < 60 )
                    {//pushing away a rocket raises it's damage to the max for NPCs
                        push_list[x]->damage = 60;
                    }
                }
                else if ( push_list[x]->svFlags & SVF_GLASS_BRUSH )
                {//break the glass
                    trace_t tr;
                    vec3_t    pushDir;
                    float    damage = 800;

                    AngleVectors( self->client->ps.viewangles, forward, NULL, NULL );
                    VectorNormalize( forward );
                    VectorMA( self->client->renderInfo.eyePoint, radius, forward, end );
                    gi.trace( &tr, self->client->renderInfo.eyePoint, vec3_origin, vec3_origin, end, self->s.number, MASK_SHOT, (EG2_Collision)0, 0 );
                    if ( tr.entityNum != push_list[x]->s.number || tr.fraction == 1.0 || tr.allsolid || tr.startsolid )
                    {//must be pointing right at it
                        continue;
                    }

                    if ( pull )
                    {
                        VectorSubtract( self->client->renderInfo.eyePoint, tr.endpos, pushDir );
                    }
                    else
                    {
                        VectorSubtract( tr.endpos, self->client->renderInfo.eyePoint, pushDir );
                    }
 
Posted

yeah, it's always annoyed me how bots and npc's can push away anything I throw at them (even mines and detpacks!!!), but I couldn't :(

This should be changed and it is OP. Why Jaden is worst in this than every reborn_new that We were fightining against ?

the_raven likes this
Posted

I believe stopping a blaster bolt in mid-air is more Grip than anything, so I'd recommend that you look there.

 

I mmm if i remember there is into the force grip code a part when is possible to grip a thermal detonator grenade for stop it on middle air. maybe is possible to hack this code portion for allow the grip to "grip" all weapons projectiles. should be cool for blaster, flechette and rockets.

Posted

I mmm if i remember there is into the force grip code a part when is possible to grip a thermal detonator grenade for stop it on middle air. maybe is possible to hack this code portion for allow the grip to "grip" all weapons projectiles. should be cool for blaster, flechette and rockets.

hmm, there was some mod on here that allowed you to telekinetically move prop-objects, maybe one should look at its code?

Posted

@@the_raven

 

 

{//can't grip non-clients... right?
//FIXME: Make it so objects flagged as "grabbable" are let through
//if ( Q_stricmp( "misc_model_breakable", traceEnt->classname ) || !(traceEnt->s.eFlags&EF_BOUNCE_HALF) || !traceEnt->physicsBounce )
{
return;
}
}

 

 

 

The "misc_model_breakable" portion of ForceGrip is what would allow you to grab & move map objects. You'd probably have to add a powerup to make it stay frozen for a short time (at higher levels?) .

Posted

hmm, there was some mod on here that allowed you to telekinetically move prop-objects, maybe one should look at its code?

 

No code in that mod: https://jkhub.org/files/file/717-throwable-stuff/

It's just a bunch of models rigged to a skeleton and turned into NPCs, so that you can grip them around.

 

The "misc_model_breakable" portion of ForceGrip is what would allow you to grab & move map objects. You'd probably have to add a powerup to make it stay frozen for a short time (at higher levels?) .

 

misc_model_breakable entities in general are strange and quite broken, at least in my tests. They seem to accept a target, so that whenever the entity is pushed it will be pushed in the direction of the target. However it doesn't seem to accept more than one target - when I tried to assign two different targets to two misc_model_breakable, they both were pushed at only one target. Haven't really tried with grip.

Posted

when I tried to assign two different targets to two misc_model_breakable, they both were pushed at only one target. Haven't really tried with grip.

 

Did you use a sort of radius command when you tried assigning them?

Posted

about shooting weapons...

On openjk code i see there is this on case FP_GRIP on WP_forcepowerstop. the grip power is strange because the gripping (choking, lifting and movement of NPC ) is executed when the power is stopped, like something as 1 second after casting. the FP_GRIP run code only stuck the entity without move or damage it... i think the run grip code only play the pushblur effect on the throat + the choke sound + the choke animation of NPC.

however... i found this about the thermal detonator.

else
                {
                    gripEnt->s.eFlags &= ~EF_FORCE_GRIPPED;
                    if ( gripEnt->s.eType == ET_MISSILE )
                    {//continue normal movement
                        if ( gripEnt->s.weapon == WP_THERMAL )
                        {
                            gripEnt->s.pos.trType = TR_INTERPOLATE;
                        }
                        else
                        {
                            gripEnt->s.pos.trType = TR_LINEAR;//FIXME: what about gravity-effected projectiles?
                        }
                        VectorCopy( gripEnt->currentOrigin, gripEnt->s.pos.trBase );
                        gripEnt->s.pos.trTime = level.time;
                    }
                    else
                    {//drop it
                        gripEnt->e_ThinkFunc = thinkF_G_RunObject;
                        gripEnt->nextthink = level.time + FRAMETIME;
                        gripEnt->s.pos.trType = TR_GRAVITY;
                        VectorCopy( gripEnt->currentOrigin, gripEnt->s.pos.trBase );
                        gripEnt->s.pos.trTime = level.time;
                    }
                }
            }
            self->s.loopSound = 0;
            self->client->ps.forceGripEntityNum = ENTITYNUM_NONE;
        }
        if ( self->client->ps.torsoAnim == BOTH_FORCEGRIP_HOLD )
        {
            NPC_SetAnim( self, SETANIM_BOTH, BOTH_FORCEGRIP_RELEASE, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD );
        }
        break;
 

i hope this can help some coder more expert than me. :)

 

Edit little idea: someone testing this :

 
else
                {
                    gripEnt->s.eFlags &= ~EF_FORCE_GRIPPED;
                    if ( gripEnt->s.eType == ET_MISSILE )
                    {//continue normal movement
                        if ( gripEnt->s.weapon == WP_THERMAL ||  gripEnt->s.weapon == WP_BLASTER_PISTOL ||
                            gripEnt->s.weapon == WP_BRYAR_PISTOL  || gripEnt->s.weapon == WP_FLECHETTE ||
                           gripEnt->s.weapon == WP_DEMP2 || gripEnt->s.weapon == WP_BOWCASTER || 
                          gripEnt->s.weapon == WP_REPEATER ||
                          gripEnt->s.weapon == WP_CONCUSSION || gripEnt->s.weapon == WP_TRIP_MINE ||
                          gripEnt->s.weapon == WP_ROCKET_LAUNCHER || gripEnt->s.weapon == WP_DET_PACK
                      )
                        {
                            gripEnt->s.pos.trType = TR_INTERPOLATE;
                        }
                        else
                        {
                            gripEnt->s.pos.trType = TR_LINEAR;//FIXME: what about gravity-effected projectiles?
                        }
                        VectorCopy( gripEnt->currentOrigin, gripEnt->s.pos.trBase );
                        gripEnt->s.pos.trTime = level.time;
                    }
                    else
                    {//drop it
                        gripEnt->e_ThinkFunc = thinkF_G_RunObject;
                        gripEnt->nextthink = level.time + FRAMETIME;
                        gripEnt->s.pos.trType = TR_GRAVITY;
                        VectorCopy( gripEnt->currentOrigin, gripEnt->s.pos.trBase );
                        gripEnt->s.pos.trTime = level.time;
                    }
                }
            }
            self->s.loopSound = 0;
            self->client->ps.forceGripEntityNum = ENTITYNUM_NONE;
        }
        if ( self->client->ps.torsoAnim == BOTH_FORCEGRIP_HOLD )
        {
            NPC_SetAnim( self, SETANIM_BOTH, BOTH_FORCEGRIP_RELEASE, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_HOLD );
        }
        break;
 
Posted

This should be changed and it is OP. Why Jaden is worst in this than every reborn_new that We were fightining against ?

Set timescale to something like .1 and it's considerably easier to dishback what they throw at you.  It's totally possible to reflect the projectiles back the same as the ai, it just takes the insane god-like reflexes of a Jedi to do so.  

JKG Developer

Posted

I like the idea of making a new force power out of it. And if something is not working correctly, it can be modified while still keeping the existing force powers unaffected.

Posted

I suppose it can be done with a new force power that act like force push , and can deflect all weapons projectiles back, not only concussion and rocket launcher, and when you use the power you activate a timescale value. i tryed to make something like that for an AOE power attack that slam all enemy around and activate timescale, but also if i setted timescale to 0.1 in my tests, it not works much fine because :

- g_timescale affected global time of entire game! so it slow not only the NPC but also the player.

- i have not found a way to turn out the timescale to 1 when power duration expired.

so, at the end, i simply make a power that create the shockwave of force and in the same time, activate the force speed power. if character have the force speed, it automatically activate also this force power on casting of this power so projectiles are sensible slow down.

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...