kickheads on & off?

Discuss programming in the QuakeC language.
Post Reply
smd
Posts: 26
Joined: Sun Sep 23, 2007 2:58 pm

kickheads on & off?

Post by smd »

i've tried out the kickheads tutorial from Ivana Gibson and it works great.
but i only want to kick these heads when i press the MOUSE2 button, so i have added the command

.float kickgibs; into the defs.qc

then

if (self.impulse == 25)
self.kickgibs = TRUE;
if (self.impulse == 26)
self.kickgibs = FALSE;


into weapons.qc

and this

alias +kickgibs_on "impulse 25"
alias -kickgibs_on "impulse 26"

bind MOUSE2 +kickgibs_on


into my autoexec.cfg

and finally


//**********************************************
//Kicking Gibs n Dead Heads
//**********************************************

void() kick_touch;

void() kick_touch =
{
local vector v;

if (self.kickgibs != TRUE)
return;


// only a player can kick it
if (other.classname != "player")
return;

//randomize sound
if (random()< 0.6)
sound(other, CHAN_ITEM, "zombie/z_hit.wav", 1, ATTN_NORM);
else
sound(other, CHAN_ITEM, "zombie/z_miss.wav", 1, ATTN_NORM);

//define velocity
//you can play with these formulas to adjust
//trajectory
v_x = (other.velocity_x*2+50*random());
v_y = (other.velocity_y*2+50*random());
v_z =250 + 160 * random()+(other.velocity_y+other.velocity_x)*0.30;

self.flags = self.flags - ( self.flags & FL_ONGROUND );
self.velocity = v;
};



but it doesnt work!!!

i hope someone knows whats wrong...
Urre
Posts: 1109
Joined: Fri Nov 05, 2004 2:36 am
Location: Moon
Contact:

Post by Urre »

At my first glance it looks like it should work (only looked at the code you added though), what happens? Does it kick it anyway, or does it not work at all?
I was once a Quake modder
smd
Posts: 26
Joined: Sun Sep 23, 2007 2:58 pm

Post by smd »

when i remove

if (self.kickgibs != TRUE)
return;
it works, but without pressing the MOUSE2 button.

with
if (self.kickgibs != TRUE)
return;
nothing happens!
CocoT
Posts: 695
Joined: Tue Dec 14, 2004 5:39 pm
Location: Belly-Gum
Contact:

Post by CocoT »

Shouldn't it be other.kickgibs?
Neurotic Conversions - New location: Update your bookmarks!
RenegadeC
Posts: 391
Joined: Fri Oct 15, 2004 10:19 pm
Location: The freezing hell; Canada
Contact:

Post by RenegadeC »

CocoT wrote:Shouldn't it be other.kickgibs?
Yes it should be.

Also it'd work even nicer just adding "if (other.button2) stuff();" for kicking gibs when holding down the jump button.
smd
Posts: 26
Joined: Sun Sep 23, 2007 2:58 pm

Post by smd »

CocoT wrote:Shouldn't it be other.kickgibs?

yes that is the solution!
now it works fine 8)


thanksssssss !!!
CocoT
Posts: 695
Joined: Tue Dec 14, 2004 5:39 pm
Location: Belly-Gum
Contact:

Post by CocoT »

:wink:
Neurotic Conversions - New location: Update your bookmarks!
Sajt
Posts: 1215
Joined: Sat Oct 16, 2004 3:39 am

Post by Sajt »

You might get head kicking mode stuck on if you release the button while firing a weapon, then press another impulse before it finishes firing.

Using impulses for on/off things is dangerous at best. You'll have to check for those impulses before the attack_finished check, wherever that is.
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
Electro
Posts: 312
Joined: Wed Dec 29, 2004 11:25 pm
Location: Brisbane, Australia
Contact:

Post by Electro »

I'd ditch all the code
and at the top of kick_touch

put

Code: Select all

if (!other.button2)
     return;
done.
Benjamin Darling
http://www.bendarling.net/

Reflex - In development competitive arena fps combining modern tech with the speed, precision and freedom of 90's shooters.
http://www.reflexfps.net/
Post Reply