removing body parts when shot

Discuss programming in the QuakeC language.
thommoboy
Posts: 95
Joined: Mon Nov 21, 2011 6:35 am

removing body parts when shot

Post by thommoboy »

this could quite possibly be the hardest thing i have wanted to do and i know nzp and l4q have done it but how is it done? for psp i might add so no darkplaces addons
Jukki
Posts: 214
Joined: Wed Apr 07, 2010 4:59 am

Re: removing body parts when shot

Post by Jukki »

you need to make hte bodie parts as separated entities and then code it to follow the body
gnounc
Posts: 428
Joined: Mon Apr 06, 2009 6:26 am

Re: removing body parts when shot

Post by gnounc »

Just create alternate models with body parts missing and swap them out when shot.
thommoboy
Posts: 95
Joined: Mon Nov 21, 2011 6:35 am

Re: removing body parts when shot

Post by thommoboy »

yeah but how would you change models?
Ghost_Fang
Posts: 336
Joined: Thu Nov 12, 2009 4:37 am

Re: removing body parts when shot

Post by Ghost_Fang »

when you want to change the model, just call setmodel(entity, "progs/model.mdl");
And L4Q has no dismemberment or model switching, if you get a headshot it plays a separate dying animation, one in which the head is shrunk to near nothing and tucked inside the shoulders/neck. Aren't we sneaky? :P
frag.machine
Posts: 2126
Joined: Sat Nov 25, 2006 1:49 pm

Re: removing body parts when shot

Post by frag.machine »

thommoboy wrote:yeah but how would you change models?
In vanilla QuakeC there's a trick to swap the player model by the eyes: both models are precached and their indexes are stored in variables. Look for modelindex_eyes in the source and you'll see how it's done and you can do the same.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
thommoboy
Posts: 95
Joined: Mon Nov 21, 2011 6:35 am

Re: removing body parts when shot

Post by thommoboy »

yeah but how do i change it to the arm when the player shoots the arm or the leg when he shoots the leg?
leileilol
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Re: removing body parts when shot

Post by leileilol »

The old "Severed" QC patch does it by making new frames for player.mdl that just is a pain frame sequence with a limb missing. It'll quickly use up all the 256 frames though, unless you had a frame limit raised in the protocol you can do more dismemberment variancy.
i should not be here
thommoboy
Posts: 95
Joined: Mon Nov 21, 2011 6:35 am

Re: removing body parts when shot

Post by thommoboy »

yeah i got it working but its

setmodel(self, "progs/Necromorph.mdl");
thommoboy
Posts: 95
Joined: Mon Nov 21, 2011 6:35 am

Re: removing body parts when shot

Post by thommoboy »

leileilol wrote:The old "Severed" QC patch does it by making new frames for player.mdl that just is a pain frame sequence with a limb missing. It'll quickly use up all the 256 frames though, unless you had a frame limit raised in the protocol you can do more dismemberment variancy.
i have varying models with various limbs missing

i just want to know how to call a certain model when a certain spot is shot
Arkage
Posts: 66
Joined: Thu Nov 19, 2009 4:17 pm

Re: removing body parts when shot

Post by Arkage »

Your going to have to work out that math sadly. Work out the offsets from their origin.
Ghost_Fang
Posts: 336
Joined: Thu Nov 12, 2009 4:37 am

Re: removing body parts when shot

Post by Ghost_Fang »

when you fire your weapon, it calls Firebullets(); in firebullets it calls upon TraceAttack, traceattack is where you want to look.

You will see if (trace_ent.takedamage), you're going to want to do your math in there. For example, and to get you started, say you want a headshot, you'll do a check to see where the traceline hit the trace_ent.

It looks something like this:

Code: Select all

if (trace_endpos_z > (trace_ent.origin_z + 18))          //the 18 can be changed to find that sweet spot where you want your headshots to be
    {
                damage = damage * 2;                              //Headshots hurt way more, from what I heard, never experienced one myself though
		trace_ent.headshot = TRUE;                      //I personally use a boolean and then the entity checks this and chooses death animations accordingly
           // setmodel(trace_ent, "progs/headless.mdl");  // and/or you can set your hit target's model here such as a headless model if necessary
    }
If you are using my headshot method with a boolean, you will need to find your enemy's dying function(s) and find where it calls the dying animation, and make it check self.headshot (or self.left_arm_gone or whatever) and do animations according to each of them. I would also advise putting self.headshot = 0; in the pain frames to make sure if the headshot doesnt kill him he wont loss his head if you kill him by shooting him in the feet.
thommoboy
Posts: 95
Joined: Mon Nov 21, 2011 6:35 am

Re: removing body parts when shot

Post by thommoboy »

how would i do the trace line thingy XD like find its arm?
thommoboy
Posts: 95
Joined: Mon Nov 21, 2011 6:35 am

Re: removing body parts when shot

Post by thommoboy »

if i give you the mdl can you code according to it just so i can know what to do for others?
ceriux
Posts: 2230
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Re: removing body parts when shot

Post by ceriux »

it would be cool to see a mod which helps you find cordinants sorta like the one for the vwep mod.
Post Reply