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

2 Simple Questions Goto page 1, 2, 3 Next

| Inside3d Forums Forum Index -> QuakeC Programming

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

Posted: Sun Feb 07, 2010 6:47 pm Post subject: 2 Simple Questions |

First: Where would i find the code that controls the amount of damage a player takes from the knight's melee? I want to make it a set amount (like 2 damg each hit or something). Second: Based on this edited rocket code, how would i make it so the owner(player who shot it) doesnt take any damge, BUT still gets pushed by the explosion force? I can make it 0 damage but then no push.

Code:
{ local float damg; if (other == self.owner) return; // don't explode on owner damg = 20 + random()*10;
if (other.health)
{
if (other.classname == "player")
damg = damg = 0;
T_Damage (other, self, self.owner, damg );
}
T_RadiusDamage (self, self.owner, 120, other);
self.origin = self.origin - 8*normalize(self.velocity);
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_EXPLOSION);
WriteCoord (MSG_BROADCAST, self.origin_x);
WriteCoord (MSG_BROADCAST, self.origin_y);
WriteCoord (MSG_BROADCAST, self.origin_z);
BecomeExplosion ();
};

Back to top |

ceriux Joined: 06 Sep 2008 Posts: 969 Location: Florida, USA |

Posted: Sun Feb 07, 2010 7:38 pm Post subject: |

for the knight look at ai_melee -fight.qc and T_Damage - weapons.qc also knight_atk# - knight.qc (i think thats just his basic attack) but after messing around with those. you should be able to figure out how to change his charge attacks too. _________________
QuakeDB - Quake ModDB Group

Back to top |

Ghost_Fang Joined: 12 Nov 2009 Posts: 162 |

Posted: Sun Feb 07, 2010 8:16 pm Post subject: |

Ok, i got it, and it worked, but not how i want it. I got it to do 2 damage, but its still "stacks" i guess you would call it. I want 1 swing to do 2 damage. How would i do that? Correct me if you already answered that and im misunderstanding. Thanks so far ceriux.
New (and unrelated) question:
Where is the stinking function that tells the game if self.health = 0 playerdie();?? Cause i'm trying to add incapacitation so i would need to edit the playerdie to make them only die under new conditions besides health = 0. Unless... there s another way?

Back to top |

ceriux Joined: 06 Sep 2008 Posts: 969 Location: Florida, USA |

Posted: Sun Feb 07, 2010 8:24 pm Post subject: |

player.qc is where playerdie(); is , but you might want to check out combat.qc for the killed(); function. im also not sure what you mean by stacked. explain a little more. _________________ QuakeDB - Quake ModDB Group

Back to top |

Ghost_Fang Joined: 12 Nov 2009 Posts: 162 |

Posted: Sun Feb 07, 2010 8:32 pm Post subject: |

well the regular knight attack as you may know, does damage as long as he is touching you. So when he swings as long as you are close enough you take damage until the swing is over. so you might end up taking 20 damge, or maybe 10 if you back off. I want 1 swing, 2 damage. Much like the player axe how it always does a set amount of damage i think.

Back to top |

ceriux Joined: 06 Sep 2008 Posts: 969 Location: Florida, USA |

Posted: Sun Feb 07, 2010 8:36 pm Post subject: |

hmm, is there another monster which does a melee swing like your asking? if not check out the soldiers attack code, im pretty sure it calls a trace like the player. then just change the distance of the trace (id make your own copy of the function and have it called after its edited)
_________________
QuakeDB - Quake ModDB Group

Back to top |

Ghost_Fang Joined: 12 Nov 2009 Posts: 162 |

Posted: Sun Feb 07, 2010 8:43 pm Post subject: |

do you think it would work if i copied some of the axe attack? wait! what about the dog? I'm gona check and see if the dog does a set amount of damage or its just like the knight's Also, i want to know where player(); or killed(); is called when health is 0.
EDIT: the dog Does to a set damage, but it looks to me that it is randomized between 10 and 8 (this is just wat i saw from being attacked by it in e1m1). So ill look at its code and edit accordingly.

Back to top |

ceriux Joined: 06 Sep 2008 Posts: 969 Location: Florida, USA |

Posted: Sun Feb 07, 2010 8:57 pm Post subject: |

for the death maybe this is what your looking for?

Code:
void() PlayerDeathThink = { local entity old_self; local float forward; if ((self.flags & FL_ONGROUND))
{
forward = vlen (self.velocity);
forward = forward - 20;
if (forward <= 0)
self.velocity = '0 0 0';
else
self.velocity = forward * normalize(self.velocity);
}
// wait for all buttons released
if (self.deadflag == DEAD_DEAD)
{
if (self.button2 || self.button1 || self.button0)
return;
self.deadflag = DEAD_RESPAWNABLE;
return;
}
// wait for any button down
if (!self.button2 && !self.button1 && !self.button0)
return;
self.button0 = 0;
self.button1 = 0;
self.button2 = 0;
respawn();
};

in client.qc
also maybe this in playerprethink? - also in client.qc

Code:
if (self.deadflag >= DEAD_DEAD) { PlayerDeathThink (); return; }
if (self.deadflag == DEAD_DYING)
return; // dying, so do nothing

_________________
QuakeDB - Quake ModDB Group

Back to top |

Ghost_Fang Joined: 12 Nov 2009 Posts: 162 |

Posted: Sun Feb 07, 2010 9:48 pm Post subject: |

Hmmm, im honestly not entirely sure what im looking for. But the past week i've been getting things done by trial and error and looking to quake original code to achieve what i want. i tried to do it my way and just ask how to find something, but i cant get it. So ill ask this: How would i achieve incapacitation? You dont have to post code, just point me in the right direction(s).
This is wat i want:
-Health reaches zero, fall to ground, pull out pistol, you cant move, health is now 250 that slowly degenerates and you can also be attacked making it go dow faster. You can still shoot. You must be helped up by another player.
-When you get back up you health is now 30 and will degenerate (but stop at 1)
-After 2 incapacitations your third death is your permanent one.
I honestly had it all planned out in my head, im just stuck on manipulating the player death code

Back to top |

ceriux Joined: 06 Sep 2008 Posts: 969 Location: Florida, USA |

Posted: Sun Feb 07, 2010 9:56 pm Post subject: |

hmm i think you would want to edit, playerdie in player.qc im not 100% sure. Id also have to do a lot of trial and error there... im pretty sure its doable. im guessing you'd just set the players movetype to MOVETYPE_NONE, change his view so its really close to the ground. set the players self.weapon == IT_PISTOL or w.e then if they try and change it in the downed state that you made (im guessing using a .float to keep track of it) if (self.weapon != IT_PISTOL) { self.weapon == IT_PISTOL; } and for your health set self.health == 250 and if self.time == time + 1) self.health = self.health - "random number u choose" i mean thats not the code. but if u can read through that slop and get ideas. that im sure is pretty much how its done.
_________________
QuakeDB - Quake ModDB Group

Back to top |

Ghost_Fang Joined: 12 Nov 2009 Posts: 162 |

Posted: Sun Feb 07, 2010 10:16 pm Post subject: |

Lmao, thats pretty much exactly how i had it figured out, all except the degrade, all i was gona do is add a self.nextthink = time + 2. nextthink = self.health -1. I know i would have to mess with the playerdie, and i did, but my character still dies when health = 0. I gotta find where it tells the player to die when health is 0.

Back to top |

ceriux Joined: 06 Sep 2008 Posts: 969 Location: Florida, USA |

Posted: Sun Feb 07, 2010 10:30 pm Post subject: |

hmm idk... those were all the functions i could find that had to do with player death, minus checkpowerups. _________________ QuakeDB - Quake ModDB Group

Back to top |

Ghost_Fang Joined: 12 Nov 2009 Posts: 162 |

Posted: Sun Feb 07, 2010 10:43 pm Post subject: |

hmmm, well thanks a lot Ceriux. What about changing enemy damage to subtracting from a different float? would that work? Then after the 2nd incap switch to default health?

Back to top |

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

Posted: Sun Feb 07, 2010 11:00 pm Post subject: |

The player death code is horribly convoluted. Basically, when something dies, killed is called. (This happens within T_Damage) From there, killed will call the .th_die of whatever happens to be dying. (for the player this is PlayerDie.) After this, PlayerDie does some transitional stuff, and calls a suitable death animation. Once the death animation hits it's end, it calls PlayerDead. This function basically draws the curtains for the player, at which point he can either respawn or restart the level.
For incapacitation, you would need to:
1. Set up an new th_die function that sets the player into a incapacitated / immobilized mode, reduces the player's lives count, and enables health degradation. (You'll need to tell PutClientInServer about this change too by way of a self.th_die = whateveryournewdiefunctioniscalled;)
2. Make the function reroute to a modified PlayerDie where he dies for real, sans respawn or some such.
For Health Degradation, you will need:
1. make a .float degradetime and .float degradeenabled (or use a flag or something for the second one.)
2. Add a bit of code in checkpowerups() that checks to see if the degradation float is true (or if you have the degrade_health flag), and if so and your health isn't 1 then degrade it by one.
I hope I've explained this in a relatively easy to understand manner.
_________________
"Roboto suggests Plasma Bazooka."

Back to top |

Ghost_Fang Joined: 12 Nov 2009 Posts: 162 |

Posted: Sun Feb 07, 2010 11:41 pm Post subject: |

Wow thanks Dr. I understand 98% 1 question, i would make a "new" playerdie(); and in client, i would change self.th_die = mynewdie();?

Back to top |

Display posts from previous:

| Inside3d Forums Forum Index -> QuakeC Programming | All times are GMT Goto page 1, 2, 3 Next
Page 1 of 3

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