Forum

How to make an aim command?

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Postby GiffE » Sun Jun 13, 2010 11:34 pm

ThePlasticBling wrote:
Arkage wrote:I don't think your getting whats meant by frames. Think of frames as different models in the one model file. So if you model is called gun1.mdl and has shoot and reload frames, frames 0 to 5 could be shoot and frames 6 to 10 are idle. So if you have frames 10 to 15 firing while in iron sights and 16 to 20 is idile(don't use these as real frame numbers tho). So all you have to do is when shooting is check if .iron_sight is equal to 1. If it is use the iron sights frames (10 to 15 instead of 0 to 5). Same for the idle. Same can be applied to the reloading.

If you new to programing the best id suggest is to just read through Quake qc source, see how things are linked together don't worry if you don't get all of it, just keep trying out some tutorials here.

On the age thing I'm 18 if that means anything.


ok, now i have firing with the iron sights working, but when i fire with the iron sights, it is single shot, not automatic.


To be honest you are refusing to hear out anyone, we continue to say its better to put all the frames in 1 model and you ignore it.
Also you need to post the relevant code you are having a problem with. Find the portion of code which you think is causing a problem and post it so we can help.
GiffE
 
Posts: 170
Joined: Sun Oct 08, 2006 3:39 pm
Location: USA, CT

Postby ThePlasticBling » Mon Jun 14, 2010 1:07 am

GiffE wrote:
ThePlasticBling wrote:
Arkage wrote:I don't think your getting whats meant by frames. Think of frames as different models in the one model file. So if you model is called gun1.mdl and has shoot and reload frames, frames 0 to 5 could be shoot and frames 6 to 10 are idle. So if you have frames 10 to 15 firing while in iron sights and 16 to 20 is idile(don't use these as real frame numbers tho). So all you have to do is when shooting is check if .iron_sight is equal to 1. If it is use the iron sights frames (10 to 15 instead of 0 to 5). Same for the idle. Same can be applied to the reloading.

If you new to programing the best id suggest is to just read through Quake qc source, see how things are linked together don't worry if you don't get all of it, just keep trying out some tutorials here.

On the age thing I'm 18 if that means anything.


ok, now i have firing with the iron sights working, but when i fire with the iron sights, it is single shot, not automatic.


To be honest you are refusing to hear out anyone, we continue to say its better to put all the frames in 1 model and you ignore it.
Also you need to post the relevant code you are having a problem with. Find the portion of code which you think is causing a problem and post it so we can help.


sorry. here is my code:

Code: Select all
void () W_Aim =
{
   local float r;

   if (!W_CheckNoAmmo ())
   {
      return;
   }
   makevectors (self.v_angle);
   self.show_hostile = (time + WEAPON_SHOTGUN);
   if ((self.weapon == IT_AXE))
   {
      sound (self, CHAN_WEAPON, "weapons/ax1.wav", WEAPON_SHOTGUN, ATTN_NORM);
      r = random ();
      if ((r < 0.25))
      {
         player_axe1 ();
      }
      else
      {
         if ((r < 0.5))
         {
            player_axeb1 ();
         }
         else
         {
            if ((r < 0.75))
            {
               player_axec1 ();
            }
            else
            {
               player_axed1 ();
            }
         }
      }
      self.attack_finished = (time + 0.5);
   }
   else
   {
      if ((self.weapon == IT_SHOTGUN))
      {
         player_shot1 ();
         if ((self.magazine_wep_1 == MSG_BROADCAST))
         {
            self.weaponmodel = "progs/v_shot_rel.mdl";
            player_shot1 ();
            sound (self, CHAN_WEAPON, "weapons/shotrel.wav", WEAPON_SHOTGUN, ATTN_NORM);
            centerprint (self, "Reloading USP .45: 8 Bullets");
            self.attack_finished = (time + 1.5);
            self.magazine_wep_1 = WEAPON_BIG;
         }
         else
         {
            self.weaponmodel = "progs/shotaim.mdl";
            W_FireShotgun ();
            self.attack_finished = (time + 0.25);
            self.magazine_wep_1 = (self.magazine_wep_1 - WEAPON_SHOTGUN);
         }
      }
      else
      {
         if ((self.weapon == IT_SUPER_SHOTGUN))
         {
            player_shot1 ();
            if ((self.magazine_wep_2 == MSG_BROADCAST))
            {
               self.weaponmodel = "progs/v_shot2_rel.mdl";
               player_shot1 ();
               centerprint (self, "Reloading M3 Shotgun: 8 Shells");
               self.attack_finished = (time + 1.5);
               self.magazine_wep_2 = WEAPON_BIG;
            }
            else
            {
               self.weaponmodel = "progs/shot2aim.mdl";
               W_FireSuperShotgun ();
               self.attack_finished = (time + WEAPON_SHOTGUN);
               self.magazine_wep_2 = (self.magazine_wep_2 - WEAPON_SHOTGUN);
            }
         }
         else
         {
            if ((self.weapon == IT_NAILGUN))
            {
               if ((self.magazine_wep_3 == MSG_BROADCAST))
               {
                  self.weaponmodel = "progs/v_nail_rel.mdl";
                  player_shot1 ();
                  sound (self, CHAN_WEAPON, "weapons/uzi_rel.wav", WEAPON_SHOTGUN, ATTN_NORM);
                  centerprint (self, "Reloading M4A1: 30 Bullets");
                  self.attack_finished = (time + 1.8);
                  self.magazine_wep_3 = SVC_INTERMISSION;
               }
               else
               {
                  self.weaponmodel = "progs/nailaim.mdl";
                  W_FireMachineGun ();
                  self.attack_finished = (time + 0.08);
                  self.magazine_wep_3 = (self.magazine_wep_3 - WEAPON_SHOTGUN);
               }
            }
            else
            {
               if ((self.weapon == IT_SUPER_NAILGUN))
               {
                  if ((self.magazine_wep_4 == MSG_BROADCAST))
                  {
                     self.weaponmodel = "progs/v_nail2_rel.mdl";
                     player_shot1 ();
                     centerprint (self, "Reloading FN P90: 50 Bullets");
                     sound (self, CHAN_WEAPON, "weapons/venomrel.wav", WEAPON_SHOTGUN, ATTN_NORM);
                     self.attack_finished = (time + 2.5);
                     self.magazine_wep_4 = 50;
                  }
                  else
                  {
                     self.weaponmodel = "progs/nail2aim.mdl";
                     W_FireMinigun ();
                     self.attack_finished = (time + 0.1);
                     self.magazine_wep_4 = (self.magazine_wep_4 - WEAPON_SHOTGUN);
                  }
               }
               else
               {
                  if ((self.weapon == IT_GRENADE_LAUNCHER))
                  {
                     if ((self.magazine_wep_5 == MSG_BROADCAST))
                     {
                        self.weaponmodel = "progs/v_rock_rel.mdl";
                        player_shot1 ();
                        centerprint (self, "Grabbing a Grenade");
                        sound (self, CHAN_WEAPON, "weapons/shotrel.wav", WEAPON_SHOTGUN, ATTN_NORM);
                        self.attack_finished = (time + WEAPON_SHOTGUN);
                        self.magazine_wep_5 = 200;
                     }
                     else
                     {
                        self.weaponmodel = "progs/v_rock.mdl";
                        player_shot1 ();
                        W_FireGrenade ();
                        self.attack_finished = (time + WEAPON_SHOTGUN);
                        self.magazine_wep_5 = (self.magazine_wep_5 - WEAPON_SHOTGUN);
                     }
                  }
                  else
                  {
                     if ((self.weapon == IT_ROCKET_LAUNCHER))
                     {
                        if ((self.magazine_wep_6 == MSG_BROADCAST))
                        {
                           self.weaponmodel = "progs/missile.mdl";
                           player_shot1 ();
                           centerprint (self, "Reloading Rocket Launcher - one shot");
                           sound (self, CHAN_WEAPON, "weapons/shotrel.wav", WEAPON_SHOTGUN, ATTN_NORM);
                           self.attack_finished = (time + 1.5);
                           self.magazine_wep_6 = 200
                        }
                        else
                        {
                           self.weaponmodel = "progs/missile.mdl";
                           player_shot1 ();
                           W_FireRocket ();
                           self.attack_finished = (time + 1.5);
                           self.magazine_wep_6 = (self.magazine_wep_6 - WEAPON_SHOTGUN);
                        }
                     }
                     else
                     {
                        if ((self.weapon == IT_LIGHTNING))
                        {
                           if ((self.magazine_wep_7 == MSG_BROADCAST))
                           {
                              self.weaponmodel = "progs/v_light_rel.mdl";
                              player_shot1 ();
                              centerprint (self, "Reloading MP5: 30 Bullets");
                              sound (self, CHAN_WEAPON, "weapons/shotrel.wav", WEAPON_SHOTGUN, ATTN_NORM);
                              self.attack_finished = (time + WEAPON_ROCKET);
                              self.magazine_wep_7 = 20;
                           }
                           else
                           {
                              self.weaponmodel = "progs/v_light.mdl";
                              player_shot1 ();
                              LaunchPulse ();
                              self.attack_finished = (time + 0.2);
                              self.magazine_wep_7 = (self.magazine_wep_7 - WEAPON_SHOTGUN);
                           }
                        }
                     }
                  }
               }
            }
         }
      }
   }
};



then i have an impulse leading to that code. i think it might be because you cant have rapid impulses.
ThePlasticBling
 
Posts: 51
Joined: Fri Jun 04, 2010 10:18 pm

Postby Spike » Mon Jun 14, 2010 7:59 am

Where did you decompile that from?
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby frag.machine » Mon Jun 14, 2010 12:04 pm

He forgot the axe iron sight :lol:
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 ThePlasticBling » Mon Jun 14, 2010 6:51 pm

Spike wrote:Where did you decompile that from?


the reloading function
ThePlasticBling
 
Posts: 51
Joined: Fri Jun 04, 2010 10:18 pm

Postby GiffE » Mon Jun 14, 2010 9:26 pm

Code: Select all
(self.magazine_wep_2 == MSG_BROADCAST)

:lol:

I also love the complete disregard for frag.machine's explanation of how to do it.

If you want to have code you can UNDERSTAND... don't go and decompile it out of someone else's mod. :(
GiffE
 
Posts: 170
Joined: Sun Oct 08, 2006 3:39 pm
Location: USA, CT

Postby Feared » Mon Jun 14, 2010 11:00 pm

Plastic, it's obvious you don't know anything about programming or even the language you are talking about.
I'm not trying to be rude, but if you are going to program or do anything related you need to LEARN what you're trying to do.

Please don't take what I am saying as an insult, I am just trying to help you before you make a wreck and waste people's time.

Edit:
Here are a few sources to get you started, maybe.

http://www.youtube.com/user/GyroVorbis
http://cprogramminglanguage.net/
http://www.inside3d.com/qctut/
http://www.dummies.com/store/product/Be ... 22467.html
Last edited by Feared on Tue Jun 15, 2010 2:18 am, edited 1 time in total.
User avatar
Feared
 
Posts: 95
Joined: Fri Jun 11, 2010 11:58 pm
Location: Wylie, TX

Postby ThePlasticBling » Mon Jun 14, 2010 11:12 pm

GiffE wrote:
Code: Select all
(self.magazine_wep_2 == MSG_BROADCAST)

:lol:

I also love the complete disregard for frag.machine's explanation of how to do it.

If you want to have code you can UNDERSTAND... don't go and decompile it out of someone else's mod. :(


wait so i delete msg_broadcast or something?
ThePlasticBling
 
Posts: 51
Joined: Fri Jun 04, 2010 10:18 pm

Postby frag.machine » Tue Jun 15, 2010 1:45 am

ThePlasticBling wrote:
GiffE wrote:
Code: Select all
(self.magazine_wep_2 == MSG_BROADCAST)

:lol:

I also love the complete disregard for frag.machine's explanation of how to do it.

If you want to have code you can UNDERSTAND... don't go and decompile it out of someone else's mod. :(


wait so i delete msg_broadcast or something?


No. You just must go to learn QuakeC first.

One thing is when someone is learning how to program in QuakeC, and then stumbles in something not so obvious and need help from somebody more experient. There are nothing wrong on it, and in fact we are glad to help anyone in this case.

Other thing is what you're doing here: you decompiled someone else mod, and is trying to create something with Ctrl + C / Ctrl + V, messing up with large chunks of code without a real clue about what are you doing. Not surprisingly, things just don't work. And you are expecting us to solve this, while you don't even try to follow any of our advices. You're not doing better than a monkey banging a keyboard this way. (BTW, there's an urban legend that says Microsoft created Windows this way, and that would explain why Windows Vista took so long and smells so badly).

Once again: stop. Go learn how to program. Then go learn QuakeC. Then, after you acquire knowledge enough to understand what are you doing and to understand the instructions people are giving to you, feel free to come back and ask your questions. But is more likely that you'll figure things out by yourself then.

Either way, good luck.
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 Karall » Sun Feb 13, 2011 10:37 pm

I will borrow this thread a bit :D
So i used whoevers code to make iron sights work (it was on the first page too lazy to check who it was). I reworked the code a tiny bit becouse as he said it was untested. I do understand who the code and it components work although i cant actully seem to get it to work. Ive made an animtion for my model namen "V_PISTOL_IRON" that contains 2 frames, ones with the stationary postinion and the other one in aim down sights mode. When i type "impulse 123" in console nothing happens. What am I doing wrong? Also please disregard spelling errors and lousy explaining as its late at night and im tired as a moose.
Karall
 
Posts: 128
Joined: Thu Jul 15, 2010 5:23 pm

Postby Karall » Sat Feb 19, 2011 7:32 pm

Bump!
Karall
 
Posts: 128
Joined: Thu Jul 15, 2010 5:23 pm

Postby Karall » Sun Feb 27, 2011 4:22 pm

Rebump, I really need help on this.
Karall
 
Posts: 128
Joined: Thu Jul 15, 2010 5:23 pm

Postby Ranger366 » Sun Feb 27, 2011 5:43 pm

Karall wrote:Rebump, I really need help on this.


Help yourself, understand the game logic - learn QC!
We are very busy with our own stuff, cannot always help you!
I know it can be hard at the beginning, but i never asked here if someone could code stuff for me, because i had to learn it by myself.

take the time and understand the game logic, after that you will never need help, you will figure it out by yourself.
User avatar
Ranger366
 
Posts: 203
Joined: Thu Mar 18, 2010 5:51 pm

Postby Karall » Sun Feb 27, 2011 6:41 pm

I do understand the game logic. I know that you guys are busy. The problem is i just don't know whats wrong. I think its the animation on my model. I made an animation named the same as the weapon frame float. But it does'nt work, i dont get why. So i thought maybe someone knew what i was doing wrong.
Karall
 
Posts: 128
Joined: Thu Jul 15, 2010 5:23 pm

Postby Ranger366 » Mon Feb 28, 2011 5:57 am

Karall wrote:I do understand the game logic. I know that you guys are busy. The problem is i just don't know whats wrong. I think its the animation on my model. I made an animation named the same as the weapon frame float. But it does'nt work, i dont get why. So i thought maybe someone knew what i was doing wrong.


You dont need to use those crappy weaponfloats to add new weapons, you can use .floats instead.
Sounds abit strange, but so i handled all my weapons in the past. Had no problems with that. I just checked in WeaponFrame and SetCurrentAmmo if the wpnstate value is 1 or 2. had to reserve one >parm< slot in client.qc though, so the selection stays after levelchange.
I dont had the time to mess around with the weaponfloats.
User avatar
Ranger366
 
Posts: 203
Joined: Thu Mar 18, 2010 5:51 pm

PreviousNext

Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest