Forum

2 Simple Questions

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Postby ceriux » Sun Feb 07, 2010 11:53 pm

i believe thats what he said.
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Postby Ghost_Fang » Mon Feb 08, 2010 1:24 am

Ok, well my real question is set up a new playerdie, or a new th_die?
just forget it, i know. No reason to be a smartass. I'm just making sure completely, no sense doing a lot of work when i started it wrong now is it?
Ghost_Fang
 
Posts: 336
Joined: Thu Nov 12, 2009 4:37 am

Postby ceriux » Mon Feb 08, 2010 1:54 am

i wasnt being a smart ass. im not 100% sure myself so i said "i believe"
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Postby Ghost_Fang » Mon Feb 08, 2010 2:28 am

Im sorry, i see what you meant now. I guess im just used to everyone being snotty towards me, i am sorry.
I am running into issues while im here. I made a new function. PlayerIncap(); and changed the th_die in client. But when i "die" it still kinda makes me die. I turn sideways, enemies ignore me, but i still can shoot (without a weapon).
Do i need to edit Killed(); in combat.qc?
Ghost_Fang
 
Posts: 336
Joined: Thu Nov 12, 2009 4:37 am

Postby ceriux » Mon Feb 08, 2010 2:40 am

post up your function here so i can see.
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Postby Ghost_Fang » Mon Feb 08, 2010 2:47 am

Code: Select all
void() PlayerIncap =
{
   self.view_ofs = '0 0 2';
   self.solid = SOLID_SLIDEBOX;
   self.movetype = MOVETYPE_NONE;
   
   if (self.captimer > 2)
   {
   PlayerDie();
   }

};


Its not done, i still gotta add it so you pull out the pistol and can only use pistol. And i gotta add the function for when a player helps you up. But first things first.
Ghost_Fang
 
Posts: 336
Joined: Thu Nov 12, 2009 4:37 am

Postby Dr. Shadowborg » Mon Feb 08, 2010 4:42 am

You're on the right track, you just need to give the player his incap health.

(because the people who coded the engine are evile and made the deathview change dependant upon self.health <= 0 when it should be dependant on .deadflag)
User avatar
Dr. Shadowborg
InsideQC Staff
 
Posts: 1110
Joined: Sat Oct 16, 2004 3:34 pm

Postby ceriux » Mon Feb 08, 2010 4:46 am

yeah lol, thats why in my sloppy ass post earlier, i mentioned making self.health 250 or w.e u wanted it.
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Postby Ghost_Fang » Mon Feb 08, 2010 6:57 am

Here is what it evolved into:

Code: Select all
void() PlayerIncap =
{
if (self.captimer == 4)
   {
   return;
   PlayerDie();
   }

if (self.capenabled == 1)
   {
   return;
   if (self.health <= 0)
   PlayerDie();
   }
   
   self.health = 250;
   self.view_ofs = '0 0 -8';
   self.solid = SOLID_SLIDEBOX;
   self.movetype = MOVETYPE_NONE;
   self.capenabled = 1;
   self.captimer = self.captimer + 1;


};


My player gets incapped, he falls down, health is 250, BUT when he dies while being incapped he "kinda" dies, it does what its suppose to do, camera goes sideways, weapon disappears, but i can still shoot, and when i shoot an enemy, it does this horrendous sound of enemy alert sound looping on top of each other. Any suggestions?
Ghost_Fang
 
Posts: 336
Joined: Thu Nov 12, 2009 4:37 am

Postby ceriux » Mon Feb 08, 2010 3:52 pm

maybe the players dead state is still DEAD_DEAD or DEAD_DYING something?
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Postby Dr. Shadowborg » Mon Feb 08, 2010 4:27 pm

Your problem is here:

Code: Select all
if (self.captimer == 4)
   {
   return;
   PlayerDie();
   }

if (self.capenabled == 1)
   {
   return;
   if (self.health <= 0)
   PlayerDie();
   }


This is a problem because return; is causing you to bail out of the function BEFORE it gets around to calling PlayerDie();

Move the two return; to under the code that needs to be called in those if blocks so that it looks like this:

Code: Select all
if (self.captimer == 4)
   {
   PlayerDie();
   return;
   }

if (self.capenabled == 1)
   {
   if (self.health <= 0)
   PlayerDie();
   return;
   }


This should fix your problem.
User avatar
Dr. Shadowborg
InsideQC Staff
 
