Brownjor10 Posted July 19, 2016 Posted July 19, 2016 Hi, I'm making an actual flamethrower based off the code from boba fett, but whenever I try to shoot it, the flame shoots backwards through the back of the gun, but it still seems to damage people close to me in front. Here is what I have. Anyone know what I can do to reverse the flame? #include "b_local.h"#include "../Ravl/CVec.h"#include "../cgame/cg_local.h" void WP_FireFlameThrower(gentity_t *self);void WP_StopFlameThrower(gentity_t *self);void WP_StartFlameThrower(gentity_t *self);void WP_DoFlameThrower(gentity_t *self); #define WP_FLAMEDURATION 6000#define WP_FLAMETHROWRANGE 800#define WP_FLAMETHROWSIZE 80#define WP_FLAMETHROWDAMAGEMIN 3//10#define WP_FLAMETHROWDAMAGEMAX 10//40 extern cvar_t* g_bobaDebug;extern void CG_DrawEdge(vec3_t start, vec3_t end, int type); void WP_FireFlameThrower(gentity_t *ent){trace_t tr;vec3_t start, end, dir;CVec3 traceMins(ent->mins);CVec3 traceMaxs(ent->maxs);gentity_t* traceEnt = NULL;int damage = Q_irand(WP_FLAMETHROWDAMAGEMIN, WP_FLAMETHROWDAMAGEMAX); AngleVectors(ent->currentAngles, dir, 0, 0); dir[2] = 0.0f;VectorCopy(ent->currentOrigin, start);traceMins *= 0.5f;traceMaxs *= 0.5f;start[2] += 840.0f; G_SoundOnEnt(ent, CHAN_WEAPON, "sound/weapons/boba/bf_flame.mp3"); VectorMA(start, 150.0f, dir, end); if (g_bobaDebug->integer){CG_DrawEdge(start, end, EDGE_IMPACT_POSSIBLE);}gi.trace(&tr, start, ent->mins, ent->maxs, end, ent->s.number, MASK_SHOT, (EG2_Collision)0, 0); traceEnt = &g_entities[tr.entityNum];if (tr.entityNum < ENTITYNUM_WORLD && traceEnt->takedamage){G_Damage(traceEnt, ent, ent, dir, tr.endpos, damage, DAMAGE_NO_ARMOR | DAMAGE_NO_KNOCKBACK | DAMAGE_NO_HIT_LOC | DAMAGE_IGNORE_TEAM, MOD_LAVA, HL_NONE);if (traceEnt->health>0){// G_Knockdown( traceEnt, self, dir, Q_irand(200, 330), qfalse);G_Throw(traceEnt, dir, 30);}}}
swegmaster Posted July 19, 2016 Posted July 19, 2016 you're making a flamethrower weapon? sounds interesting, @@GPChannel could make a flametrooper with this
Asgarath83 Posted July 20, 2016 Posted July 20, 2016 I suggest you to check force how work force lightning effect orientation in cg_players.cpp you need to set the same thing on flamethrower efx code.search "palpatine" as search word in the file and you fill find what you need
Brownjor10 Posted July 23, 2016 Author Posted July 23, 2016 I was able to fix it. Turns out the stuff I had was only for the damage formula. I didn't have anything to say which direction the effect should go, so instead of banging my head against the desk since I'm not that great at coding, I just edited the effect to start and end opposite, making the flame effect do a 180 turn. So it's working now. Asgarath83 likes this
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