How to make an aim command?
-
ThePlasticBling
- Posts: 51
- Joined: Fri Jun 04, 2010 10:18 pm
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!
-
ThePlasticBling
- Posts: 51
- Joined: Fri Jun 04, 2010 10:18 pm
-
frag.machine
- Posts: 2126
- Joined: Sat Nov 25, 2006 1:49 pm
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! ***
And, for the specific weapon (let's say, the shotgun), you do like that:
*** WARNING: untested, I may have forgot something important! ***
Code: Select all
.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
}
(...)
Code: Select all
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;
}
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC
(LordHavoc)
-
ThePlasticBling
- Posts: 51
- Joined: Fri Jun 04, 2010 10:18 pm
well i don't know where to put any of that stuff in weapons.qc :?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! ***
And, for the specific weapon (let's say, the shotgun), you do like that:Code: Select all
.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 } (...)
Code: Select all
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; }
i guess you can call me a major n00b
-
ThePlasticBling
- Posts: 51
- Joined: Fri Jun 04, 2010 10:18 pm
-
frag.machine
- Posts: 2126
- Joined: Sat Nov 25, 2006 1:49 pm
I guess you need first learn the basics before anything.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
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
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.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC
(LordHavoc)
-
ThePlasticBling
- Posts: 51
- Joined: Fri Jun 04, 2010 10:18 pm
lol thanx for the inspirationfrag.machine wrote:I guess you need first learn the basics before anything.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
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.
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)
-
frag.machine
- Posts: 2126
- Joined: Sat Nov 25, 2006 1:49 pm
LOL yeah I went a bit too didactic, but is hard to know what someone already knows from 1 or 2 posts.ThePlasticBling wrote:lol thanx for the inspiration![]()
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.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)
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC
(LordHavoc)
-
ThePlasticBling
- Posts: 51
- Joined: Fri Jun 04, 2010 10:18 pm
lolfrag.machine wrote:LOL yeah I went a bit too didactic, but is hard to know what someone already knows from 1 or 2 posts.ThePlasticBling wrote:lol thanx for the inspiration
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.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)
i don't know how to do that either.
hahahah lol sorry im losing my mind
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)
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.ThePlasticBling wrote: lol![]()
i don't know how to do that either.
hahahah lol sorry im losing my mind
I hate to break it to you but you can't make a game with copy and paste.
-
ThePlasticBling
- Posts: 51
- Joined: Fri Jun 04, 2010 10:18 pm
lol ur right. i have been trying stuff that isn't copy and paste, but it never compilesGiffE 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)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.ThePlasticBling wrote: lol![]()
i don't know how to do that either.
hahahah lol sorry im losing my mind
I hate to break it to you but you can't make a game with copy and paste.
btw: what part of CT are you from? (im from portland
-
ThePlasticBling
- Posts: 51
- Joined: Fri Jun 04, 2010 10:18 pm
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.