Posts: 1110
Joined: Sat Oct 16, 2004 3:34 pm

Postby Ghost_Fang » Mon Feb 08, 2010 11:41 pm

Wow.... i honestly should have known that lol. Thanks Dr. It worked.

Now this is what i got, along with 2 issues:

First (look that the last lines of my code, the nextthinks)
After 30 seconds i want the player to get back up but i dont know how to call upon PlayerGetUp(); cause it give me an error when i do it as shown. client.qc:532:type mismatch for = is the error i get, more specifically.

Second
I have the weapon switching done right, but the frames are all screwy. When i shoot, the frames skip a little, and when i reload it doesnt move to a second and does the last few frames super fast. Any ideas on what would be conflicting?


Code: Select all
/*
===========
PlayerGetUp
get up from Incap
===========
*/

void() PlayerGetUp =
{
    self.health = self.hurthealth = 50;
   self.view_ofs = '0 0 22';
   self.takedamage = DAMAGE_AIM;
   self.deadflag = DEAD_NO;
   self.solid = SOLID_SLIDEBOX;
   self.movetype = MOVETYPE_WALK;
   self.capenabled = 0;
};


/*
===============
Incapacitation
===============
*/
void() PlayerIncap =
{
if (self.captimer == 4)
   {
   PlayerDie();
   return;
   }

if (self.capenabled == 1)
   {
   PlayerDie();
   return;
   }
   else
   
   {   
   self.health = self.hurthealth = 250;
   self.view_ofs = '0 0 -8';
   self.weapon = IT_SHOTGUN;             //switch to pistol when you fall down
   W_SetCurrentAmmo ();
   self.takedamage = DAMAGE_AIM;
   self.deadflag = DEAD_NO;
   self.solid = SOLID_SLIDEBOX;
   self.movetype = MOVETYPE_NONE;
   self.capenabled = 1;
   self.captimer = self.captimer + 1;
   self.nextthink = time + 30;
   nextthink = PlayerGetUp();            //for test purposes only
   }


};
Ghost_Fang
 
Posts: 336
Joined: Thu Nov 12, 2009 4:37 am

Postby Dr. Shadowborg » Tue Feb 09, 2010 12:07 am

Ghost_Fang wrote:Wow.... i honestly should have known that lol. Thanks Dr. It worked.

Now this is what i got, along with 2 issues:

First (look that the last lines of my code, the nextthinks)
After 30 seconds i want the player to get back up but i dont know how to call upon PlayerGetUp(); cause it give me an error when i do it as shown. client.qc:532:type mismatch for = is the error i get, more specifically.

Second
I have the weapon switching done right, but the frames are all screwy. When i shoot, the frames skip a little, and when i reload it doesnt move to a second and does the last few frames super fast. Any ideas on what would be conflicting?


Code: Select all
   self.nextthink = time + 30;
   nextthink = PlayerGetUp();            //for test purposes only


Problem 1:
Don't do this. You're basically putting the player into some sort of wierd carbonite freezing in regards to his think functions. This is VERY bad. (Unless your doing things like freeze guns, or whatnot, where it doesn't matter if the player can't do things like shoot, etc.)

Problem 2:
You're not assigning the nextthink properly. nextthink should ONLY be set like the following:

Code: Select all
self.nextthink = PlayerGetUp;


To get your stuff working right you should do something like this:

1. Create a .float getuptime or some such.
2. set it to self.getuptime = time + 30; in your PlayerIncap() function.
3. Add an if block that checks to see if self.capenabled is true, and checks to see if self.getuptime <= time, and if so, call PlayerGetUp(); Put this in CheckPowerups();

That should get things working.
User avatar
Dr. Shadowborg
InsideQC Staff
 
Posts: 1110
Joined: Sat Oct 16, 2004 3:34 pm

Postby Ghost_Fang » Tue Feb 09, 2010 2:01 am

Works perfect! thanks again.
Another issue (sorry lol)
If i have any velocity at all such as walking or push from a rocket when i get incapped my character is down and everything but he bobs up and down like he does when you walk. How can i make it so stops doing that?

EDIT: i got it, a simple self.veloctity_x,y,z = 0; did it. Lol
Ghost_Fang
 
Posts: 336
Joined: Thu Nov 12, 2009 4:37 am

Postby ceriux » Tue Feb 09, 2010 5:02 am

you should make a video to show us how cool this looks. it sounds cool.
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

PreviousNext

Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest