Forum

RL Kickback

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

RL Kickback

Postby redrum » Fri Sep 28, 2007 11:29 pm

I'm trying (unsucessfully) to get the players view to kick up a bit after launching a rocket.
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
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby Entar » Sat Sep 29, 2007 5:53 am

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.
User avatar
Entar
 
Posts: 439
Joined: Fri Nov 05, 2004 7:27 pm
Location: At my computer

Postby Sajt » Sat Sep 29, 2007 8:10 am

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

Postby redrum » Sat Sep 29, 2007 7:22 pm

Doesn't work, maybe b/c i'm using QW?
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby Sajt » Sat Sep 29, 2007 7:28 pm

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

Postby Orion » Sat Sep 29, 2007 7:38 pm

In W_FireRocket(), you'll find stuff like this:

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.
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby redrum » Sat Sep 29, 2007 7:41 pm

okey doke
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby redrum » Sat Sep 29, 2007 9:42 pm

SVC_BIGKICK doesn't seem to do anything,
I guess it's one of those QW things.
I'll figure something out. Thanks anyway. :)
Welcome to the Overlook Hotel: The-Overlook-Hotel.game-server.cc
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby Orion » Sun Sep 30, 2007 3:23 pm

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.
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby Sajt » Sun Sep 30, 2007 5:02 pm

particle() doesn't make the difference...

it's the other things... like QW's insane compression of nails...
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

Postby Orion » Sun Sep 30, 2007 5:38 pm

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:

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.
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby redrum » Mon Oct 01, 2007 1:47 am

If I wanted to add punchangle to QW.
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
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby Orion » Mon Oct 01, 2007 2:06 am

In W_FireRocket(), replace the SVC_SMALLKICK stuff by this:

Code: Select all
self.punchangle_x = -10;


But it might not work in QW...
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby redrum » Mon Oct 01, 2007 2:36 am

Yeah, I already had that part.
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
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Postby redrum » Mon Oct 01, 2007 9:06 pm

In combat.qc there is some code that makes the target move from the splash damage of a rocket or grenade:

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
User avatar
redrum
 
Posts: 410
Joined: Wed Mar 28, 2007 11:35 pm
Location: Long Island, New York

Next

Return to QuakeC Programming

Who is online

Users browsing this forum: Bing [Bot] and 1 guest