Index | FAQ | Search | Memberlist | Usergroups | Profile | Log in to check your private messages | Log in | Register

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

| Inside3d Forums Forum Index -> QuakeC Programming

View previous topic :: View next topic
Author | Message
--- | ---
Ghost_Fang Joined: 12 Nov 2009 Posts: 162 |

Posted: Thu Feb 11, 2010 6:56 am Post subject: "I have fallen, but why cant i get up?" |

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:
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();};

Back to top |

frag.machine Joined: 25 Nov 2006 Posts: 728 |

Posted: Thu Feb 11, 2010 1:28 pm Post subject: |

try using this format

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

NOTE: the stuff between [] is automatically expanded to

Code:
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.
_________________
frag.machine - Q2K4 Project
http://fragmachine.quakedev.com/

Back to top |

Ghost_Fang Joined: 12 Nov 2009 Posts: 162 |

Posted: Thu Feb 11, 2010 8:07 pm Post subject: |

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.

Back to top |

Dr. Shadowborg Inside3D Staff Joined: 16 Oct 2004 Posts: 726 |

Posted: Thu Feb 11, 2010 8:26 pm Post subject: |

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)
_________________
"Roboto suggests Plasma Bazooka."

Back to top |

Ghost_Fang Joined: 12 Nov 2009 Posts: 162 |

Posted: Fri Feb 12, 2010 3:49 am Post subject: |

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:
void() player_gettingup = { if (self.capenabled ==1) { if (self.view_ofs == -3.0)
PlayerGetUp;
return;
}
self.view_ofs = self.view_ofs + 0.1;
};

Back to top |

Dr. Shadowborg Inside3D Staff Joined: 16 Oct 2004 Posts: 726 |

Posted: Fri Feb 12, 2010 3:53 am Post subject: |

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:
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.
_________________
"Roboto suggests Plasma Bazooka."

Back to top |

Ghost_Fang Joined: 12 Nov 2009 Posts: 162 |

Posted: Fri Feb 12, 2010 4:28 am Post subject: |

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.

Back to top |

Dr. Shadowborg Inside3D Staff Joined: 16 Oct 2004 Posts: 726 |

Posted: Fri Feb 12, 2010 5:12 am Post subject: |

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)
_________________
"Roboto suggests Plasma Bazooka."

Back to top |

Ghost_Fang Joined: 12 Nov 2009 Posts: 162 |

Posted: Fri Feb 12, 2010 5:43 am Post subject: |

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?

Back to top |

Downsider Joined: 16 Sep 2008 Posts: 478 |

Posted: Fri Feb 12, 2010 3:26 pm Post subject: |

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.

Back to top |

LonePossum. Joined: 02 Nov 2009 Posts: 38 |

Posted: Fri Feb 12, 2010 6:48 pm Post subject: |

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.

Back to top |

Ghost_Fang Joined: 12 Nov 2009 Posts: 162 |

Posted: Fri Feb 12, 2010 11:21 pm Post subject: |

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.

Back to top |

Downsider Joined: 16 Sep 2008 Posts: 478 |

Posted: Sat Feb 13, 2010 4:31 am Post subject: |

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.

Back to top |

Ghost_Fang Joined: 12 Nov 2009 Posts: 162 |

Posted: Sat Feb 13, 2010 4:40 am Post subject: |

Oh ok lol. Well how do i take wat you said to do for the autoexec in qc form?

Back to top |

Display posts from previous:

| Inside3d Forums Forum Index -> QuakeC Programming | All times are GMT
Page 1 of 1

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