Forum

Charge Shot

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Postby frag.machine » Wed Jun 30, 2010 12:42 am

Yeah, just carefully reading the original QC code helps a lot to understand how thing works. ;)
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2090
Joined: Sat Nov 25, 2006 1:49 pm

Postby Ghost_Fang » Wed Jun 30, 2010 12:59 am

yea, it helps immensely, but there are still thing i need explained (3 or 4 times) before i understand it.

While on that subject I would like to thank everyone on inside3d who have put up with me so far and my noobish and sometimes annoying questions. You know who you are. Thanks
Ghost_Fang
 
Posts: 336
Joined: Thu Nov 12, 2009 4:37 am

Postby Mexicouger » Wed Jun 30, 2010 1:02 am

Since we are on the subject of thanking people, I would also like to thank Inside3d For helping me as well. You guys never got mad, Or anything of that sort. You simply explained the solution and Helped me along. I hope to be able to help people soon, Just like Ghostfang is being able to do.

In some topics, I expected a flame war, And Nope. It never happened :)
So thank you as well
User avatar
Mexicouger
 
Posts: 514
Joined: Sat May 01, 2010 10:12 pm

Postby Ghost_Fang » Wed Jun 30, 2010 1:39 am

Mexicouger wrote:Since we are on the subject of thanking people, I would also like to thank Inside3d For helping me as well. You guys never got mad, Or anything of that sort.


Wish i could say the same lol. Some people got so frustrated they wrote the code and gave it to me themselves just to shut me up. Well at least it seemed that way. *cough* c0burn *cough* jk. But seriously, he wrote the pipebomb code for l4q and i thank him very much and i will NOT take credit for it.

In the words of Baker, I am not entirely a "help vampire" anymore.
Ghost_Fang
 
Posts: 336
Joined: Thu Nov 12, 2009 4:37 am

Postby Downsider » Wed Jun 30, 2010 5:47 am

I rage when I read what Mexicouger and Ghost_Fang and co. write.
User avatar
Downsider
 
Posts: 621
Joined: Tue Sep 16, 2008 1:35 am

Postby Mexicouger » Wed Jun 30, 2010 5:58 am

Downsider wrote:I rage when I read what Mexicouger and Ghost_Fang and co. write.


Were we too soft for ya? :wink:

EDIT:

I actually need some help with the Charge Code That RedRum wrote.

I made a test function, And it does charge and All, But when I release the Button, nothing Happens. if I press the Button again, it just says my percentage of charge and Doesn't shoot. The shooting function isn't being called. Here is my code:

Code: Select all
/*
============
W_WeaponFrame

Called every frame so impulse events can be handled as well as possible
============
*/
void() W_WeaponFrame =
{
        if (!self.button0)
                self.semi = 0;            
   if (time < self.attack_finished)
      return;

   ImpulseCommands ();
   
// check for attack
   if (self.button0)
   {
      if (self.weapon == IT_SHOTGUN)
      {
   if (self.charge < 10)
         {
         self.charge = self.charge + 1;
   centerprint (self, "10%\n");
         }

      if (self.charge >= 10)
      if (self.charge < 20)
         {
         self.charge = self.charge + 1;
      centerprint (self, "20%\n");
         }

      if (self.charge >= 20)
      if (self.charge < 30)
         {
         self.charge = self.charge + 1;
      centerprint (self, "30%\n");
         }

      if (self.charge >= 30)
         {
         self.charge = self.charge + 1;
      centerprint (self, "40%\n");
         }
      
   if (self.charge < 10 && !self.button0)
      if (self.charge >= 1 && !self.button0)           // no rapid fire
         {
         self.charge = 0;
              }
        if (self.charge >= 10 && !(self.button0))         // you released the button
         {
         player_missle56();
         W_FireBlaster();   
         self.attack_finished = time + 0.12;
         }
      }
      else
      {
      SuperDamageSound ();
      W_Attack ();
      }
   }
};


The Actual fire Function doesn't matter because it's not being called. Gotta get this out of the way.

This function Isn't being called, Or it's not passing inspection.

Code: Select all
 if (self.charge >= 10 && !(self.button0))         // you released the button
         {
         player_missle56();
         W_FireBlaster();   
         self.attack_finished = time + 0.12;
         }
User avatar
Mexicouger
 
Posts: 514
Joined: Sat May 01, 2010 10:12 pm

Postby Ghost_Fang » Wed Jun 30, 2010 6:11 am

Downsider wrote:I rage when I read what Mexicouger and Ghost_Fang and co. write.


Why?
Ghost_Fang
 
Posts: 336
Joined: Thu Nov 12, 2009 4:37 am

