Inside3D!
     

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



Joined: 04 Jun 2010
Posts: 30

PostPosted: Tue Jun 08, 2010 9:00 pm    Post subject: How to make an aim command? Reply with quote

hello can somebody please make a quick aim command for me. all i want it to do is switch to a different model (iron sights) when an impulse is typed and then make it so there will be a different aim model for each weapon. thanx!
Back to top
View user's profile Send private message
GiffE



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

PostPosted: Tue Jun 08, 2010 11:54 pm    Post subject: Reply with quote

Switch model? Shocked Why do that?... Just have an ironsight animation for the model, then have the impulse toggle the animation. Or if your in DP you could just re-origin the model on your screen.
_________________
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: Wed Jun 09, 2010 11:01 pm    Post subject: Reply with quote

GiffE wrote:
Switch model? Shocked Why do that?... Just have an ironsight animation for the model, then have the impulse toggle the animation. Or if your in DP you could just re-origin the model on your screen.


well the thing is that im a n00b and i dont know how to do that Confused
Back to top
View user's profile Send private message
frag.machine



Joined: 25 Nov 2006
Posts: 728

PostPosted: Thu Jun 10, 2010 1:02 pm    Post subject: Reply with quote

Well, unfortunately there's no "quick and easy" (at least not in the sense of something you can accomplish in 15 minutes) way to do so in Quake. The best way would be as GiffE said: add at least one frame to the desired weapon with the iron sight mode, and you can try something like that in weapons.qc:

*** WARNING: untested, I may have forgot something important! ***

Code:


.float iron_sight;
float IMPULSE_IRON_SIGHT = 123; // just an example

void() ImpulseCommands =
{
   if (self.impulse == IMPULSE_IRON_SIGHT)
   {
      self.iron_sight = 1 - (self.iron_sight & 1); // this will toggle the iron sight
   }
   (...)


And, for the specific weapon (let's say, the shotgun), you do like that:

Code:

float V_SHOT_IRON_SIGHT_FRAME = 321; // again, for example

void() W_SetCurrentAmmo =
{
   player_run ();      // get out of any weapon firing states

   self.items = self.items - ( self.items & (IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS) );
   
   if (self.weapon == IT_AXE)
   {
      self.currentammo = 0;
      self.weaponmodel = "progs/v_axe.mdl";
      self.weaponframe = 0;
   }
   else if (self.weapon == IT_SHOTGUN)
   {
      self.currentammo = self.ammo_shells;
      self.weaponmodel = "progs/v_shot.mdl";

                if (self.iron_sight == 1)
                {
          self.weaponframe = V_SHOT_IRON_SIGHT_FRAME;
                }
                else
                {
          self.weaponframe = 0;
                }

      self.items = self.items | IT_SHELLS;
   }

_________________
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: Thu Jun 10, 2010 7:09 pm    Post subject: Reply with quote

frag.machine wrote:
Well, unfortunately there's no "quick and easy" (at least not in the sense of something you can accomplish in 15 minutes) way to do so in Quake. The best way would be as GiffE said: add at least one frame to the desired weapon with the iron sight mode, and you can try something like that in weapons.qc:

*** WARNING: untested, I may have forgot something important! ***

Code:


.float iron_sight;
float IMPULSE_IRON_SIGHT = 123; // just an example

void() ImpulseCommands =
{
   if (self.impulse == IMPULSE_IRON_SIGHT)
   {
      self.iron_sight = 1 - (self.iron_sight & 1); // this will toggle the iron sight
   }
   (...)


And, for the specific weapon (let's say, the shotgun), you do like that:

Code:

float V_SHOT_IRON_SIGHT_FRAME = 321; // again, for example

void() W_SetCurrentAmmo =
{
   player_run ();      // get out of any weapon firing states

   self.items = self.items - ( self.items & (IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS) );
   
   if (self.weapon == IT_AXE)
   {
      self.currentammo = 0;
      self.weaponmodel = "progs/v_axe.mdl";
      self.weaponframe = 0;
   }
   else if (self.weapon == IT_SHOTGUN)
   {
      self.currentammo = self.ammo_shells;
      self.weaponmodel = "progs/v_shot.mdl";

                if (self.iron_sight == 1)
                {
          self.weaponframe = V_SHOT_IRON_SIGHT_FRAME;
                }
                else
                {
          self.weaponframe = 0;
                }

      self.items = self.items | IT_SHELLS;
   }


well i don't know where to put any of that stuff in weapons.qc Confused

i guess you can call me a major n00b
Back to top
View user's profile Send private message
Arkage



Joined: 19 Nov 2009
Posts: 27

PostPosted: Thu Jun 10, 2010 7:34 pm    Post subject: Reply with quote

Ctrl + f , then search for the function names.
Back to top
View user's profile Send private message
ThePlasticBling



Joined: 04 Jun 2010
Posts: 30

PostPosted: Thu Jun 10, 2010 8:02 pm    Post subject: Reply with quote

Arkage wrote:
Ctrl + f , then search for the function names.


idk i just wont add iron sights
Back to top
View user's profile Send private message
frag.machine



Joined: 25 Nov 2006
Posts: 728

PostPosted: Thu Jun 10, 2010 8:38 pm    Post subject: Reply with quote

ThePlasticBling wrote:
well i don't know where to put any of that stuff in weapons.qc Confused

i guess you can call me a major n00b


I guess you need first learn the basics before anything.

My suggestion is:

0) Don't give up.

1) Grab the original QuakeC code and learn how to edit and compile it. Pro tip: you don't need Visual Studio 2008 to do that Very Happy : Notepad++, UltraEdit or even the Windows notepad plus frikqcc is enough;

2) After that, learn how to run your just compiled progs.dat;

3) Learn a bit about QuakeC. Google for it and you'll find lots of places where you can find commented code examples for new weapons, monsters and game modes. I personally advice to check the AI Cafe tutorials, they are an excellent source;

4) After that, try changing small things to get used to the language: a really easy start point are the kill messages in the ClientObituary() function. After that, try something a bit more hard, like adding a MOTD. Don't hesitate in looking other mod's source to learn, but avoid the blind copy & paste. Do an honest effort to understand what's going on;

5) Don't be afraid of asking about things you may consider "stupid" or "lame" - there's no stupid or lame question when someone truly wants to learn. Besides, we all had to ask about those things (or even worse) to someone one day.

6) Again, Don't give up.
_________________
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: Thu Jun 10, 2010 10:34 pm    Post subject: Reply with quote

frag.machine wrote:
ThePlasticBling wrote:
well i don't know where to put any of that stuff in weapons.qc Confused

i guess you can call me a major n00b


I guess you need first learn the basics before anything.

My suggestion is:

0) Don't give up.

1) Grab the original QuakeC code and learn how to edit and compile it. Pro tip: you don't need Visual Studio 2008 to do that Very Happy : Notepad++, UltraEdit or even the Windows notepad plus frikqcc is enough;

2) After that, learn how to run your just compiled progs.dat;

3) Learn a bit about QuakeC. Google for it and you'll find lots of places where you can find commented code examples for new weapons, monsters and game modes. I personally advice to check the AI Cafe tutorials, they are an excellent source;

4) After that, try changing small things to get used to the language: a really easy start point are the kill messages in the ClientObituary() function. After that, try something a bit more hard, like adding a MOTD. Don't hesitate in looking other mod's source to learn, but avoid the blind copy & paste. Do an honest effort to understand what's going on;

5) Don't be afraid of asking about things you may consider "stupid" or "lame" - there's no stupid or lame question when someone truly wants to learn. Besides, we all had to ask about those things (or even worse) to someone one day.

6) Again, Don't give up.


lol thanx for the inspiration Very Happy

i know how to do most of that. im not good at the coding. all i want to do is make an impulse so if the impulse is typed, than the model will change (but the weapon stats will stay the same.) the reason i dont want to do an extra frame is because i have reloading in my game, and i am afraid it will mess reloading up (as in showing an iron sight animation in the middle of reloading)
Back to top
View user's profile Send private message
frag.machine



Joined: 25 Nov 2006
Posts: 728

PostPosted: Fri Jun 11, 2010 12:10 am    Post subject: Reply with quote

ThePlasticBling wrote:
lol thanx for the inspiration Very Happy

LOL yeah I went a bit too didactic, but is hard to know what someone already knows from 1 or 2 posts.
ThePlasticBling wrote:
i know how to do most of that. im not good at the coding. all i want to do is make an impulse so if the impulse is typed, than the model will change (but the weapon stats will stay the same.) the reason i dont want to do an extra frame is because i have reloading in my game, and i am afraid it will mess reloading up (as in showing an iron sight animation in the middle of reloading)


