JediBantha Posted August 13, 2014 Author Posted August 13, 2014 I gave it another look. Try this: static void ForceDestructionMissile( gentity_t *ent ) {//a fast rocket-like projectile vec3_t start; vec3_t dir; int damage = forceDestructionDamage[ent->client->ps.forcePowerLevel[FP_DESTRUCTION]]; float vel = 2800; VectorCopy( ent->client->renderInfo.handLPoint, start ); AngleVectors( ent->client->ps.viewangles, dir, NULL, NULL); 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, dir, 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 ( ent && ent->client && ent->client->ps.powerups[PW_GALAK_SHIELD] ) { //has shield up missile->damage = 0; missile->splashDamage = 0; } */ // NOTENOTE: the above doesn't actually make any sense int modPowerLevel = -1; if ( missile->splashDamage || missile->damage ) { modPowerLevel = WP_AbsorbConversion(ent, ent->client->ps.forcePowerLevel[FP_ABSORB], ent, FP_DESTRUCTION, ent->client->ps.forcePowerLevel[FP_DESTRUCTION], 1); } if (modPowerLevel != -1) { if ( !modPowerLevel ) { missile->damage = 0; missile->splashDamage = 0; } else if ( modPowerLevel == 1 ) { missile->damage = floor((float)damage/4.0f); missile->splashDamage = floor((float)damage/4.0f); } else if ( modPowerLevel == 2 ) { missile->damage = floor((float)damage/2.0f); missile->splashDamage = floor((float)damage/2.0f); } else if ( modPowerLevel == 3 ) { missile->damage = floor((float)damage/1.0f); missile->splashDamage = floor((float)damage/1.0f); } else if ( modPowerLevel == 4 ) { missile->damage = floor((float)damage/0.5f); missile->splashDamage = floor((float)damage/0.5f); } else if ( modPowerLevel == 5 ) { missile->damage = floor((float)damage/0.25f); missile->splashDamage = floor((float)damage/0.25f); } else if ( modPowerLevel == 6 ) { missile->damage = floor((float)damage/0.12f); missile->splashDamage = floor((float)damage/0.12f); } else if ( modPowerLevel == 7 ) { missile->damage = floor((float)damage/0.06f); missile->splashDamage = floor((float)damage/0.06f); } else if ( modPowerLevel == 8 ) { missile->damage = floor((float)damage/0.03f); missile->splashDamage = floor((float)damage/0.03f); } else if ( modPowerLevel > 8 ) { missile->damage = floor((float)damage/0.01f); missile->splashDamage = floor((float)damage/0.01f); } } } void ForceDestructionShoot( gentity_t *self ) { if ( self->health <= 0 ) { return; } if ( !self->s.number && cg.zoomMode ) {//can't force lightning when zoomed in return; } ForceDestructionMissile( self ); } It fires exactly where your crosshairs are pointing towards, now all that's left is making the actual projectile appear. Asgarath83 likes this
Asgarath83 Posted August 13, 2014 Posted August 13, 2014 find on wp_saber.cpp "sound\weapons\force\lightning" and "force/lightning" for see the code lines about displaying of effects and sound of the force lightning. if you want to display effect like the blaster \ concussion shot, instead, watch on the FX_Concussion.cpp or FX_blaster.cpp. i think in that case is better a moving effect attacked to the damage pointer that not an "directionally area effect" like lightning or drain
JediBantha Posted August 13, 2014 Author Posted August 13, 2014 I tried that this morning... The FX for Destruction doesn't seem to wanna cooperate for some reason.
JediBantha Posted August 14, 2014 Author Posted August 14, 2014 @@eezstreetAny ideas for making the projectile appear with an FX? It's invisible to the player.
eezstreet Posted August 14, 2014 Posted August 14, 2014 Hi, sorry I was unable to reach you earlier, some personal stuff going on.For the client-side effect you'll need to add a weapons.dat entry for WP_DESTRUCTION, make sure it's ordered the same way in weapons.dat as it is in the enum (ie if it comes after WP_BOWCASTER, make sure the entry comes directly after WP_BOWCASTER in the file).For your own custom effect, you'll likely want to edit func_t funcs[] in g_weaponLoad.cpp to have your own new projectile effect. Should look something similar to this: { "destruction_func", FX_DestructionShot_Think } FX_DestructionShot_Think isn't an actual function, so you'll need to do something similar to what the Bryar pistol, Blaster rifle, etc do there. It should be extremely straightforward, the function looks something like this. Basically you'll want yours to look roughly identical, except changing the bottom part to match your needs (the Bryar uses a different effect, effects/bryar/npcShot.efx, as shown in the last check, for NPCs. Players in SP always use client number 0) Is your projectile actually doing its damage correctly? This is something I would like to know for sure
JediBantha Posted August 14, 2014 Author Posted August 14, 2014 Hi, sorry I was unable to reach you earlier, some personal stuff going on.For the client-side effect you'll need to add a weapons.dat entry for WP_DESTRUCTION, make sure it's ordered the same way in weapons.dat as it is in the enum (ie if it comes after WP_BOWCASTER, make sure the entry comes directly after WP_BOWCASTER in the file).For your own custom effect, you'll likely want to edit func_t funcs[] in g_weaponLoad.cpp to have your own new projectile effect. Should look something similar to this: { "destruction_func", FX_DestructionShot_Think } FX_DestructionShot_Think isn't an actual function, so you'll need to do something similar to what the Bryar pistol, Blaster rifle, etc do there. It should be extremely straightforward, the function looks something like this. Basically you'll want yours to look roughly identical, except changing the bottom part to match your needs (the Bryar uses a different effect, effects/bryar/npcShot.efx, as shown in the last check, for NPCs. Players in SP always use client number 0) Is your projectile actually doing its damage correctly? This is something I would like to know for sure It's cool man, I'm in no hurry. And yes, it is doing it's own damages properly; All it's missing is it's own projectile FX (ex: concussion/shot ).
eezstreet Posted August 14, 2014 Posted August 14, 2014 Then yup, that should about finish it off then. Let me know if you run into any more issues. I'd love to see the final product.
JediBantha Posted August 14, 2014 Author Posted August 14, 2014 None of the above seems to work either, and I already tried changing *ent to *self.
Asgarath83 Posted August 14, 2014 Posted August 14, 2014 I'm doing final releases, and it crashes whenever I press 'F' while I have Destruction selected. when i edited and customize sound and effect for the CLASSES of force power, i got same trouble when i got syntaxis error... mmm, no, are not syntaxis. the expression is correct: it's incompatibile with the previus part of the expressiom-for example: if the code is for the "self" , thje istruction too need to be focused on "self"example:self BLABLABLABLABLAifSelf->client->Npc_class == CLASS_ALORA blablabla <- this not crash. self BLABLABLABLABLABLAifclient->NPC_class == CLASS_ALORA blablabla <- the syntaxis is correct , building not make error,... but in game crashes when using the power with playermodel alora XD be careful. you need the expression and the setting is ever compatible with the declaration. EDIT: LOl sorry, i have not seen an entire page of discussion. :S
JediBantha Posted August 14, 2014 Author Posted August 14, 2014 @@Asgarath83It happens to the best of us, don't worry. @@eezstreetIs there anything specific that I need to add to the weapons.dat, or ForceDestructionMissile? Asgarath83 likes this
JediBantha Posted August 15, 2014 Author Posted August 15, 2014 @@eezstreet(Update) Tried some stuff with weapons.dat, and it once again has a lighting effect as it flies by... The problem is either in the code or the efx.
eezstreet Posted August 15, 2014 Posted August 15, 2014 Lighting effect? Could you perhaps clarify this a bit further?
JediBantha Posted August 15, 2014 Author Posted August 15, 2014 Sorry, glow effect, like a sort of light that a blaster bolt usually emanates.
Asgarath83 Posted August 15, 2014 Posted August 15, 2014 Maybe is the shader that's is setted as glow? can you past here the efx. file of muzzle flash, projectile and impact of destruction?i am not a good coder, but i know a lot the effects.
JediBantha Posted August 15, 2014 Author Posted August 15, 2014 I put these two under WP_DESTRUCTION for the lighting effect. It wouldn't make sense not to, in my opinion. missileLight 125missileLightColor 1.0 0.25 0.25 As for the .efx, I simply renamed mp/small_fire_red.
JediBantha Posted August 16, 2014 Author Posted August 16, 2014 @@eezstreet@@Asgarath83 Didn't change anything, so it has to be in either the code, or the .efx
Asgarath83 Posted August 16, 2014 Posted August 16, 2014 well, i not know the code, but i know the efx files. can you post the contain of Efx file of the projectile in spoiler?
JediBantha Posted August 16, 2014 Author Posted August 16, 2014 @@Asgarath83 destruction.efx repeatDelay 300 Particle { spawnFlags evenDistribution rgbComponentInterpolation life 500 800 delay 0 200 origin 0 -2 -2 0 2 2 rotation 87 93 rotationDelta -4 4 velocity 0 -4 -4 10 4 4 gravity 0 50 rgb { start 0.6235 0.4118 0.01569 0.502 0 0 } alpha { end 0 parm 80 flags linear nonlinear } size { start 4 5 end 12 parm 50 flags linear clamp } shaders [ gfx/effects/fire2 gfx/effects/fire3 gfx/effects/fire4 ] } Particle { flags useAlpha spawnFlags evenDistribution rgbComponentInterpolation life 500 1400 delay 0 200 cullrange 250 origin 5 -3 -3 10 3 3 velocity 5 0 0 10 0 0 acceleration 0 -10 -10 0 10 10 gravity 20 30 rgb { start 0.502 0 0 end 1 0 0 flags linear } alpha { end 0 parm 80 flags linear nonlinear } size { start 10 12 end 3 4 } shaders [ gfx/effects/alpha_smoke gfx/effects/alpha_smoke2 ] } Particle { name Copy of Unnamed Particle 1 spawnFlags evenDistribution count 0 2 life 500 900 delay 0 200 cullrange 200 origin 10 -10 -10 20 10 10 velocity 15 0 0 25 0 0 acceleration 0 -5 -5 0 5 5 gravity 30 50 rgb { start 1 0 0 end 0 0 0 parm 70 flags linear nonlinear } alpha { end 0 parm 2 5 flags wave } size { start 0.6 1.5 end 1 2 } shaders [ gfx/effects/whiteFlare ] } Particle { name Extra spawnFlags evenDistribution rgbComponentInterpolation count 1 2 life 500 800 delay 0 200 cullrange 500 origin 0 -2 -2 0 2 2 rotation 87 93 rotationDelta -4 4 velocity 0 -4 -4 10 4 4 gravity 0 50 rgb { start 1 1 0 0.502 0 0 end 0.502 0 0 flags linear } alpha { end 0 parm 80 flags linear nonlinear } size { start 4 5 end 12 parm 50 flags linear clamp } shaders [ gfx/effects/fire2 gfx/effects/fire3 gfx/effects/fire4 ] }
Asgarath83 Posted August 16, 2014 Posted August 16, 2014 Okay, i checked on effectEd and as effect is okay, also nice, well done. i checked on my mod replacing the concussion projectile with the your and shooting and i not see glowing effects or strange flashes.so there are 3 possibility:- a code issue about projectile fx parameters of lighting- remove the weapon.dat vale about missilelight (that's set the intensity of lighting of missile)- check the shaders of the fire, and other sprites, for avoid there are some "glow" paremeter on the primitives.mmmm strange idea but... i have a suspect: if the your projectiles is shooted by saber and destruction is builded on the saber code, (i have understand that, maybe i am wrong) well, for same strange issue of the code, is possible the concussion effect are taking the glowing of the lightsabers blade O.o
JediBantha Posted August 16, 2014 Author Posted August 16, 2014 @@Asgarath83@@eezstreet My guess is that there's probably something I need to add in the shader files, or the code itself, for the projectile to actually play it's .efx file.
Asgarath83 Posted August 17, 2014 Posted August 17, 2014 I think i had misunderstood what you want. you want the effect glowing and emit lighting right?in that case, there are two ways.fast way: you can apply a flash light primitive into the efect of the projectile with same amount of duration second of the fire, and the corrispondent color and intensity. you can set color, intensity and duration of the flash light,. you can make a light that follow the effect because the light itself is part of effect.i not use much this method because you need to be really carefyulll. dynamic light can be... evil for eyes and stress the sight. otherwise, that's kind of effect are dangerous for people witih epilessy and photosensibility. i am very sensible to that0s thing and also if i make spetactular effect for my mod, i avoid ever to use the Light primitives.the other way is to make other 3 sprites for the shader: example 1 copy and rename: gfx/effects/fire2gfx/effects/fire3gfx/effects/fire4in gfx/effects/firedestruction2 \ 3 \ 4 2 make a shader file for the new sprites that setting the glow and and light color and lightintensity for the new fire effect, you can use the paramter of the lightsaber shader + the lightning effect and color shader paramter of a shader of a sky with sun. 3: edit the efx of projectile for replace fire2,3,4 with firedestruction2,3 and 4.now you have your glowing effect.
JediBantha Posted August 19, 2014 Author Posted August 19, 2014 @@Asgarath83@@eezstreet I tried changing the .efx and .dat files, but no luck; The problem has to be in the code itself, but I don't know where to look.
Asgarath83 Posted August 19, 2014 Posted August 19, 2014 exactly where is the problem? can you post a screenshot about force projectile taken by ingame SP? So we can see what's is wrong and help you better.If is a code issue, i cannot help you. the shader \ lighting \ glowing code of the weapons it's not my knowledge field.
JediBantha Posted August 19, 2014 Author Posted August 19, 2014 @@Asgarath83 Imagine the Concussion Rifle without Concussion/Shot.efx; That's what's happening with Destruction right now. Everything else is working fine, which means there's something else I'm missing in the actual SP code.
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