Forum

"I have fallen, but why cant i get up?"

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

"I have fallen, but why cant i get up?"

Postby Ghost_Fang » Thu Feb 11, 2010 6:56 am

I did this a really noobish way, so noobish, it wont even work. Why wont this work? And is there an easier way? lol

Code: Select all
void()   player_getup21 =  {self.view_ofs = '0 0 -3.8';PlayerGetUp();};
void()   player_getup20  = {self.view_ofs = '0 0 -4.0';player_getup21();};
void()   player_getup19  = {self.view_ofs = '0 0 -4.2';player_getup20();};
void()   player_getup18  = {self.view_ofs = '0 0 -4.4';player_getup19();};
void()   player_getup17  = {self.view_ofs = '0 0 -4.6';player_getup18();};
void()   player_getup16  = {self.view_ofs = '0 0 -4.8';player_getup17();};
void()   player_getup15  = {self.view_ofs = '0 0 -5.0';player_getup16();};
void()   player_getup14  = {self.view_ofs = '0 0 -5.2';player_getup15();};
void()   player_getup13  = {self.view_ofs = '0 0 -5.4';player_getup14();};
void()   player_getup12  = {self.view_ofs = '0 0 -5.6';player_getup13();};
void()   player_getup11  = {self.view_ofs = '0 0 -5.8';player_getup12();};
void()   player_getup10  = {self.view_ofs = '0 0 -6.0';player_getup11();};
void()   player_getup9  =  {self.view_ofs = '0 0 -6.2';player_getup10();};
void()   player_getup8  =  {self.view_ofs = '0 0 -6.4';player_getup9();};
void()   player_getup7  =  {self.view_ofs = '0 0 -6.6';player_getup8();};
void()   player_getup6  =  {self.view_ofs = '0 0 -6.8';player_getup7();};
void()   player_getup5  =  {self.view_ofs = '0 0 -7.0';player_getup6();};
void()   player_getup4  =  {self.view_ofs = '0 0 -7.2';player_getup5();};
void()   player_getup3  =  {self.view_ofs = '0 0 -7.4';player_getup4();};
void()   player_getup2  =  {self.view_ofs = '0 0 -7.6';player_getup3();};
void()   player_getup1  =  {self.view_ofs = '0 0 -7.8';player_getup2();};
Ghost_Fang
 
Posts: 336
Joined: Thu Nov 12, 2009 4:37 am

Postby frag.machine » Thu Feb 11, 2010 1:28 pm

try using this format
Code: Select all
void() player_getup21 = [ $deatha1, player_getup22 ]
{
  self.view_ofs = '0 0 -3.8';
  PlayerGetUp();
};

(...)


NOTE: the stuff between [] is automatically expanded to
Code: Select all
  self.frame = $deatha1;
  self.think = player_getup22;
  self.nextthink = time + 0.1;


and placed before the code you write between {}, so you can always override the macro contents.
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 Ghost_Fang » Thu Feb 11, 2010 8:07 pm

I did do it that exact way before, but it like stopped after the third function. Any ideas what would cause that?. I check for missing numbers or anything the compiler wouldn't pick up and found nothing.
Ghost_Fang
 
Posts: 336
Joined: Thu Nov 12, 2009 4:37 am

Postby Dr. Shadowborg » Thu Feb 11, 2010 8:26 pm

Sounds like maybe the animation is getting interrupted by something else? Perhaps pain animation?

Try adding some code in player_pain that disables the playing of pain animations if you're in the process of getting back up. (The reason this doesn't happen when you're shooting is because there's code to prevent this from happening if your weaponframe isn't 0)
User avatar
Dr. Shadowborg
InsideQC Staff
 
Posts: 1110
Joined: Sat Oct 16, 2004 3:34 pm

Postby Ghost_Fang » Fri Feb 12, 2010 3:49 am

Its not an animation though, its just functions that gradually increase self.view_ofs so it looks like you're getting up. But wouldn't a format like this work:

Code: Select all
void() player_gettingup =
{
if (self.capenabled ==1)
   {
      if (self.view_ofs == -3.0)
                PlayerGetUp;
                return;
      
   }
self.view_ofs = self.view_ofs + 0.1;
};
Ghost_Fang
 
Posts: 336
Joined: Thu Nov 12, 2009 4:37 am

Postby Dr. Shadowborg » Fri Feb 12, 2010 3:53 am

Ghost_Fang wrote:Its not an animation though, its just functions that gradually increase self.view_ofs so it looks like you're getting up. But wouldn't a format like this work:

Code: Select all
void() player_gettingup =
{
if (self.capenabled ==1)
   {
      if (self.view_ofs == -3.0)
                PlayerGetUp;
                return;
      
   }
self.view_ofs = self.view_ofs + 0.1;
};