Postby redrum » Wed Jun 30, 2010 11:48 pm

I'm not 100% on this but try:
Code: Select all
void() W_WeaponFrame =
{
   if (!self.button0)
           self.semi = 0; 
         
   if (time < self.attack_finished)
      return;

      ImpulseCommands ();  // check for attack
   
   if (self.button0)
   {
     if (self.weapon == IT_SHOTGUN)
     {
      if (self.charge < 10)
         {
         self.charge = self.charge + 1;
         centerprint (self, "10%\n");
         }

      if (self.charge >= 10)
      if (self.charge < 20)
         {
         self.charge = self.charge + 1;
         centerprint (self, "20%\n");
         }

      if (self.charge >= 20)
      if (self.charge < 30)
         {
         self.charge = self.charge + 1;
         centerprint (self, "30%\n");
         }

      if (self.charge >= 30)
         {
         self.charge = self.charge + 1;
         centerprint (self, "40%\n");
         }
     
      if (self.charge < 10 && !self.button0)
      if (self.charge >= 1 && !self.button0)           // no rapid fire
         {
         self.charge = 0;
         }

        if (self.charge >= 10 && !(self.button0))         // you released the button
         {
         player_missle56();
         W_FireBlaster();   
         self.attack_finished = time + 0.12;
         }
      }
   }
      else
      {
      SuperDamageSound ();
      W_Attack ();
      }
   }
};

Me thinks you were missing a bracket towards the bottom of your code. Also, what's this code do:
Code: Select all
   if (!self.button0)
           self.semi = 0;

and this:
Code: Select all
         player_missle56();
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 Mexicouger » Thu Jul 01, 2010 1:13 am

Gah! I am still having troubles. That code you gave me makes it rapidly shoot(And I had to add another bracket)

So I did a Bit of Bracket editing and this is What I got:

Code: Select all
/*
============
W_WeaponFrame

Called every frame so impulse events can be handled as well as possible
============
*/
void() W_WeaponFrame =
{
   if (!self.button0)
           self.semi = 0;
         
   if (time < self.attack_finished)
      return;

      ImpulseCommands ();  // check for attack
   
   //if (self.button0) // Whats funny Is That You don't even need to Press the Button!
  // {
     if (self.weapon == IT_SHOTGUN)
     {
      if (self.charge < 10)
         {
         self.charge = self.charge + 1;
         //nterprint (self, "10%\n");
         }

      if (self.charge >= 10)
      if (self.charge < 20)
         {
         self.charge = self.charge + 1;
         //nterprint (self, "20%\n");
         }

      if (self.charge >= 20)
      if (self.charge < 30)
         {
         self.charge = self.charge + 1;
         //nterprint (self, "30%\n");
         }
      if (self.charge >= 30)
      if (self.charge < 40)
         {
         self.charge = self.charge + 1;
         //centerprint (self, "40%\n");
         }
   if (self.charge >= 40)
      if (self.charge < 50)
         {
         self.charge = self.charge + 1;
         //centerprint (self, "50%\n");
         }
   if (self.charge >= 50)
      if (self.charge < 60)
         {
         self.charge = self.charge + 1;
         //centerprint (self, "60%\n");
         }   
   if (self.charge >= 60)
      if (self.charge < 70)
         {
         self.charge = self.charge + 1;
         //centerprint (self, "70%\n");
         }
   if (self.charge >= 70)
         {
         self.charge = self.charge + 1;
         //centerprint (self, "DONE!!\n");
         }
     
      if (self.charge < 10 && !self.button0)
      if (self.charge >= 1 && !self.button0)           // no rapid fire
         {
         self.charge = 0;
         }

        if (!self.button0 && self.charge >= 10)         // you released the button
         {
   if (self.mballtoggle == 1)
      return;
   if (!self.semi)
         {
   W_FireBlaster();   
   self.charge = 0;
      player_missle56();
   self.semi = 0;
      self.attack_finished = time + 0.12;
         }
         }
   }
   else if (self.mballtoggle == 1 && self.button0)   //If your holding down the attack button and in ball mode
   {
      if (self.mbombs >= 0)
      {
      fire_morphbomb();
      self.attack_finished = time + 0.6;
      }
      else
      {}
   }
   if (self.button0)
   {
      SuperDamageSound ();
      W_Attack ();
}
};

EDIT: Yay! I finally got the code Working just how I want it! I updated the code for future useage
User avatar
Mexicouger
 
Posts: 514
Joined: Sat May 01, 2010 10:12 pm

Postby redrum » Thu Jul 01, 2010 6:00 pm

Sweet!
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

Previous

Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest