removing body parts when shot

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

Re: removing body parts when shot

Post by thommoboy »

can anyone teach me how to do this?
r00k
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

Re: removing body parts when shot

Post by r00k »

Make models with missing limbs, mostly this would be a death sequence.
Call the animation frames when player dies, u can be all actual about it and traceline or just
random which animation to call.


Explosive imagination of youth gets crushed by the conundrum of work...
thommoboy
Posts: 95
Joined: Mon Nov 21, 2011 6:35 am

Re: removing body parts when shot

Post by thommoboy »

no i meant as in can someone teach me how to use the traceline?
ceriux
Posts: 2230
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Re: removing body parts when shot

Post by ceriux »

well, the code should be fairly self explanitory, but to me converting it to work with custom models would be hard.
thommoboy
Posts: 95
Joined: Mon Nov 21, 2011 6:35 am

Re: removing body parts when shot

Post by thommoboy »

the model i am using is just(well im using the base of a demon) but if i sent it to you could you show me how to calculate it or even over slkype
thommoboy
Posts: 95
Joined: Mon Nov 21, 2011 6:35 am

Re: removing body parts when shot

Post by thommoboy »

ceriux wrote:well, the code should be fairly self explanitory, but to me converting it to work with custom models would be hard.
yeah ive got the code i just don't know how to find the trajectory
ceriux
Posts: 2230
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Re: removing body parts when shot

Post by ceriux »

you could always find out how many uints each peace is by it's self. the quake guy is i think 32x 32y 64z (in 3dsmax) so you could take the base, find out the mesurments it's using then draw boxes around your models body parts then get the sizes of those boxes and plug them into the code?

(might work haven't tried it.)
thommoboy
Posts: 95
Joined: Mon Nov 21, 2011 6:35 am

Re: removing body parts when shot

Post by thommoboy »

can someone show me how to do it XD
Jukki
Posts: 214
Joined: Wed Apr 07, 2010 4:59 am

Re: removing body parts when shot

Post by Jukki »

I would like to.

But same time i want you to actualy learn something. You have been basicaly allready told what to do here. Just try your self. You will learn through errors.

And to get you start. Look at the firebullets function. There sill be a Trace_Line function. Also go read qc documentation. There will be told how quakes builtins works. Then try by drawing a image of what you try to do (i do thos with complecs things with math functions). You should have bot math knowledge from school so use it (in example getting height of the bulmets impact would be something like bullethit - monster.origin)

(btw not saying you should not ask. But we are more likely going to answer if you have allready tryed to code it and have like "what is wrong in this code? *pastecode*" than "can ylu guys plezzz show me how to do it"
Ghost_Fang
Posts: 336
Joined: Thu Nov 12, 2009 4:37 am

Re: removing body parts when shot

Post by Ghost_Fang »

thommoboy, I practically wrote one of them for you. The one I wrote will give you headshots, TrackAttack already sends out a traceline, all you need to do is detect where the traceline hit. "trace_endpos" is, well, the end position of the traceline where ever that may be. trace_ent is the entity that has crossed your traceline.

so lets break it down

Code: Select all

if (trace_endpos_z...    //The spot where your traceline ends, specificly the Z axis hence the _z

Code: Select all

> (trace_ent.origin_z + 18))         //Is greater than the traced entity's origin PLUS 18. Origin being the very center of the entity, 18 being about where the head is
             {                                             //Note that 18 may NOT be accurate for your model, increase or decrease it accordingly

Code: Select all

   damage = damage * 2;                              //TraceAttack sets the damage automatically, but we're going to multiply it by 2 for a headshot
 
              trace_ent.headshot = TRUE;                      //TRUE or FALSE (1 or 0) this is the traced entity's field, this will tell the traced entity they just got hit in the head

           // setmodel(trace_ent, "progs/headless.mdl");  // If you want, you can set the traced entity's model right here
    }
So when it all comes together it looks like this:

Code: Select all

if (trace_endpos_z > (trace_ent.origin_z + 18))     
    {
                damage = damage * 2;      
                trace_ent.headshot = TRUE;           
           // setmodel(trace_ent, "progs/headless.mdl"); 
    }
thommoboy
Posts: 95
Joined: Mon Nov 21, 2011 6:35 am

Re: removing body parts when shot

Post by thommoboy »

i tried your code ghost_fang but when i shot the enemy(i tried literally everywhere) nothing changed
Ghost_Fang
Posts: 336
Joined: Thu Nov 12, 2009 4:37 am

Re: removing body parts when shot

Post by Ghost_Fang »

thats just the first half, you need to tell your monster what to do when you perform a headshot, when his self.headshot = TRUE;
DukeInstinct
Posts: 20
Joined: Sat Jul 10, 2010 11:20 pm
Location: DukeLand
Contact:

Re: removing body parts when shot

Post by DukeInstinct »

He probably just straight up copied and pasted with the setmodel line still commented out. I wouldn't be surprised whatsoever.
Image
thommoboy
Posts: 95
Joined: Mon Nov 21, 2011 6:35 am

Re: removing body parts when shot

Post by thommoboy »

hahahahahaha not funny im learning you can't say you were born with a computer in your hands coding quake c can you?
thommoboy
Posts: 95
Joined: Mon Nov 21, 2011 6:35 am

Re: removing body parts when shot

Post by thommoboy »

Ghost_Fang wrote:thats just the first half, you need to tell your monster what to do when you perform a headshot, when his self.headshot = TRUE;
ive used the change model command not the self.headshot command
Post Reply