You would have to use self.view_ofs_z instead because you'll get a type mismatch from trying to mix and match integers with vectors.

Also, that should be placed in CheckPowerups() with some code to only allow this to occur when your actually supposed to be getting up.
User avatar
Dr. Shadowborg
InsideQC Staff
 
Posts: 1110
Joined: Sat Oct 16, 2004 3:34 pm

Postby Ghost_Fang » Fri Feb 12, 2010 4:28 am

well i have th_action = playergettingup() wouldn't that suffice? so when a teammate uses action on a player then it activates playergettingup, but player gettingup will return if self.playerincap doesnt equal 1.
Ghost_Fang
 
Posts: 336
Joined: Thu Nov 12, 2009 4:37 am

Postby Dr. Shadowborg » Fri Feb 12, 2010 5:12 am

Ghost_Fang wrote:well i have th_action = playergettingup() wouldn't that suffice? so when a teammate uses action on a player then it activates playergettingup, but player gettingup will return if self.playerincap doesnt equal 1.


No, because playergettingup() will need to be called several times in order to get your self.view_ofs back to normal. This means you need to spread it out over several frames, which means calling the function every frame or so. (because as I understand it you want it to be done gradually, so that it looks like you're getting up)

A while loop won't work either because it will just essentially be the same as if you had done a self.view_ofs = whateverthenormalview_ofs_normallyis; (happens near instantly for the player's view)
User avatar
Dr. Shadowborg
InsideQC Staff
 
Posts: 1110
Joined: Sat Oct 16, 2004 3:34 pm

Postby Ghost_Fang » Fri Feb 12, 2010 5:43 am

OOhhhhhh. ok. I see, i was actually just trying to solve that issue, i got the code down, but it only gets called once lol. ill just make the function make self.gettingup == 1, and in powerups have it check if self.gettingup ==1 and do the view_ofs change, then at the end of the function, set self.gettingup == 0. That would work right?

Oh and btw offtopic. But how to i make a button press true, if not pressed false. for example, if i have the medkit, i have to hold down the button until the healing sequence is done, if i let go it stops it. same goes for helping a player up. how would i do this?
Ghost_Fang
 
Posts: 336
Joined: Thu Nov 12, 2009 4:37 am

Postby Downsider » Fri Feb 12, 2010 3:26 pm

Ghost_Fang wrote:OOhhhhhh. ok. I see, i was actually just trying to solve that issue, i got the code down, but it only gets called once lol. ill just make the function make self.gettingup == 1, and in powerups have it check if self.gettingup ==1 and do the view_ofs change, then at the end of the function, set self.gettingup == 0. That would work right?

Oh and btw offtopic. But how to i make a button press true, if not pressed false. for example, if i have the medkit, i have to hold down the button until the healing sequence is done, if i let go it stops it. same goes for helping a player up. how would i do this?


alias +use "impulse 50"
alias -use "impulse 51"
bind e +use

Impulse 50 means the button's been pressed, impulse 51 means the player released the button.
User avatar
Downsider
 
Posts: 621
Joined: Tue Sep 16, 2008 1:35 am

Postby LonePossum. » Fri Feb 12, 2010 6:48 pm

Though if you do not know (I havent actually read the thread) What downsider wrote is put into the autoexec and then you bind the e+use in the config from my understanding.

Peace,
Shallows.
LonePossum.
 
Posts: 38
Joined: Mon Nov 02, 2009 11:07 am

Postby Ghost_Fang » Fri Feb 12, 2010 11:21 pm

Alright, thanks downsider, but can that be implemented with qc? how does the nailgun do it compared to the shotgun? cause remember, the action command is universal, and i need several things on the same button. For example, Medkit, shoot button is to heal yourself, but reload is heal teamate. And both of those i would like to get canceled if you let go of the button.
Ghost_Fang
 
Posts: 336
Joined: Thu Nov 12, 2009 4:37 am

Postby Downsider » Sat Feb 13, 2010 4:31 am

Ghost_Fang wrote:Alright, thanks downsider, but can that be implemented with qc? how does the nailgun do it compared to the shotgun? cause remember, the action command is universal, and i need several things on the same button. For example, Medkit, shoot button is to heal yourself, but reload is heal teamate. And both of those i would like to get canceled if you let go of the button.


The nailgun does it the same as the shotgun; both fire automatically. Quake handles button input for jumping and shooting differently than other input.
User avatar
Downsider
 
Posts: 621
Joined: Tue Sep 16, 2008 1:35 am

Postby Ghost_Fang » Sat Feb 13, 2010 4:40 am

Oh ok lol. Well how do i take wat you said to do for the autoexec in qc form?
Ghost_Fang
 
Posts: 336
Joined: Thu Nov 12, 2009 4:37 am


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest