RL Kickback
Moderator: InsideQC Admins
36 posts
• Page 1 of 3 • 1, 2, 3
RL Kickback
I'm trying (unsucessfully) to get the players view to kick up a bit after launching a rocket.
I've tried this:
I commented out the bits that wouldn't compile.
Am I in the right ballpark?
I've tried this:
- Code: Select all
if ((self.weapon == IT_ROCKET_LAUNCHER) && (self.button0) ) //kick
{
v_up = v_up * 1.33;
self.mangle_z = self.mangle_z * 1.33;
self.angles_z = self.angles_z * 1.33;
//self.idealpitch = self.idealpitch * 1.33;
//self.v_angle = self.v_angle * 1.33;
}
I commented out the bits that wouldn't compile.
Am I in the right ballpark?
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
-

redrum - Posts: 410
- Joined: Wed Mar 28, 2007 11:35 pm
- Location: Long Island, New York
I believe there's a specific thing for this, called punchangle iirc, which you set and the view is "punched" up by that far, and moved back to normal over a short time.
-

Entar - Posts: 439
- Joined: Fri Nov 05, 2004 7:27 pm
- Location: At my computer
Yeah, just set player.punchangle_x to -8 or somtehing (if not, set it to positive 8 ). It takes a while for it to ease back to normal though, so have fun...
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
- Sajt
- Posts: 1215
- Joined: Sat Oct 16, 2004 3:39 am
I think QW might have turned it into a SVC message. I don't think it was even implemented though? I'm not sure, I've never really used QW.
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
- Sajt
- Posts: 1215
- Joined: Sat Oct 16, 2004 3:39 am
In W_FireRocket(), you'll find stuff like this:
Change the SVC to SVC_BIGKICK, but there's only smallkick and bigkick (used by super shotgun). If you want a bigger kickback, you should do stuff that I don't even know.
- Code: Select all
msg_entity = self;
WriteByte (MSG_ONE, SVC_SMALLKICK);
Change the SVC to SVC_BIGKICK, but there's only smallkick and bigkick (used by super shotgun). If you want a bigger kickback, you should do stuff that I don't even know.
-

Orion - Posts: 476
- Joined: Fri Jan 12, 2007 6:32 pm
- Location: Brazil
Not at all.
Another note, QW was made to play online with a better ping than NQ, not to make custom effects, kickbacks, etc. NQ is better in custom effects, because it has particle() to create a particle of a specified color, punchangle_x, _y, and _z for the kickback, etc. That's why a "stock" NQ engine is really bad to play online, Darkplaces or FTEQW is better to play NQ online, but I prefer QW to play deathmatch, clan arena, or team fortress.
And I prefer NQ to practice against my bots, or play single-player.
So, if QW have particle() and other custom effect stuff, it'll be just like an NQ client, an awful unplayable laggy client. That was for lag's sake, that's why the shotgun smoke puffs don't spread in QW too. The tracelines spreads, but the smoke puffs not.
Another note, QW was made to play online with a better ping than NQ, not to make custom effects, kickbacks, etc. NQ is better in custom effects, because it has particle() to create a particle of a specified color, punchangle_x, _y, and _z for the kickback, etc. That's why a "stock" NQ engine is really bad to play online, Darkplaces or FTEQW is better to play NQ online, but I prefer QW to play deathmatch, clan arena, or team fortress.
And I prefer NQ to practice against my bots, or play single-player.
So, if QW have particle() and other custom effect stuff, it'll be just like an NQ client, an awful unplayable laggy client. That was for lag's sake, that's why the shotgun smoke puffs don't spread in QW too. The tracelines spreads, but the smoke puffs not.
-

Orion - Posts: 476
- Joined: Fri Jan 12, 2007 6:32 pm
- Location: Brazil
I take a look at an NQ engine source code.
When I saw the TE_GUNSHOT effects, it's just a particle effect, if I call in QC a line like this:
It will be EXACTLY like a shotgun smoke puff, so particle() in NQ reduces many lines of code!
The spikes hitting wall is the same particle stuff, but with randomized ricochet sounds.
Take a look at the sound stuff in the engine code:
the (rand() % 5) is just like (random() > 0.05) right? And notice that it spawns a particle effect with the same color as a gunshot, but with 10 instead of 20.
An explosion can be used as a particle effects, if you use 255 in the counter, the particles will be just like an explosion, 75 is the original explosion color, but no sound will be played.
When I saw the TE_GUNSHOT effects, it's just a particle effect, if I call in QC a line like this:
- Code: Select all
particle (trace_endpos, '0 0 0', 0, 20);
It will be EXACTLY like a shotgun smoke puff, so particle() in NQ reduces many lines of code!
The spikes hitting wall is the same particle stuff, but with randomized ricochet sounds.
Take a look at the sound stuff in the engine code:
- Code: Select all
case TE_SPIKE: // spike hitting wall
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
#ifdef GLTEST
Test_Spawn (pos);
#else
R_RunParticleEffect (pos, vec3_origin, 0, 10);
#endif
if ( rand() % 5 )
S_StartSound (-1, 0, cl_sfx_tink1, pos, 1, 1);
else
{
rnd = rand() & 3;
if (rnd == 1)
S_StartSound (-1, 0, cl_sfx_ric1, pos, 1, 1);
else if (rnd == 2)
S_StartSound (-1, 0, cl_sfx_ric2, pos, 1, 1);
else
S_StartSound (-1, 0, cl_sfx_ric3, pos, 1, 1);
}
break;
the (rand() % 5) is just like (random() > 0.05) right? And notice that it spawns a particle effect with the same color as a gunshot, but with 10 instead of 20.
An explosion can be used as a particle effects, if you use 255 in the counter, the particles will be just like an explosion, 75 is the original explosion color, but no sound will be played.
-

Orion - Posts: 476
- Joined: Fri Jan 12, 2007 6:32 pm
- Location: Brazil
If I wanted to add punchangle to QW.
I see that I'd have to add:
to defs.qc.
What else would I need to do?
I see that I'd have to add:
- Code: Select all
.vector punchangle;
to defs.qc.
What else would I need to do?
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
-

redrum - Posts: 410
- Joined: Wed Mar 28, 2007 11:35 pm
- Location: Long Island, New York
In W_FireRocket(), replace the SVC_SMALLKICK stuff by this:
But it might not work in QW...
- Code: Select all
self.punchangle_x = -10;
But it might not work in QW...
-

Orion - Posts: 476
- Joined: Fri Jan 12, 2007 6:32 pm
- Location: Brazil
Yeah, I already had that part.
Do I have to call a function like:
anywhere?
Do I have to call a function like:
- Code: Select all
void() Punchangle =
{
anywhere?
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
-

redrum - Posts: 410
- Joined: Wed Mar 28, 2007 11:35 pm
- Location: Long Island, New York
In combat.qc there is some code that makes the target move from the splash damage of a rocket or grenade:
So I added this code:
The only problem is the direction in which the player (attacker)moves varies. Is there a way to make the player move backwards?
- Code: Select all
targ.velocity = targ.velocity + dir * damage * 9;
So I added this code:
- Code: Select all
attacker.velocity = attacker.velocity - dir * 200;
The only problem is the direction in which the player (attacker)moves varies. Is there a way to make the player move backwards?
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
-

redrum - Posts: 410
- Joined: Wed Mar 28, 2007 11:35 pm
- Location: Long Island, New York
36 posts
• Page 1 of 3 • 1, 2, 3
Who is online
Users browsing this forum: No registered users and 1 guest