Well, do a backup, apply the changes and make some experiments. It's very likely it will indeed mess the reload, but that's something quite easy to fix: just force the .iron_sight field to 0 during the reload animation.
_________________
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: Fri Jun 11, 2010 12:52 am    Post subject: Reply with quote

frag.machine wrote:
ThePlasticBling wrote:
lol thanx for the inspiration Very Happy

LOL yeah I went a bit too didactic, but is hard to know what someone already knows from 1 or 2 posts.
ThePlasticBling wrote:
i know how to do most of that. im not good at the coding. all i want to do is make an impulse so if the impulse is typed, than the model will change (but the weapon stats will stay the same.) the reason i dont want to do an extra frame is because i have reloading in my game, and i am afraid it will mess reloading up (as in showing an iron sight animation in the middle of reloading)


Well, do a backup, apply the changes and make some experiments. It's very likely it will indeed mess the reload, but that's something quite easy to fix: just force the .iron_sight field to 0 during the reload animation.


lol Laughing

i don't know how to do that either.

hahahah lol sorry im losing my mind
Back to top
View user's profile Send private message
GiffE



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

PostPosted: Fri Jun 11, 2010 2:46 am    Post subject: Reply with quote

ThePlasticBling wrote:
i know how to do most of that. im not good at the coding. all i want to do is make an impulse so if the impulse is typed, than the model will change (but the weapon stats will stay the same.) the reason i dont want to do an extra frame is because i have reloading in my game, and i am afraid it will mess reloading up (as in showing an iron sight animation in the middle of reloading)
ThePlasticBling wrote:

lol Laughing
i don't know how to do that either.
hahahah lol sorry im losing my mind


Then you need to do some learning. Do something simpler to learn, as you clearly have zero understanding and are looking for copy paste solutions.

I hate to break it to you but you can't make a game with copy and paste.
_________________
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: Fri Jun 11, 2010 3:57 pm    Post subject: Reply with quote

GiffE wrote:
ThePlasticBling wrote:
i know how to do most of that. im not good at the coding. all i want to do is make an impulse so if the impulse is typed, than the model will change (but the weapon stats will stay the same.) the reason i dont want to do an extra frame is because i have reloading in my game, and i am afraid it will mess reloading up (as in showing an iron sight animation in the middle of reloading)
ThePlasticBling wrote:

lol Laughing
i don't know how to do that either.
hahahah lol sorry im losing my mind


Then you need to do some learning. Do something simpler to learn, as you clearly have zero understanding and are looking for copy paste solutions.

I hate to break it to you but you can't make a game with copy and paste.


lol ur right. i have been trying stuff that isn't copy and paste, but it never compiles Sad

btw: what part of CT are you from? (im from portland Very Happy )
Back to top
View user's profile Send private message
ThePlasticBling



Joined: 04 Jun 2010
Posts: 30

PostPosted: Fri Jun 11, 2010 4:44 pm    Post subject: Reply with quote

ok. so now i got an aiming impulse working Very Happy

but the only problem is that when i shoot while the aiming model is showing, it turns back to the regular model thats not aiming. any ideas?
Back to top
View user's profile Send private message
ceriux



Joined: 06 Sep 2008
Posts: 968
Location: Florida, USA

PostPosted: Fri Jun 11, 2010 5:15 pm    Post subject: Reply with quote

hey man try doing some menu tutorials iv developed my own form of menu's that was derived from the menu tutorials here. honestly i found that the menu tutorials are a good basic way to learn things like what .floats are and what not. ( and if you dont understand the difference between .float and float is "float" is for everything is global ".float" is for things like the player or his weapon, it really depends on the entitie its applied to. just keep trying . start with simpler mods and just reading through the .qc source till you start to realize what its actually saying. once you get used to .qc its almost like your reading a book and then writing a sentance. =) believe me i was in a similar state your in atm but i was just persistant try getting on irc i found its a little bit easier to learn if you can get someone there to explain things to you in real time. rather than spaced posts. good luck i hope you get better. maybe we can help each other out once i get out of school here in a month or so. =) once again GOOD LUCK and keep trying.
_________________
QuakeDB - Quake ModDB Group
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Goto page 1, 2, 3  Next
Page 1 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