JediBantha Posted February 18, 2014 Posted February 18, 2014 Like the topic suggests, I'm trying to convert the Concussion Rifle into Force Destruction. For those of you that haven't played Dark Forces 2, Force Destruction is your own Force-fueled grenade, courtesy of the Dark Side. static void WP_FireConcussionAlt( gentity_t *ent ) {//a rail-gun-like beam int damage = weaponData[WP_CONCUSSION].altDamage, skip, traces = DISRUPTOR_ALT_TRACES; qboolean render_impact = qtrue; vec3_t start, end; vec3_t muzzle2, spot, dir; trace_t tr; gentity_t *traceEnt, *tent; float dist, shotDist, shotRange = 8192; qboolean hitDodged = qfalse; if (ent->s.number >= MAX_CLIENTS) { vec3_t angles; vectoangles(forwardVec, angles); angles[PITCH] += ( crandom() * (CONC_NPC_SPREAD+(6-ent->NPC->currentAim)*0.25f));//was 0.5f angles[YAW] += ( crandom() * (CONC_NPC_SPREAD+(6-ent->NPC->currentAim)*0.25f));//was 0.5f AngleVectors(angles, forwardVec, vrightVec, up); } //Shove us backwards for half a second VectorMA( ent->client->ps.velocity, -200, forwardVec, ent->client->ps.velocity ); ent->client->ps.groundEntityNum = ENTITYNUM_NONE; if ( (ent->client->ps.pm_flags&PMF_DUCKED) ) {//hunkered down ent->client->ps.pm_time = 100; } else { ent->client->ps.pm_time = 250; } ent->client->ps.pm_flags |= PMF_TIME_KNOCKBACK|PMF_TIME_NOFRICTION; //FIXME: only if on ground? So no "rocket jump"? Or: (see next FIXME) //FIXME: instead, set a forced ucmd backmove instead of this sliding VectorCopy( muzzle, muzzle2 ); // making a backup copy // The trace start will originate at the eye so we can ensure that it hits the crosshair. if ( ent->NPC ) { switch ( g_spskill->integer ) { case 0: damage = CONC_ALT_NPC_DAMAGE_EASY; break; case 1: damage = CONC_ALT_NPC_DAMAGE_MEDIUM; break; case 2: default: damage = CONC_ALT_NPC_DAMAGE_HARD; break; } } VectorCopy( muzzle, start ); WP_TraceSetStart( ent, start, vec3_origin, vec3_origin ); skip = ent->s.number; // 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; // } //Make it a little easier to hit guys at long range vec3_t shot_mins, shot_maxs; VectorSet( shot_mins, -1, -1, -1 ); VectorSet( shot_maxs, 1, 1, 1 ); for ( int i = 0; i < traces; i++ ) { VectorMA( start, shotRange, forwardVec, end ); //NOTE: if you want to be able to hit guys in emplaced guns, use "G2_COLLIDE, 10" instead of "G2_RETURNONHIT, 0" //alternately, if you end up hitting an emplaced_gun that has a sitter, just redo this one trace with the "G2_COLLIDE, 10" to see if we it the sitter //gi.trace( &tr, start, NULL, NULL, end, skip, MASK_SHOT, G2_COLLIDE, 10 );//G2_RETURNONHIT, 0 ); gi.trace( &tr, start, shot_mins, shot_maxs, end, skip, MASK_SHOT, G2_COLLIDE, 10 );//G2_RETURNONHIT, 0 ); if ( tr.surfaceFlags & SURF_NOIMPACT ) { render_impact = qfalse; } if ( tr.entityNum == ent->s.number ) { // should never happen, but basically we don't want to consider a hit to ourselves? // Get ready for an attempt to trace through another person VectorCopy( tr.endpos, muzzle2 ); VectorCopy( tr.endpos, start ); skip = tr.entityNum; #ifdef _DEBUG gi.Printf( "BAD! Concussion gun shot somehow traced back and hit the owner!\n" ); #endif continue; } // always render a shot beam, doing this the old way because I don't much feel like overriding the effect. //NOTE: let's just draw one beam at the end //tent = G_TempEntity( tr.endpos, EV_CONC_ALT_SHOT ); //tent->svFlags |= SVF_BROADCAST; //VectorCopy( muzzle2, tent->s.origin2 ); if ( tr.fraction >= 1.0f ) { // draw the beam but don't do anything else break; } traceEnt = &g_entities[tr.entityNum]; if ( traceEnt //&& traceEnt->NPC && ( traceEnt->s.weapon == WP_SABER || (traceEnt->client && (traceEnt->client->NPC_class == CLASS_BOBAFETT||traceEnt->client->NPC_class == CLASS_REBORN) ) ) ) {//FIXME: need a more reliable way to know we hit a jedi? hitDodged = Jedi_DodgeEvasion( traceEnt, ent, &tr, HL_NONE ); //acts like we didn't even hit him } if ( !hitDodged ) { if ( render_impact ) { if (( tr.entityNum < ENTITYNUM_WORLD && traceEnt->takedamage ) || !Q_stricmp( traceEnt->classname, "misc_model_breakable" ) || traceEnt->s.eType == ET_MOVER ) { // Create a simple impact type mark that doesn't last long in the world G_PlayEffect( G_EffectIndex( "concussion/alt_hit" ), tr.endpos, tr.plane.normal ); if ( traceEnt->client && LogAccuracyHit( traceEnt, ent )) {//NOTE: hitting multiple ents can still get you over 100% accuracy ent->client->ps.persistant[PERS_ACCURACY_HITS]++; } int hitLoc = G_GetHitLocFromTrace( &tr, MOD_CONC_ALT ); qboolean noKnockBack = (traceEnt->flags&FL_NO_KNOCKBACK);//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 ); //do knockback and knockdown manually if ( traceEnt->client ) {//only if we hit a client vec3_t pushDir; VectorCopy( forwardVec, pushDir ); if ( pushDir[2] < 0.2f ) { pushDir[2] = 0.2f; }//hmm, re-normalize? nah... //if ( traceEnt->NPC || Q_irand(0,g_spskill->integer+1) ) { if ( !noKnockBack ) {//knock-backable G_Throw( traceEnt, pushDir, 200 ); if ( traceEnt->client->NPC_class == CLASS_ROCKETTROOPER ) { traceEnt->client->ps.pm_time = Q_irand( 1500, 3000 ); } } if ( traceEnt->health > 0 ) {//alive if ( G_HasKnockdownAnims( traceEnt ) ) {//knock-downable G_Knockdown( traceEnt, ent, pushDir, 400, qtrue ); } } } } if ( traceEnt->s.eType == ET_MOVER ) {//stop the traces on any mover break; } } else { // we only make this mark on things that can't break or move tent = G_TempEntity( tr.endpos, EV_CONC_ALT_MISS ); tent->svFlags |= SVF_BROADCAST; VectorCopy( tr.plane.normal, tent->pos1 ); break; // hit solid, but doesn't take damage, so stop the shot...we _could_ allow it to shoot through walls, might be cool? } } else // not rendering impact, must be a skybox or other similar thing? { break; // don't try anymore traces } } // Get ready for an attempt to trace through another person VectorCopy( tr.endpos, muzzle2 ); VectorCopy( tr.endpos, start ); skip = tr.entityNum; hitDodged = qfalse; } //just draw one beam all the way to the end tent = G_TempEntity( tr.endpos, EV_CONC_ALT_SHOT ); tent->svFlags |= SVF_BROADCAST; VectorCopy( muzzle, tent->s.origin2 ); // now go along the trail and make sight events VectorSubtract( tr.endpos, muzzle, dir ); shotDist = VectorNormalize( dir ); //FIXME: if shoot *really* close to someone, the alert could be way out of their FOV for ( dist = 0; dist < shotDist; dist += 64 ) { //FIXME: on a really long shot, this could make a LOT of alerts in one frame... VectorMA( muzzle, dist, dir, spot ); AddSightEvent( ent, spot, 256, AEL_DISCOVERED, 50 ); //FIXME: creates *way* too many effects, make it one effect somehow? G_PlayEffect( G_EffectIndex( "concussion/alt_ring" ), spot, forwardVec ); } //FIXME: spawn a temp ent that continuously spawns sight alerts here? And 1 sound alert to draw their attention? VectorMA( start, shotDist-4, forwardVec, spot ); AddSightEvent( ent, spot, 256, AEL_DISCOVERED, 50 ); G_PlayEffect( G_EffectIndex( "concussion/altmuzzle_flash" ), muzzle, forwardVec ); } static void WP_FireConcussion( gentity_t *ent ) {//a fast rocket-like projectile vec3_t start; int damage = weaponData[WP_CONCUSSION].damage; float vel = CONC_VELOCITY; if (ent->s.number >= MAX_CLIENTS) { vec3_t angles; vectoangles(forwardVec, angles); angles[PITCH] += ( crandom() * (CONC_NPC_SPREAD+(6-ent->NPC->currentAim)*0.25f));//was 0.5f angles[YAW] += ( crandom() * (CONC_NPC_SPREAD+(6-ent->NPC->currentAim)*0.25f));//was 0.5f AngleVectors(angles, forwardVec, vrightVec, up); } //hold us still for a bit ent->client->ps.pm_time = 300; ent->client->ps.pm_flags |= PMF_TIME_KNOCKBACK; //add viewkick if ( ent->s.number < MAX_CLIENTS//player only && !cg.renderingThirdPerson )//gives an advantage to being in 3rd person, but would look silly otherwise {//kick the view back cg.kick_angles[PITCH] = Q_flrand( -10, -15 ); cg.kick_time = level.time; } 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 gentity_t *missile = CreateMissile( start, forwardVec, vel, 10000, ent, qfalse ); missile->classname = "conc_proj"; missile->s.weapon = WP_CONCUSSION; missile->mass = 10; // Do the damages if ( ent->s.number != 0 ) { if ( g_spskill->integer == 0 ) { damage = CONC_NPC_DAMAGE_EASY; } else if ( g_spskill->integer == 1 ) { damage = CONC_NPC_DAMAGE_NORMAL; } else { damage = CONC_NPC_DAMAGE_HARD; } } // Make it easier to hit things VectorSet( missile->maxs, ROCKET_SIZE, ROCKET_SIZE, ROCKET_SIZE ); VectorScale( missile->maxs, -1, missile->mins ); missile->damage = damage; missile->dflags = DAMAGE_EXTRA_KNOCKBACK; missile->methodOfDeath = MOD_CONC; missile->splashMethodOfDeath = MOD_CONC; missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER; missile->splashDamage = weaponData[WP_CONCUSSION].splashDamage; missile->splashRadius = weaponData[WP_CONCUSSION].splashRadius; // we don't want it to ever bounce missile->bounceCount = 0; } void WP_Concussion( gentity_t *ent, qboolean alt_fire ) { if(alt_fire) { WP_FireConcussionAlt(ent); } else { WP_FireConcussion(ent); } }My question is (as stated above), how would I convert this into a Force power?
Tempust85 Posted February 18, 2014 Posted February 18, 2014 I'd like to know this as well, would be very useful to for DF2 Mod.
Pande Posted February 18, 2014 Posted February 18, 2014 Omg, this code revealed to me how one shoves the player along the ground without having velocity stop them. //Shove us backwards for half a secondVectorMA( ent->client->ps.velocity, -200, forwardVec, ent->client->ps.velocity );ent->client->ps.groundEntityNum = ENTITYNUM_NONE;if ( (ent->client->ps.pm_flags&PMF_DUCKED) ){//hunkered downent->client->ps.pm_time = 100;}else{ent->client->ps.pm_time = 250;}ent->client->ps.pm_flags |= PMF_TIME_KNOCKBACK|PMF_TIME_NOFRICTION; I have been looking for how to do this for an entire week. Best of luck with your conversion btw! I am just so happy to have found this. therfiles and katanamaru like this
eezstreet Posted February 19, 2014 Posted February 19, 2014 Follow my force power tutorial, and for the behavior of the force power, use a function similar to the one in WP_FireConcussion. (p.s, use code tags instead of spoiler tags, they make the formatting easier and have syntax highlighting) z3filus, Angel Soul and Omicron like this
minilogoguy18 Posted February 19, 2014 Posted February 19, 2014 I was just going to mention that you wrote a force power tutorial, I'm pretty confident we can pull it off DT, just use the concussion as a base since that's nearly exactly how the power behaves in DF2. Tempust85 likes this
JediBantha Posted February 19, 2014 Author Posted February 19, 2014 This is SP, just so you know... At the moment, I'm having trouble with making it actually fire off a projectile.
Asgarath83 Posted February 22, 2014 Posted February 22, 2014 i have not again edited code for my mod because first i wanna config all SAB and NPCs. but i have replaced many shooter weapons of JA with elemental cinetic shot balls.So, for the starting: yu can remove the weapons model by many way: yu can edit weapons.dat and item.dat for changing the wordlmodel and the weapon model path. the replacing model is an empty md3, just need to have the tag_weapon and the tag_flash.so the shoot by fired by the hands. yu can change animation in animation.CFG using force unleashed animation force push for repliacing the shooting animation of concussion rifle. the problem is that change anim also for other twohanded shoot weapons.but i think by code yu can custom the animation of c rifle.For effect yu need just to change by effect editor. the problem more bad is the physic of your weapon \ force power. i canot help for that.
JediBantha Posted March 3, 2014 Author Posted March 3, 2014 I can't seem to make it fire in the direction that I'm facing, or make it play it's actual missile FX, instead of the FX for the flechette rifle's main rounds.
JediBantha Posted March 23, 2014 Author Posted March 23, 2014 void ForceDestruction( gentity_t *ent ) {//a fast rocket-like projectile vec3_t start; vec3_t end, forward; trace_t tr; gentity_t *traceEnt; traceEnt = &g_entities[tr.entityNum]; int damage = forceDestructionDamage[ent->client->ps.forcePowerLevel[FP_DESTRUCTION]]; int radius = forceDestructionRadius[ent->client->ps.forcePowerLevel[FP_DESTRUCTION]]; float vel = 2300; VectorCopy( ent->client->renderInfo.handLPoint, start ); WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall gentity_t *missile = CreateMissile( start, forwardVec, vel, 10000, ent, qfalse ); missile->classname = "destruct_proj"; missile->mass = 10; // Make it easier to hit things VectorSet( missile->maxs, ROCKET_SIZE, ROCKET_SIZE, ROCKET_SIZE ); VectorScale( missile->maxs, -1, missile->mins ); missile->damage = damage; missile->dflags = DAMAGE_EXTRA_KNOCKBACK; missile->methodOfDeath = MOD_FORCE_DESTRUCTION; missile->splashMethodOfDeath = MOD_FORCE_DESTRUCTION; missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER; missile->splashDamage = damage = floor((float)damage * 0.5f); missile->splashRadius = radius; // we don't want it to ever bounce missile->bounceCount = 0; int modPowerLevel = -1; if (traceEnt->client) { modPowerLevel = WP_AbsorbConversion(traceEnt, traceEnt->client->ps.forcePowerLevel[FP_ABSORB], ent, FP_DESTRUCTION, ent->client->ps.forcePowerLevel[FP_DESTRUCTION], 1); } if (modPowerLevel != -1) { if ( !modPowerLevel ) { damage = 0; } else if ( modPowerLevel == 1 ) { damage = floor((float)damage/4.0f); } else if ( modPowerLevel == 2 ) { damage = floor((float)damage/2.0f); } else if ( modPowerLevel == 3 ) { damage = floor((float)damage/1.0f); } else if ( modPowerLevel == 4 ) { damage = floor((float)damage/0.5f); } else if ( modPowerLevel == 5 ) { damage = floor((float)damage/0.25f); } else if ( modPowerLevel == 6 ) { damage = floor((float)damage/0.12f); } else if ( modPowerLevel == 7 ) { damage = floor((float)damage/0.06f); } else if ( modPowerLevel == 8 ) { damage = floor((float)damage/0.03f); } else if ( modPowerLevel > 8 ) { damage = floor((float)damage/0.01f); } } } void ForceDestructionShoot( gentity_t *self ) {//a fast rocket-like projectile vec3_t start; vec3_t end, forward; trace_t tr; gentity_t *traceEnt; traceEnt = &g_entities[tr.entityNum]; if ( self->client->ps.forcePowerLevel[FP_DESTRUCTION] <= FORCE_LEVEL_2 && self->client->ps.forcePower < 80 || self->client->ps.forcePowerLevel[FP_DESTRUCTION] > FORCE_LEVEL_2 && self->client->ps.forcePower < 40 || !WP_ForcePowerUsable( self, FP_DESTRUCTION, 0 ) ) { return; } if ( self->client->ps.forcePowerLevel[FP_DESTRUCTION] <= FORCE_LEVEL_2 ) { WP_ForcePowerStart( self, FP_DESTRUCTION, 80 ); NPC_SetAnim( self, SETANIM_TORSO, BOTH_FORCEPUSH, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_RESTART|SETANIM_FLAG_HOLD ); G_SoundOnEnt( self, CHAN_BODY, "sound/weapons/force/forcedestruct_01.wav" ); ForceDestruction( self ); } if ( self->client->ps.forcePowerLevel[FP_DESTRUCTION] > FORCE_LEVEL_2 ) { WP_ForcePowerStart( self, FP_DESTRUCTION, 40 ); NPC_SetAnim( self, SETANIM_TORSO, BOTH_FORCEPUSH, SETANIM_FLAG_OVERRIDE|SETANIM_FLAG_RESTART|SETANIM_FLAG_HOLD ); G_SoundOnEnt( self, CHAN_BODY, "sound/weapons/force/forcedestruct_01.wav" ); ForceDestruction( self ); } if (self->client->ps.forcePowersActive & (1 << FP_PROTECT) ) { WP_ForcePowerStop( self, FP_PROTECT ); } if (self->client->ps.forcePowersActive & (1 << FP_ABSORB) ) { WP_ForcePowerStop( self, FP_ABSORB ); } self->client->ps.weaponTime = 1000; } This is all I have so far. I probably won't be able to finish this due to my looking for a career at the moment. BTW @@eezstreet , there's nothing in the tutorial that helps me translate the concussion rifle to an actual Force power. I've scrolled through it once or twice before starting on this.
eezstreet Posted March 23, 2014 Posted March 23, 2014 It's not supposed to. It only tells you how to make a force power; it doesn't go into specifics of behavior and looks. If I did, we would be seeing a lot of mods with powers similar to the one in the tutorial. Also, it's impossible to tell what exactly everyone wants, so giving a reasonable explanation as to how to do it as opposed to posting walls of code would be most effective.
JediBantha Posted March 23, 2014 Author Posted March 23, 2014 Well I don't exactly know how to do it myself, seeing as this is from wp_concussion instead of wp_saber; It tends to give me error messages whenever I just paste the Conc Rilfe's code into wp_saber, as it's a weapon code. [EDIT]: it's impossible to tell what exactly everyone wants, so giving a reasonable explanation as to how to do it as opposed to posting walls of code would be most effective. For those of you that haven't played Dark Forces 2, Force Destruction is your own Force-fueled grenade, courtesy of the Dark Side. @@eezstreet : Pay attention at 2:45
eezstreet Posted March 25, 2014 Posted March 25, 2014 Like I said. Not the majority of people are going to want the same thing. However, if you gave me some sort of idea as to what you're doing precisely and which specific error messages you're getting, I would be happy to help you out. If you feel lots of people are going to use it, feel free to post your code/solution for it. Others will be grateful, and/or find some bugs and maybe suggest how to fix them. The reason I am taking this approach is that you may learn something about coding, and that kind of information is great if there's no pros around to help.
JediBantha Posted March 25, 2014 Author Posted March 25, 2014 Well, basically what I'm doing is trying to fire a sort of "Concussion" round from the player's left hand, as you would do with level 2 Force Lightning. Problem is, when I try to "fire" it off, I get the following results: (In-Game results)#1: Never plays the FX for the thrown projectile (Invisible shot)#2: Never fires in the direction I'm facing#3: Never plays the FX for the explosion, just the damage and the radius (Compiler results)2>..\..\..\code\game\wp_saber.cpp(13615): warning C4101: 'forward' : unreferenced local variable2>..\..\..\code\game\wp_saber.cpp(13615): warning C4101: 'end' : unreferenced local variable2>..\..\..\code\game\wp_saber.cpp(13704): warning C4101: 'forward' : unreferenced local variable2>..\..\..\code\game\wp_saber.cpp(13704): warning C4101: 'end' : unreferenced local variable2>..\..\..\code\game\wp_saber.cpp(13703): warning C4101: 'start' : unreferenced local variable As for what everyone else wants... I'm not worried about it; They can take the final build of the code and change it about as they please.
JediBantha Posted March 27, 2014 Author Posted March 27, 2014 Here's what I'm trying to do: I took the code for wp_concussion's primary fire and just pasted it into wp_saber as ForceDestruction, and I've never done a weapon-force conversion before. So, take WP_ATST_MAIN for example; When you type "give weapon_atst_main" in the console, you're able to fire the weapon no problem, but it has no weapon MODEL, as it was designed for the AT-ST model itself. How would I convert that into a Force power without it randomly spewing shots all over the map, instead of firing precisely in the direction that I'm facing, and without having to use Mouse1 to "mark" the target?
Asgarath83 Posted March 27, 2014 Posted March 27, 2014 mmm... it's possible to do without that's kind of code hacking...Basically:First step: make a new weapon copying WP_CONCUSSION parameters of the code. a weapon called, WP_FPDESTRUCTION of somtehing like it.Second Step: when your weapon is working... Yu need to go to weapon.dat and add for the new weapon, as weaponmodel"models/weapons2/noweap/noweap.md3" So the weapon is invisible. player shoot the projectile by the hand.Third step: make efxand sound for the weapoin.fourth step: set , like DEMP2, the classdamage for the weapon, it's a force explosion, so the weapopn can damage the living enemy, but not the droid, you can past the code of DEMP2 and set as 0 the damage for droid classes.Fifth step: Now your new "weapon" shoul be working. yu need to specify into the code that the shoot animation is not BOTH_ATTACK3 but BOTH_FORCE_LIGHTNING_START... or something like that.at the end, you can set altdamage, splashdamage, damage etc, with your edited weapon.dat...and for left hand?When you understand how working that's and when it's working fine... you can try to reply the function as a New force power. I suggest you to copy the Force Push power and making the damafge, efx, and sound setting as the new concussion weapon.yu need to set another Force effect, like the force lightning.last part: then force concussion works, yu can deleting the new weapon hacked concussion. Is maked just to make the correct code function. i think it's better if yu first learn to make a weapon like what you want and after, copy the weapon function in a new force powrer. So, yu can learn how to make that step by step. Before making a shooting concussion projectile force power... yu need to deep understand how work the shoot of weapons. It's hard to do. weapons act in different way by force power. Force power not shot exactly... "projectiles" like the weapons. They affected the NPC with various behavour and health alterarion. You need to create the function of shooting projectile forforce powers, too and to adeep understand that function. It's not an easy or a short work.
JediBantha Posted June 5, 2014 Author Posted June 5, 2014 Alright I've tried everything with this power... Like I said in another post, I have absolutely no idea what I have to do with it. If anyone's played MB2's "Full Authentic" mode, you might have seen Destruction used in a match; That's what I'm trying to do with it.
Sithani Posted June 5, 2014 Posted June 5, 2014 There's a NPC called cultist_destroyer, maybe you could dig around this guy.
Asgarath83 Posted June 6, 2014 Posted June 6, 2014 There's a NPC called cultist_destroyer, maybe you could dig around this guy. Mmm, NPC cultist destroyer is strongly hardcoded in JKA. he dead and remove his body, killing every where in the proximity.i think is possibile use his code for the force destruction death effect on the victims.But at this point, because it's a weapon, i think is better to use the MOD_SNIPER setted on cg_weapons.cpp.
JediBantha Posted June 17, 2014 Author Posted June 17, 2014 void ForceDestructionShoot( gentity_t *self ) { trace_t tr; vec3_t start; vec3_t end, forward; gentity_t *traceEnt; if ( self->health <= 0 ) { return; } if ( !self->s.number && cg.zoomMode ) {//can't force lightning when zoomed in return; } AngleVectors( self->client->ps.viewangles, forward, NULL, NULL ); VectorNormalize( forward ); VectorMA( self->client->renderInfo.handLPoint, NULL, forward, end ); ForceDestructionMissile( self ); } static void ForceDestructionMissile( gentity_t *ent ) {//a fast rocket-like projectile vec3_t start; gentity_t *traceEnt; int damage = forceDestructionDamage[ent->client->ps.forcePowerLevel[FP_DESTRUCTION]]; float vel = 3000; WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall gentity_t *missile = CreateMissile( start, forwardVec, vel, 10000, ent, qfalse ); missile->classname = "destruct_proj"; missile->s.weapon = WP_DESTRUCTION; missile->mass = 10; // Make it easier to hit things VectorSet( missile->maxs, ROCKET_SIZE, ROCKET_SIZE, ROCKET_SIZE ); VectorScale( missile->maxs, -1, missile->mins ); missile->damage = damage; missile->dflags = DAMAGE_EXTRA_KNOCKBACK|DAMAGE_HEAVY_WEAP_CLASS; missile->methodOfDeath = MOD_FORCE_DESTRUCTION; missile->splashMethodOfDeath = MOD_FORCE_DESTRUCTION; missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER; missile->splashDamage = floor((float)damage * 0.75f); missile->splashRadius = forceDestructionRadius[ent->client->ps.forcePowerLevel[FP_DESTRUCTION]]; // we don't want it to ever bounce missile->bounceCount = 0; if ( traceEnt && traceEnt->client && traceEnt->client->ps.powerups[PW_GALAK_SHIELD] ) { //has shield up missile->damage = 0; missile->splashDamage = 0; } int modPowerLevel = -1; if (traceEnt->client) { modPowerLevel = WP_AbsorbConversion(traceEnt, traceEnt->client->ps.forcePowerLevel[FP_ABSORB], ent, FP_DESTRUCTION, ent->client->ps.forcePowerLevel[FP_DESTRUCTION], 1); } if (modPowerLevel != -1) { if ( !modPowerLevel ) { damage = 0; } else if ( modPowerLevel == 1 ) { damage = floor((float)damage/4.0f); } else if ( modPowerLevel == 2 ) { damage = floor((float)damage/2.0f); } else if ( modPowerLevel == 3 ) { damage = floor((float)damage/1.0f); } else if ( modPowerLevel == 4 ) { damage = floor((float)damage/0.5f); } else if ( modPowerLevel == 5 ) { damage = floor((float)damage/0.25f); } else if ( modPowerLevel == 6 ) { damage = floor((float)damage/0.12f); } else if ( modPowerLevel == 7 ) { damage = floor((float)damage/0.06f); } else if ( modPowerLevel == 8 ) { damage = floor((float)damage/0.03f); } else if ( modPowerLevel > 8 ) { damage = floor((float)damage/0.01f); } } }I get the warning "error C3861: 'ForceDestructionMissile': identifier not found" whenever I put "ForceDestructionMissile" into "ForceDestructionShoot" . Is there anything I need to add to it, or do I need to edit another line of code?
Asgarath83 Posted June 18, 2014 Posted June 18, 2014 Try to look into the game/g_missile.cpp code. i think you not definietd the "missile" shoot of the concussion, movement dinamycs, axis of movement etc ect.
JediBantha Posted June 21, 2014 Author Posted June 21, 2014 Either I did something I shouldn't have, or one of the commands is specifically connected to the fire/alt-fire buttons.
Asgarath83 Posted June 22, 2014 Posted June 22, 2014 Mmm, in my code working i got same error similar. The syntaxis is correct? should be that. Try to ask on the coders chat about your problem. they help me really a lot!
JediBantha Posted July 27, 2014 Author Posted July 27, 2014 Well, I tried everything... @@eezstreetI was stressed at the time I was working on this particular power, so I couldn't really give a clear answer as to what I was trying to do here. How do you suppose a Fireball would work on JKA's engine? Obviously I can't do a simple copy/paste with the Concussion Rifle onto w_saber.cpp, as it would go in a different direction than the one I'm facing as soon as I, or another NPC would press the "Attack" button.
Asgarath83 Posted July 27, 2014 Posted July 27, 2014 i have changed efx of the blaster pistol with fireballs , for working, working, you want to create a weapon for shoot by the saber a projectile, right? O.oI think you watch the think by the wrong way, if there is a SABER EDIT, it's very difficult and hard, if you want to make a new shooting weapons by the saber, simply copy the concussion code into the new weapons and set as model a saber model. on the code, the hard part is to set that the tag_flash of the weapons spawn not only the missile, but also a saber blade. O.o mmm you need to make an hybrid weapon, that shoot like a shooting weapons, but have appereance of a saber.
JediBantha Posted July 27, 2014 Author Posted July 27, 2014 I'm not trying to make a saber edit at all; every usable force power is assigned to a file called "q_shared.h", and their effects are typed onto "wp_saber.cpp" and "g_combat.cpp".
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