Inside3D!
     

How to make an aim command?
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
GiffE



Joined: 08 Oct 2006
Posts: 141
Location: USA, CT

PostPosted: Sun Jun 13, 2010 11:34 pm    Post subject: Reply with quote

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.
_________________
http://www.giffe-bin.net/
Back to top
View user's profile Send private message Visit poster's website
ThePlasticBling



Joined: 04 Jun 2010
Posts: 30

PostPosted: Mon Jun 14, 2010 1:07 am    Post subject: Reply with quote

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:
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.
Back to top
View user's profile Send private message
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Mon Jun 14, 2010 7:59 am    Post subject: Reply with quote

Where did you decompile that from?
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
frag.machine



Joined: 25 Nov 2006
Posts: 728

PostPosted: Mon Jun 14, 2010 12:04 pm    Post subject: Reply with quote

He forgot the axe iron sight Laughing
_________________
frag.machine - Q2K4 Project
http://fragmachine.quakedev.com/
Back to top
View user's profile Send private message Visit poster's website
ThePlasticBling



Joined: 04 Jun 2010
Posts: 30

PostPosted: Mon Jun 14, 2010 6:51 pm    Post subject: Reply with quote

Spike wrote:
Where did you decompile that from?


the reloading function
Back to top
View user's profile Send private message
GiffE



Joined: 08 Oct 2006
Posts: 141
Location: USA, CT

PostPosted: Mon Jun 14, 2010 9:26 pm    Post subject: Reply with quote

Code:
(self.magazine_wep_2 == MSG_BROADCAST)

Laughing

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. Sad
_________________
http://www.giffe-bin.net/
Back to top
View user's profile Send private message Visit poster's website
Feared



Joined: 11 Jun 2010
Posts: 17

PostPosted: Mon Jun 14, 2010 11:00 pm    Post subject: Reply with quote

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/Beginning-Programming-For-Dummies-4th-Edition.productCd-0470088702,navId-322467.html


Last edited by Feared on Tue Jun 15, 2010 2:18 am; edited 1 time in total
Back to top
View user's profile Send private message
ThePlasticBling



Joined: 04 Jun 2010
Posts: 30

PostPosted: Mon Jun 14, 2010 11:12 pm    Post subject: Reply with quote

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

Laughing

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. Sad


wait so i delete msg_broadcast or something?
Back to top
View user's profile Send private message
frag.machine



Joined: 25 Nov 2006
Posts: 728

PostPosted: Tue Jun 15, 2010 1:45 am    Post subject: Reply with quote

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

Laughing

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. Sad


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.
_________________
frag.machine - Q2K4 Project
http://fragmachine.quakedev.com/
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group