View previous topic :: View next topic |
Author |
Message |
ThePlasticBling
Joined: 04 Jun 2010 Posts: 30
|
Posted: Tue Jun 08, 2010 9:00 pm Post subject: How to make an aim command? |
|
|
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 |
|
 |
GiffE
Joined: 08 Oct 2006 Posts: 141 Location: USA, CT
|
Posted: Tue Jun 08, 2010 11:54 pm Post subject: |
|
|
Switch model? 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 |
|
 |
ThePlasticBling
Joined: 04 Jun 2010 Posts: 30
|
Posted: Wed Jun 09, 2010 11:01 pm Post subject: |
|
|
GiffE wrote: | Switch model? 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  |
|
Back to top |
|
 |
frag.machine

Joined: 25 Nov 2006 Posts: 728
|
Posted: Thu Jun 10, 2010 1:02 pm Post subject: |
|
|
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 |
|
 |
ThePlasticBling
Joined: 04 Jun 2010 Posts: 30
|
Posted: Thu Jun 10, 2010 7:09 pm Post subject: |
|
|
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
i guess you can call me a major n00b |
|
Back to top |
|
 |
Arkage
Joined: 19 Nov 2009 Posts: 27
|
Posted: Thu Jun 10, 2010 7:34 pm Post subject: |
|
|
Ctrl + f , then search for the function names. |
|
Back to top |
|
 |
ThePlasticBling
Joined: 04 Jun 2010 Posts: 30
|
Posted: Thu Jun 10, 2010 8:02 pm Post subject: |
|
|
Arkage wrote: | Ctrl + f , then search for the function names. |
idk i just wont add iron sights |
|
Back to top |
|
 |
frag.machine

Joined: 25 Nov 2006 Posts: 728
|
Posted: Thu Jun 10, 2010 8:38 pm Post subject: |
|
|
ThePlasticBling wrote: | well i don't know where to put any of that stuff in weapons.qc
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 : 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 |
|
 |
ThePlasticBling
Joined: 04 Jun 2010 Posts: 30
|
Posted: Thu Jun 10, 2010 10:34 pm Post subject: |
|
|
frag.machine wrote: | ThePlasticBling wrote: | well i don't know where to put any of that stuff in weapons.qc
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 : 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
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 |
|
 |
frag.machine

Joined: 25 Nov 2006 Posts: 728
|
Posted: Fri Jun 11, 2010 12:10 am Post subject: |
|
|
ThePlasticBling wrote: | lol thanx for the inspiration
|
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 |
|
 |
ThePlasticBling
Joined: 04 Jun 2010 Posts: 30
|
Posted: Fri Jun 11, 2010 12:52 am Post subject: |
|
|
frag.machine wrote: | ThePlasticBling wrote: | lol thanx for the inspiration
|
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
i don't know how to do that either.
hahahah lol sorry im losing my mind |
|
Back to top |
|
 |
GiffE
Joined: 08 Oct 2006 Posts: 141 Location: USA, CT
|
Posted: Fri Jun 11, 2010 2:46 am Post subject: |
|
|
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
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 |
|
 |
ThePlasticBling
Joined: 04 Jun 2010 Posts: 30
|
Posted: Fri Jun 11, 2010 3:57 pm Post subject: |
|
|
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
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
btw: what part of CT are you from? (im from portland ) |
|
Back to top |
|
 |
ThePlasticBling
Joined: 04 Jun 2010 Posts: 30
|
Posted: Fri Jun 11, 2010 4:44 pm Post subject: |
|
|
ok. so now i got an aiming impulse working
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 |
|
 |
ceriux

Joined: 06 Sep 2008 Posts: 969 Location: Florida, USA
|
Posted: Fri Jun 11, 2010 5:15 pm Post subject: |
|
|
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 |
|
 |
|