Mark_Girland Posted January 14, 2022 Posted January 14, 2022 Hello everyone, need the help of people who know the code OpenJK. The fact is that I would like to know if it is possible to make it so that after pushing the boss of the NPC (Desann or Luke) my player was doing a backflip, not a knockdown. That is, I used the code Jedi_stopknockdown. As I understand it, this line of code is responsible for the backflip of other Jedi NPCs (mostly bosses). When the force of the push is applied to them, they do not fall to the ground but jump back. Therefore, they cannot be shot down. And I would really like my player to have the same ability, so that he does not fall in a knockdown, but does a back flip or jump. This very line is present in several files: WP_SABER.cpp: vec3_t pushdir; if (pulls) { VectorSubtract(pusher->currentOrigin, self->currentOrigin, pushdir); } more { VectorSubtract(self->currentOrigin, pusher->currentOrigin, pushdir); } //FIXME: Sometimes do this for some NPC force users too! if (boba_stop knockdown(himself, pusher, pusher, qfalse)) {//He can do a backflip instead of being knocked down .; } otherwise, if (Jedi_StopKnockdown(self, pusher, pusher)) {//They can do a backflip instead of being knocked down .; } G_CheckLedgeDive(self, 72, pushdir, qtrue, qtrue); if (!PM_SpinningSaberAnim(self->client->ps.legsanim) && !PM_FlippingAnim(self->client->ps.legsanim) && !PM_RollingAnim(self->client->ps.legsanim) && !PM_InKnockDown(&self->client->ps)) { int KNOCKANIM = BOTH_KNOCKDOWN1;//default knockdown if (pusher->client->NPC_CLASS == CLASS_DESANN && self->client->NPC_CLASS != CLASS_LUKE && self->client->NPC_CLASS !=CLASS_KYLE) {//desann always knocks you down, unless you're Luke Strong knockdown = q is true; } if (!self->s.Number && !Strong knockdown && ((!pull && (self->client->ps.Power Level[FP_PUSH] > POWER LEVEL 1 || !g_spskill->integer)) || (pull && (self->client->ps.force level[FP_PULL] > FORCE LEVEL 1 || !g_spskill->integer)))) {//the player is knocked down only with a strong push ** if (self->s.weapons == WP_SABER) {// temporary HACKING: these are the only 2 pain animations that look good when holding a saber KNOCKANIM = PM_PickAnim(self, BOTH_PAIN2, BOTH_PAIN3); } more { KNOCKANIM = PM_PickAnim(self, BOTH_PAIN1, BOTH_PAIN18); } } otherwise, if (PM_CrouchAnim(self->client->ps.legsanim)) {//squatting knockdown Knockdown = BOTH KNOCKDOWNS 4; } more {//the usual old knockdown vec3_t plfwd, slats = { 0,self->client->ps.viewing angles[YAW],0 }; vec3_t sfwd, viewing angles = { 0,pusher->client->ps.viewing angles[YAW],0 }; Angular vectors(Planks, PLFWD, ZERO, ZERO); Angular vectors (SANGLES, SFWD, ZERO, ZERO); if (dot product (sfwd, pLFwd) > 0.2f) {//pushes it from behind //FIXME: Check if we are aiming below or above the waist? if (pulls) { Knockdown = BOTH KNOCKDOWNS 1; } more { Knockdown = BOTH KNOCKDOWNS 3; } } more {//pushing it from the front if (pull) { Knockdown = BOTH KNOCKDOWNS 3; } more { Knockdown = BOTH KNOCKDOWNS 1; } } } if (knockdown == BOTH_KNOCKDOWN1 && Strong knockdown) {//push *hard* Knockdown = BOTH_KNOCKDOWN2; } NPC_SETANIM(self, SETANIM_BOT, KNOCKANIM, SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD); if (self->s.number >= MAX_CLIENTS) {//randomize the time of receipt - but not for adding a component int; if (self->client->NPC_class == CLASS_BOBAFETT |/ self->client->NPC_class == CLASS_MANDALORIAN |/ self->client->NPC_class == CLASS_JANGO) { Addition time = Q_irand(-500, 0); } more { Addition time = Q_irand(-300, 300); } self->client->ps.legsAnimTimer += Add time; self->client->ps.torsoAnimTimer += Time of addition; } //more {//the player stays longer so that you have more time to decide to get up quickly if (PM_ForceUsingSaberAnim(self->client->ps.legsanim)) { self->client->ps.legsanim_timer += PLAYER_KNOCKDOWN_HOLD_EXTRA_TIME; self->client->ps.torsoanimtimer +=PLAYER_KNOCKDOWN_HOLD_EXTRA_TIME; } } // if (pusher->NPC && pusher-> enemy == Me) {//pushed pushed his enemy G_AddVoiceEvent(pusher, Q_irand(EV_GLOAT1, EV_GLOAT3), 3000); Pusher->NPC->Blocked phone call time = level.time + 3000; } } } self->forcePushTime = level.time + 600; // let the click effect last 600 ms } It is also available in AI_Jedi.cpp : qboolean Jedi_StopKnockdown(gentity_t* pickup, gentity_t* pusher, as const vec3_t pushDir) { if (self->s.number of <MAX_CLIENTS |/ !self->client) {//only NPCs return qfalse; } if (self->client->ps.forcepowerlevel[FP_LEVITATION] < FORCE_LEVEL_1) {//only forced users return qtrue; } if (self->client->Move type == MT_FLYSWIM) {//can't knock me down when I'm flying , return qtrue; } if ( self->NPC && (self->NPC->aiFlags&NPCAI_BOSS_CHARACTER) ) {//the boss is always out knockdown } else if (Q_irand(0, the RANK of CAPTAIN + 5) > I->NPC-> rank) {//the lower their rank, the greater the likelihood that they will fall returning qtrue; } To be honest, I am strong in the game code, but I would like to figure it out and do what I want. I really hope for your help. I hope you can help me
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now